Update patches to handle vineflower decompiler (#10406)
* Update patches to handle vineflower decompiler * update patches again to handle inlined simple lambdas * update vf again and re-apply/rebuild patches * update patches after removal of verify-merges flag * fix compile issue * remove maven local * fix some issues * address more issues * fix collision patch * use paperweight release * more fixes * update fineflower and fix patches again * add missing comment descriptor --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
This commit is contained in:
@@ -1009,13 +1009,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) {
|
||||
+ int chunkSectionIndex = 0; // Paper - Anti-Xray
|
||||
for(LevelChunkSection levelChunkSection : chunk.getSections()) {
|
||||
for (LevelChunkSection levelChunkSection : chunk.getSections()) {
|
||||
- levelChunkSection.getBiomes().write(buf);
|
||||
+ levelChunkSection.getBiomes().write(buf, null, chunkSectionIndex); // Paper - Anti-Xray
|
||||
+ chunkSectionIndex++; // Paper - Anti-Xray
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
@@ -1031,7 +1031,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
this.heightmaps = new CompoundTag();
|
||||
|
||||
for(Map.Entry<Heightmap.Types, Heightmap> entry : chunk.getHeightmaps()) {
|
||||
for (Entry<Heightmap.Types, Heightmap> entry : chunk.getHeightmaps()) {
|
||||
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
||||
}
|
||||
|
||||
@@ -1047,7 +1047,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
this.blockEntitiesData = Lists.newArrayList();
|
||||
|
||||
for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
||||
for (Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
||||
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
||||
return byteBuf;
|
||||
}
|
||||
@@ -1058,14 +1058,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) {
|
||||
+ int chunkSectionIndex = 0;
|
||||
+
|
||||
for(LevelChunkSection levelChunkSection : chunk.getSections()) {
|
||||
for (LevelChunkSection levelChunkSection : chunk.getSections()) {
|
||||
- levelChunkSection.write(buf);
|
||||
+ levelChunkSection.write(buf, chunkPacketInfo, chunkSectionIndex);
|
||||
+ chunkSectionIndex++;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
@@ -1146,10 +1146,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public
|
||||
handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player);
|
||||
- handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null));
|
||||
- handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null));
|
||||
+ // Paper start - Anti-Xray
|
||||
+ final boolean shouldModify = world.chunkPacketBlockController.shouldModify(handler.player, chunk);
|
||||
+ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null, shouldModify));
|
||||
+ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null, shouldModify));
|
||||
+ // Paper end - Anti-Xray
|
||||
// Paper start - PlayerChunkLoadEvent
|
||||
if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
||||
@@ -1284,8 +1284,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
return 0;
|
||||
};
|
||||
private static final int MIN_PALETTE_BITS = 0;
|
||||
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> 0;
|
||||
public final IdMap<T> registry;
|
||||
+ private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values
|
||||
private volatile PalettedContainer.Data<T> data;
|
||||
@@ -1308,20 +1308,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
public static <T> Codec<PalettedContainerRO<T>> codecRO(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
|
||||
PalettedContainerRO.Unpacker<T, PalettedContainerRO<T>> unpacker = (idListx, paletteProviderx, serialized) -> {
|
||||
- return unpack(idListx, paletteProviderx, serialized).map((result) -> {
|
||||
+ return unpack(idListx, paletteProviderx, serialized, defaultValue, null).map((result) -> { // Paper - Anti-Xray - Add preset values
|
||||
return result;
|
||||
});
|
||||
};
|
||||
PalettedContainerRO.Unpacker<T, PalettedContainerRO<T>> unpacker = (idListx, paletteProviderx, serialized) -> unpack(
|
||||
- idListx, paletteProviderx, serialized
|
||||
+ idListx, paletteProviderx, serialized, defaultValue, null // Paper - Anti-Xray - Add preset values
|
||||
)
|
||||
.map(result -> (PalettedContainerRO<T>)result);
|
||||
return codec(idList, entryCodec, paletteProvider, defaultValue, unpacker);
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
- public PalettedContainer(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration<T> dataProvider, BitStorage storage, List<T> paletteEntries) {
|
||||
+ // Paper start - Anti-Xray - Add preset values
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public PalettedContainer(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration<T> dataProvider, BitStorage storage, List<T> paletteEntries) { this(idList, paletteProvider, dataProvider, storage, paletteEntries, null, null); }
|
||||
+ public PalettedContainer(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration<T> dataProvider, BitStorage storage, List<T> paletteEntries, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) {
|
||||
public PalettedContainer(
|
||||
IdMap<T> idList,
|
||||
PalettedContainer.Strategy paletteProvider,
|
||||
PalettedContainer.Configuration<T> dataProvider,
|
||||
BitStorage storage,
|
||||
- List<T> paletteEntries
|
||||
+ List<T> paletteEntries, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues
|
||||
) {
|
||||
+ this.presetValues = presetValues;
|
||||
this.registry = idList;
|
||||
this.strategy = paletteProvider;
|
||||
@@ -1369,7 +1375,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
this.strategy = paletteProvider;
|
||||
this.registry = idList;
|
||||
this.data = this.createOrReuseData((PalettedContainer.Data<T>)null, 0);
|
||||
this.data = this.createOrReuseData(null, 0);
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
@Override
|
||||
public synchronized int onResize(int newBits, T object) { // Paper - synchronize
|
||||
@@ -1413,7 +1419,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
} finally {
|
||||
this.release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start - Anti-Xray; Add chunk packet info
|
||||
@@ -1435,14 +1440,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
} finally {
|
||||
this.release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized) {
|
||||
+ private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values
|
||||
private static <T> DataResult<PalettedContainer<T>> unpack(
|
||||
- IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized
|
||||
+ IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues // Paper - Anti-Xray - Add preset values
|
||||
) {
|
||||
List<T> list = serialized.paletteEntries();
|
||||
int i = paletteProvider.size();
|
||||
int j = paletteProvider.calculateBitsForSerialization(idList, list.size());
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user