mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 14:35:11 +01:00
Patches!!!!!!! (we are done)
This commit is contained in:
parent
6da0d8cc91
commit
345b5c1c4c
6 changed files with 64 additions and 31 deletions
|
@ -61,7 +61,7 @@ index ed8e875fff01c6b464fbaefbb0a3f417f9d67a72..aba5f694b25507c9ab2e214bc1f25e0a
|
|||
|
||||
public <T extends Entity> List<? extends T> getEntities(EntityTypeTest<Entity, T> filter, Predicate<? super T> predicate) {
|
||||
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
index 0382b6597a130d746f8954a93a756a9d1ac81d50..cb39c629af1827078f35904a373d35a63fea17ff 100644
|
||||
index 7984f17cd9c4cef8100909b6c33b3144c8096fcf..868c9bbb12c8cfe76abb62774cf08102b727063b 100644
|
||||
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -116,7 +116,13 @@ public class WorldUpgrader {
|
||||
|
|
|
@ -270,10 +270,10 @@ index 244a19ecd0234fa1d7a6ecfea20751595688605d..8893aa1fe4b033fdc25ebe6f3a3606af
|
|||
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
|
||||
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dynamicRegistryManager, eraseCache, recreateRegionFiles);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0f3601f2f1a7ac53425129df6498ed0df302dec8..3cb64c6c870454ee3090d6c88bede8b58d9d3361 100644
|
||||
index 5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1..a43f597d1148e00a6533f74c25ce272cd4e26dc4 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -595,11 +595,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -599,11 +599,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worlddata = new PrimaryLevelData(worldsettings, worldoptions, worlddimensions_b.specialWorldProperty(), lifecycle);
|
||||
}
|
||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
||||
|
@ -286,7 +286,7 @@ index 0f3601f2f1a7ac53425129df6498ed0df302dec8..3cb64c6c870454ee3090d6c88bede8b5
|
|||
|
||||
PrimaryLevelData iworlddataserver = worlddata;
|
||||
boolean flag = worlddata.isDebugWorld();
|
||||
@@ -614,6 +610,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -618,6 +614,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ index 0f3601f2f1a7ac53425129df6498ed0df302dec8..3cb64c6c870454ee3090d6c88bede8b5
|
|||
|
||||
if (dimensionKey == LevelStem.OVERWORLD) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index a137b4a3be01a0333e5fdc1585098fafeeb4f725..ab502b4384d977ac78b05eaa7dd14eaf811f57b5 100644
|
||||
index 68746df814aa1a8714e199ff887cad9f8bfa283c..6ddbb71ad67530a49efbecec949b9578c4425b39 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -178,6 +178,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
@ -321,10 +321,10 @@ index a137b4a3be01a0333e5fdc1585098fafeeb4f725..ab502b4384d977ac78b05eaa7dd14eaf
|
|||
return this.world;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
index a73a37320da2c141fc2db9d1d61233a34ce0c906..9607e38e39daf8196f1b728c0019a283d730b885 100644
|
||||
index af50a02bafb7c1db4569604d1e69f95daab6d2a5..541b99dc1361a6ebd40873e45a1acd12021f1fad 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -62,6 +62,29 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -69,6 +69,29 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
|
||||
// Paper start
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] API for checking sent chunks
|
|||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
index 1b090f1e79b996e52097afc49c1cec85936653e6..bf3c5efa0d58c58a5b0b6b73880aaf03c8a37c12 100644
|
||||
index ee58c67cb2bd78159cce19ec75f13dc6168a0e7a..149cfb0587299f72fcfddf395fb71b70438986c1 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
@@ -1107,6 +1107,11 @@ public class RegionizedPlayerChunkLoader {
|
||||
@@ -1048,6 +1048,11 @@ public class RegionizedPlayerChunkLoader {
|
||||
|
||||
// now all tickets should be removed, which is all of our external state
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ index 1b090f1e79b996e52097afc49c1cec85936653e6..bf3c5efa0d58c58a5b0b6b73880aaf03
|
|||
|
||||
// TODO rebase into util patch
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 3fbc0312ed291a3878c26c005bfc79f417c695e4..44f4665db613c558078df5bb49106e4ca5679dfe 100644
|
||||
index 03e16706e378e7d4d1e74aca7daef62c3cbe3592..d4eb482c54a9e1430ee31e873e02577710aa7322 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -3392,6 +3392,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -3454,6 +3454,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
// Paper end
|
||||
|
|
@ -5,27 +5,29 @@ Subject: [PATCH] Hide unnecessary itemmeta from clients
|
|||
|
||||
TODO: Needs updating for data components
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index a51564e8dce3c125ed5f05cc23548a05c1e79a95..d2c2075fb0378fd7ec148281d37d886c77a78ce8 100644
|
||||
index 22eec853588ded2d255ab69d408f8e987832abe2..dda4fbd63681ab9614ebbb55632355f30d7b19ac 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -337,7 +337,7 @@ public class ServerEntity {
|
||||
@@ -348,7 +348,10 @@ public class ServerEntity {
|
||||
ItemStack itemstack = ((LivingEntity) this.entity).getItemBySlot(enumitemslot);
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
// Paper start - prevent oversized data
|
||||
final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
|
||||
- list.add(Pair.of(enumitemslot, sanitized));
|
||||
- list.add(Pair.of(enumitemslot, itemstack.copy()));
|
||||
+ // Paper start - prevent oversized data
|
||||
+ final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
|
||||
+ list.add(Pair.of(enumitemslot, ((LivingEntity) this.entity).stripMeta(sanitized, false))); // Paper - Hide unnecessary item meta
|
||||
// Paper end - prevent oversized data
|
||||
+ // Paper end - prevent oversized data
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 8fcb241e8d161c9fb024a2a0488f8c29784a74f1..7127c6f163cc00eb439eb37665df3e1a4bf27cc2 100644
|
||||
index 32076a765d48d59b339d600f69afa85edbcf833c..6b905d0245f16794078de34fb8509a0cd0869382 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2565,8 +2565,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -2802,8 +2802,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
// Refresh the current entity metadata
|
||||
entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player);
|
||||
entity.refreshEntityData(ServerGamePacketListenerImpl.this.player);
|
||||
// SPIGOT-7136 - Allays
|
||||
- if (entity instanceof Allay) {
|
||||
- ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
|
@ -35,19 +37,22 @@ index 8fcb241e8d161c9fb024a2a0488f8c29784a74f1..7127c6f163cc00eb439eb37665df3e1a
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 8025e351fb3e24aa67b31eca74be1bc368592851..e44a45ced6f7cd7db44388bb2e85c722b6b5ca8a 100644
|
||||
index 9ff43ff4076c658b8561c5a7abd067423830f964..bbc67e97de3ab1cd20c595e794aea27cf00a7cb0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3210,7 +3210,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3299,7 +3299,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
equipmentChanges.forEach((enumitemslot, itemstack) -> {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
|
||||
// Paper start - prevent oversized data
|
||||
ItemStack toSend = sanitizeItemStack(itemstack1, true);
|
||||
- list.add(Pair.of(enumitemslot, toSend));
|
||||
- list.add(Pair.of(enumitemslot, itemstack1));
|
||||
+ // Paper start - prevent oversized data
|
||||
+ ItemStack toSend = sanitizeItemStack(itemstack1, true);
|
||||
+ list.add(Pair.of(enumitemslot, stripMeta(toSend, toSend == itemstack1))); // Paper - Hide unnecessary item meta
|
||||
// Paper end - prevent oversized data
|
||||
+ // Paper end - prevent oversized data
|
||||
switch (enumitemslot.getType()) {
|
||||
case HAND:
|
||||
@@ -3224,6 +3224,77 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.setLastHandItem(enumitemslot, itemstack1);
|
||||
@@ -3315,6 +3318,105 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
|
||||
}
|
||||
|
||||
|
@ -122,6 +127,34 @@ index 8025e351fb3e24aa67b31eca74be1bc368592851..e44a45ced6f7cd7db44388bb2e85c722
|
|||
+ }
|
||||
+ // Paper end - Hide unnecessary item meta
|
||||
+
|
||||
// Paper start - prevent oversized data
|
||||
public static ItemStack sanitizeItemStack(final ItemStack itemStack, final boolean copyItemStack) {
|
||||
if (itemStack.isEmpty() || !itemStack.hasTag()) {
|
||||
+ // Paper start - prevent oversized data
|
||||
+ public static ItemStack sanitizeItemStack(final ItemStack itemStack, final boolean copyItemStack) {
|
||||
+ if (itemStack.isEmpty() || !itemStack.hasTag()) {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ final ItemStack copy = copyItemStack ? itemStack.copy() : itemStack;
|
||||
+ final CompoundTag tag = copy.getTag();
|
||||
+ if (copy.is(Items.BUNDLE) && tag.get("Items") instanceof ListTag oldItems && !oldItems.isEmpty()) {
|
||||
+ // Bundles change their texture based on their fullness.
|
||||
+ org.bukkit.inventory.meta.BundleMeta bundleMeta = (org.bukkit.inventory.meta.BundleMeta) copy.asBukkitMirror().getItemMeta();
|
||||
+ int sizeUsed = 0;
|
||||
+ for (org.bukkit.inventory.ItemStack item : bundleMeta.getItems()) {
|
||||
+ int scale = 64 / item.getMaxStackSize();
|
||||
+ sizeUsed += scale * item.getAmount();
|
||||
+ }
|
||||
+ // Now we add a single fake item that uses the same amount of slots as all other items.
|
||||
+ ListTag items = new ListTag();
|
||||
+ items.add(new ItemStack(Items.PAPER, sizeUsed).save(new CompoundTag()));
|
||||
+ tag.put("Items", items);
|
||||
+ }
|
||||
+ if (tag.get("BlockEntityTag") instanceof CompoundTag blockEntityTag) {
|
||||
+ blockEntityTag.remove("Items");
|
||||
+ }
|
||||
+ return copy;
|
||||
+ }
|
||||
+ // Paper end - prevent oversized data
|
||||
+
|
||||
private ItemStack getLastArmorItem(EquipmentSlot slot) {
|
||||
return (ItemStack) this.lastArmorItemStacks.get(slot.getIndex());
|
||||
}
|
Loading…
Reference in a new issue