Skip to content

Commit f139338

Browse files
committed
雨屏雨屏❤️玩饥荒不理我呜呜呜😔
1 parent 09b2602 commit f139338

206 files changed

Lines changed: 4329 additions & 653 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/net/minecraft/ChatFormatting.java
2+
+++ b/net/minecraft/ChatFormatting.java
3+
@@ -30,7 +_,7 @@
4+
5+
public static final char PREFIX_CODE = '\u00a7';
6+
private static final Pattern STRIP_FORMATTING_PATTERN = Pattern.compile("(?i)\u00a7[0-9A-FK-OR]");
7+
- private final char code;
8+
+ public final char code;
9+
private final String toString;
10+
11+
ChatFormatting(char code) {
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
--- a/net/minecraft/nbt/ListTag.java
22
+++ b/net/minecraft/nbt/ListTag.java
3-
@@ -146,6 +_,15 @@
3+
@@ -146,7 +_,16 @@
44
this(new ArrayList<>());
55
}
66

7+
- ListTag(List<Tag> list) {
78
+ /**
89
+ * Neo: create a list tag with the given initial capacity.
910
+ *
@@ -13,6 +14,16 @@
1314
+ this(new ArrayList<>(initialCapacity));
1415
+ }
1516
+
16-
public ListTag(List<Tag> list) {
17+
+ public ListTag(List<Tag> list) {
1718
this.list = list;
1819
}
20+
21+
@@ -189,7 +_,7 @@
22+
}
23+
24+
@VisibleForTesting
25+
- byte identifyRawElementType() {
26+
+ public byte identifyRawElementType() {
27+
byte homogenousType = 0;
28+
29+
for (Tag element : this.list) {

patches/net/minecraft/network/Connection.java.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
--- a/net/minecraft/network/Connection.java
22
+++ b/net/minecraft/network/Connection.java
3+
@@ -66,8 +_,8 @@
4+
private final PacketFlow receiving;
5+
private volatile boolean sendLoginDisconnect = true;
6+
private final Queue<Consumer<Connection>> pendingActions = Queues.newConcurrentLinkedQueue();
7+
- private Channel channel;
8+
- private SocketAddress address;
9+
+ public Channel channel;
10+
+ public SocketAddress address;
11+
private volatile @Nullable PacketListener disconnectListener;
12+
private volatile @Nullable PacketListener packetListener;
13+
private @Nullable DisconnectionDetails disconnectionDetails;
314
@@ -81,6 +_,9 @@
415
private volatile @Nullable DisconnectionDetails delayedDisconnect;
516
private @Nullable BandwidthDebugMonitor bandwidthDebugMonitor;

patches/net/minecraft/network/chat/TextColor.java.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
private static final String CUSTOM_COLOR_PREFIX = "#";
1212
public static final Codec<TextColor> CODEC = Codec.STRING.comapFlatMap(TextColor::parseColor, TextColor::serialize);
1313
private static final Map<String, TextColor> NAMED_COLORS = new HashMap<>();
14-
@@ -32,15 +_,26 @@
14+
@@ -31,16 +_,27 @@
15+
public static final TextColor YELLOW = named("yellow", 16777045);
1516
public static final TextColor WHITE = named("white", 16777215);
1617
private final int value;
17-
public final @Nullable String name;
18+
- private final @Nullable String name;
19+
+ public final @Nullable String name;
1820
+ // CraftBukkit start
1921
+ @Nullable
2022
+ public final ChatFormatting format;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
2+
+++ b/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
3+
@@ -36,7 +_,7 @@
4+
return create(blockEntity, BlockEntity::getUpdateTag);
5+
}
6+
7+
- private ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> type, CompoundTag tag) {
8+
+ public ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> type, CompoundTag tag) {
9+
this.pos = pos;
10+
this.type = type;
11+
this.tag = tag;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
2+
+++ b/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
3+
@@ -19,7 +_,7 @@
4+
ClientboundBlockUpdatePacket::new
5+
);
6+
private final BlockPos pos;
7+
- private final BlockState blockState;
8+
+ public final BlockState blockState;
9+
10+
public ClientboundBlockUpdatePacket(BlockPos pos, BlockState state) {
11+
this.pos = pos;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--- a/net/minecraft/network/protocol/game/ServerboundMovePlayerPacket.java
2+
+++ b/net/minecraft/network/protocol/game/ServerboundMovePlayerPacket.java
3+
@@ -9,15 +_,15 @@
4+
public abstract class ServerboundMovePlayerPacket implements Packet<ServerGamePacketListener> {
5+
private static final int FLAG_ON_GROUND = 1;
6+
private static final int FLAG_HORIZONTAL_COLLISION = 2;
7+
- protected final double x;
8+
- protected final double y;
9+
- protected final double z;
10+
- protected final float yRot;
11+
- protected final float xRot;
12+
+ public final double x;
13+
+ public final double y;
14+
+ public final double z;
15+
+ public final float yRot;
16+
+ public final float xRot;
17+
protected final boolean onGround;
18+
protected final boolean horizontalCollision;
19+
- protected final boolean hasPos;
20+
- protected final boolean hasRot;
21+
+ public final boolean hasPos;
22+
+ public final boolean hasRot;
23+
24+
private static int packFlags(boolean onGround, boolean horizontalCollision) {
25+
int flags = 0;

patches/net/minecraft/server/Main.java.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@
6464
WorldDimensions.Complete finalDimensions = dimensions.bake(datapackDimensions);
6565
Lifecycle lifecycle = finalDimensions.lifecycle().add(context.datapackWorldgen().allRegistriesLifecycle());
6666
PrimaryLevelData primaryLevelData = new PrimaryLevelData(createLevelSettings, finalDimensions.specialWorldProperty(), lifecycle);
67+
@@ -301,7 +_,7 @@
68+
return new WorldLoader.InitConfig(packConfig, Commands.CommandSelection.DEDICATED, properties.functionPermissions);
69+
}
70+
71+
- private static void forceUpgrade(
72+
+ public static void forceUpgrade(
73+
LevelStorageSource.LevelStorageAccess storageSource,
74+
DataFixer fixerUpper,
75+
boolean eraseCache,

patches/net/minecraft/server/MinecraftServer.java.patch

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import net.minecraft.CrashReport;
1010
import net.minecraft.CrashReportCategory;
1111
import net.minecraft.ReportType;
12-
@@ -186,10 +_,15 @@
12+
@@ -186,11 +_,16 @@
1313
import net.minecraft.world.phys.Vec2;
1414
import net.minecraft.world.phys.Vec3;
1515
import net.minecraft.world.scores.ScoreboardSaveData;
@@ -22,10 +22,70 @@
2222
+import org.teneted.neotenet.injection.server.MinecraftServerInjection;
2323

2424
-public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, ServerInfo, ChunkIOErrorReporter {
25+
- private static final Logger LOGGER = LogUtils.getLogger();
2526
+public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, ServerInfo, ChunkIOErrorReporter, MinecraftServerInjection {
26-
public static final Logger LOGGER = LogUtils.getLogger();
27+
+ public static final Logger LOGGER = LogUtils.getLogger();
2728
public static final String VANILLA_BRAND = "vanilla";
2829
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
30+
private static final int TICK_STATS_SPAN = 100;
31+
@@ -214,8 +_,8 @@
32+
public static final Supplier<GameRules> DEFAULT_GAME_RULES = () -> new GameRules(WorldDataConfiguration.DEFAULT.enabledFeatures());
33+
public static final NameAndId ANONYMOUS_PLAYER_PROFILE = new NameAndId(Util.NIL_UUID, "Anonymous Player");
34+
public static final String SERVER_THREAD_NAME = "Server thread";
35+
- protected final LevelStorageSource.LevelStorageAccess storageSource;
36+
- protected final PlayerDataStorage playerDataStorage;
37+
+ public LevelStorageSource.LevelStorageAccess storageSource;
38+
+ public final PlayerDataStorage playerDataStorage;
39+
private final SavedDataStorage savedDataStorage;
40+
private final List<Runnable> tickables = Lists.newArrayList();
41+
private final GameRules gameRules;
42+
@@ -225,16 +_,16 @@
43+
private boolean willStartRecordingMetrics;
44+
private MinecraftServer.@Nullable TimeProfiler debugCommandProfiler;
45+
private boolean debugCommandProfilerDelayStart;
46+
- private final ServerConnectionListener connection;
47+
- private final LevelLoadListener levelLoadListener;
48+
+ private ServerConnectionListener connection;
49+
+ public final LevelLoadListener levelLoadListener;
50+
private @Nullable ServerStatus status;
51+
private ServerStatus.@Nullable Favicon statusIcon;
52+
private final RandomSource random = RandomSource.create();
53+
- private final DataFixer fixerUpper;
54+
+ public final DataFixer fixerUpper;
55+
private String localIp;
56+
private int port = -1;
57+
private final LayeredRegistryAccess<RegistryLayer> registries;
58+
- private final Map<ResourceKey<Level>, ServerLevel> levels = Maps.newLinkedHashMap();
59+
+ private Map<ResourceKey<Level>, ServerLevel> levels = Maps.newLinkedHashMap();
60+
private PlayerList playerList;
61+
private volatile boolean running = true;
62+
private boolean stopped;
63+
@@ -256,7 +_,7 @@
64+
private final NotificationManager notificationManager;
65+
private final ServerActivityMonitor serverActivityMonitor;
66+
private long lastServerStatus;
67+
- private final Thread serverThread;
68+
+ public final Thread serverThread;
69+
private long lastTickNanos = Util.getNanos();
70+
private long taskExecutionStartNanos = Util.getNanos();
71+
private long idleTimeNanos;
72+
@@ -276,13 +_,13 @@
73+
private boolean enforceWhitelist;
74+
private boolean usingWhitelist;
75+
private float smoothedTickTimeMillis;
76+
- private final Executor executor;
77+
+ public final Executor executor;
78+
private @Nullable String serverId;
79+
- private MinecraftServer.ReloadableResources resources;
80+
+ public MinecraftServer.ReloadableResources resources;
81+
private final StructureTemplateManager structureTemplateManager;
82+
private final ServerTickRateManager tickRateManager;
83+
private final ServerDebugSubscribers debugSubscribers = new ServerDebugSubscribers(this);
84+
- protected final WorldData worldData;
85+
+ protected WorldData worldData;
86+
private LevelData.RespawnData effectiveRespawnData = LevelData.RespawnData.DEFAULT;
87+
private final PotionBrewing potionBrewing;
88+
private FuelValues fuelValues;
2989
@@ -293,10 +_,21 @@
3090
private final PacketProcessor packetProcessor;
3191
private final TimerQueue<MinecraftServer> scheduledEvents;
@@ -85,6 +145,15 @@
85145
ChunkPos spawnChunk = ChunkPos.containing(chunkSource.randomState().sampler().findSpawnPosition());
86146
levelLoadListener.start(LevelLoadListener.Stage.PREPARE_GLOBAL_SPAWN, 0);
87147
levelLoadListener.updateFocus(level.dimension(), spawnChunk);
148+
@@ -542,7 +_,7 @@
149+
levelData.setGameType(GameType.SPECTATOR);
150+
}
151+
152+
- private void prepareLevels() {
153+
+ public void prepareLevels() {
154+
ChunkLoadCounter chunkLoadCounter = new ChunkLoadCounter();
155+
156+
for (ServerLevel level : this.levels.values()) {
88157
@@ -550,6 +_,7 @@
89158
TicketStorage savedTickets = level.getDataStorage().get(TicketStorage.TYPE);
90159
if (savedTickets != null) {

patches/net/minecraft/server/ReloadableServerResources.java.patch

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
--- a/net/minecraft/server/ReloadableServerResources.java
22
+++ b/net/minecraft/server/ReloadableServerResources.java
3-
@@ -30,6 +_,11 @@
3+
@@ -24,12 +_,17 @@
4+
private static final Logger LOGGER = LogUtils.getLogger();
5+
private static final CompletableFuture<Unit> DATA_RELOAD_INITIAL_TASK = CompletableFuture.completedFuture(Unit.INSTANCE);
6+
private final ReloadableServerRegistries.Holder fullRegistryHolder;
7+
- private final Commands commands;
8+
+ public Commands commands;
9+
private final RecipeManager recipes;
10+
private final ServerAdvancementManager advancements;
411
private final ServerFunctionLibrary functionLibrary;
512
private final List<Registry.PendingTags<?>> postponedTags;
613
private final List<DataComponentInitializers.PendingComponents<?>> newComponents;

0 commit comments

Comments
 (0)