diff --git a/build-data/paper.at b/build-data/paper.at index 709f3c01a..2779d00d8 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -202,3 +202,6 @@ public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I # Implement an API for CanPlaceOn and CanDestroy NBT values public net.minecraft.commands.arguments.blocks.BlockStateParser id + +# Villager Restock API +public net.minecraft.world.entity.npc.Villager numberOfRestocksToday diff --git a/patches/server/0389-Pillager-patrol-spawn-settings-and-per-player-option.patch b/patches/server/0389-Pillager-patrol-spawn-settings-and-per-player-option.patch index bd132c360..57a842d2b 100644 --- a/patches/server/0389-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/patches/server/0389-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -48,7 +48,7 @@ index 14f88e575f46d81175eaa04b3e7294990e749a14..f758a85306b9df817e60577b7ffcf777 public boolean queueHealthUpdatePacket = false; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -index 744b58d59a5f34ed3bd6f2d4a0f876acfa6a7135..275d18e33b468e2ca343bb8b2632f0775aef52f4 100644 +index 744b58d59a5f34ed3bd6f2d4a0f876acfa6a7135..4594252a89d5f8abe2b0c43507758c5cbd2a4744 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java @@ -4,11 +4,12 @@ import java.util.Random; @@ -65,14 +65,7 @@ index 744b58d59a5f34ed3bd6f2d4a0f876acfa6a7135..275d18e33b468e2ca343bb8b2632f077 import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.CustomSpawner; import net.minecraft.world.level.GameRules; -@@ -20,13 +21,13 @@ import net.minecraft.world.level.block.state.BlockState; - - public class PatrolSpawner implements CustomSpawner { - -- private int nextTick; -+ private int nextTick;@Deprecated private int getSpawnDelay() { return nextTick; } @Deprecated private void setSpawnDelay(int spawnDelay) { this.nextTick = spawnDelay; } // Paper - OBFHELPER - - public PatrolSpawner() {} +@@ -26,7 +27,7 @@ public class PatrolSpawner implements CustomSpawner { @Override public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { @@ -106,8 +99,8 @@ index 744b58d59a5f34ed3bd6f2d4a0f876acfa6a7135..275d18e33b468e2ca343bb8b2632f077 } else { - this.nextTick += 12000 + random.nextInt(1200); - long i = world.getDayTime() / 24000L; -+ setSpawnDelay(getSpawnDelay() - 1); -+ patrolSpawnDelay = getSpawnDelay(); ++ this.nextTick--; ++ patrolSpawnDelay = this.nextTick; + } + + if (patrolSpawnDelay > 0) { @@ -122,7 +115,7 @@ index 744b58d59a5f34ed3bd6f2d4a0f876acfa6a7135..275d18e33b468e2ca343bb8b2632f077 + if (world.paperConfig.patrolPerPlayerDelay) { + entityhuman.patrolSpawnDelay += world.paperConfig.patrolDelay + random.nextInt(1200); + } else { -+ setSpawnDelay(getSpawnDelay() + world.paperConfig.patrolDelay + random.nextInt(1200)); ++ this.nextTick += world.paperConfig.patrolDelay + random.nextInt(1200); + } - if (i >= 5L && world.isDay()) { diff --git a/patches/server/0426-Villager-Restocks-API.patch b/patches/server/0426-Villager-Restocks-API.patch index abfb0d7b3..f6fe4b982 100644 --- a/patches/server/0426-Villager-Restocks-API.patch +++ b/patches/server/0426-Villager-Restocks-API.patch @@ -4,21 +4,8 @@ Date: Sun, 26 Apr 2020 23:49:01 -0400 Subject: [PATCH] Villager Restocks API -diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 426fa33c9e5ddf2de5435859ee4a5f352313869c..29d8448e1e38c571f6c0019fcb45a9df82eabbe5 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/Villager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -127,7 +127,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - private long lastGossipDecayTime; - private int villagerXp; - private long lastRestockGameTime; -- private int numberOfRestocksToday; -+ private int numberOfRestocksToday; @Deprecated public int getRestocksToday(){ return this.numberOfRestocksToday; } @Deprecated public void setRestocksToday(int restocksToday){ this.numberOfRestocksToday = restocksToday; } // Paper OBFHELPER - private long lastRestockCheckDayTime; - private boolean assignProfessionWhenSpawned; - private static final ImmutableList> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.HOME, MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, MemoryModuleType.MEETING_POINT, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.VISIBLE_VILLAGER_BABIES, MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.BREED_TARGET, MemoryModuleType.PATH, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_BED, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.SECONDARY_JOB_SITE, MemoryModuleType.HIDING_PLACE, MemoryModuleType.HEARD_BELL_TIME, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.LAST_SLEPT, MemoryModuleType.LAST_WOKEN, MemoryModuleType.LAST_WORKED_AT_POI, MemoryModuleType.GOLEM_DETECTED_RECENTLY}); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index e22453a79371266c3dad450e6c82cb24babcece8..6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed 100644 +index e22453a79371266c3dad450e6c82cb24babcece8..fe3a73e9cdb85fdf8385f0a0d096a991541cbf60 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -83,6 +83,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { @@ -28,12 +15,12 @@ index e22453a79371266c3dad450e6c82cb24babcece8..6b16bb1226515b8cbb477e62b617ee1a + // Paper start + @Override + public int getRestocksToday() { -+ return getHandle().getRestocksToday(); ++ return getHandle().numberOfRestocksToday; + } + + @Override + public void setRestocksToday(int restocksToday) { -+ getHandle().setRestocksToday(restocksToday); ++ getHandle().numberOfRestocksToday = restocksToday; + } + // Paper end + diff --git a/patches/server/0431-Implement-Mob-Goal-API.patch b/patches/server/0431-Implement-Mob-Goal-API.patch index bc0a20c82..468cdd1e6 100644 --- a/patches/server/0431-Implement-Mob-Goal-API.patch +++ b/patches/server/0431-Implement-Mob-Goal-API.patch @@ -491,7 +491,7 @@ index 0000000000000000000000000000000000000000..dfc026d183adab1dde5942f36e7a281b +} diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java new file mode 100644 -index 0000000000000000000000000000000000000000..ee500489fca34c339175b5209ebcf3417640b166 +index 0000000000000000000000000000000000000000..8cd0d4b73d3b5c5bb5d83cca9d13e165a7d9b792 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java @@ -0,0 +1,54 @@ @@ -510,7 +510,7 @@ index 0000000000000000000000000000000000000000..ee500489fca34c339175b5209ebcf341 + public PaperCustomGoal(Goal handle) { + this.handle = handle; + -+ this.setTypes(MobGoalHelper.paperToVanilla(handle.getTypes())); ++ this.setFlags(MobGoalHelper.paperToVanilla(handle.getTypes())); + if (this.getGoalTypes().size() == 0) { + this.getGoalTypes().addUnchecked(Flag.UNKNOWN_BEHAVIOR); + } @@ -778,7 +778,7 @@ index 0000000000000000000000000000000000000000..2f9e87d37a8ca794b12098232836295a +} diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java new file mode 100644 -index 0000000000000000000000000000000000000000..bb06eb216a3f19af06abef3b84dd4191f5728256 +index 0000000000000000000000000000000000000000..6ab8ecb56d2ea885782a03d2ba3adbd9e3fd5642 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java @@ -0,0 +1,61 @@ @@ -810,12 +810,12 @@ index 0000000000000000000000000000000000000000..bb06eb216a3f19af06abef3b84dd4191 + + @Override + public boolean shouldActivate() { -+ return handle.shouldActivate2(); ++ return handle.canUse(); + } + + @Override + public boolean shouldStayActive() { -+ return handle.shouldStayActive2(); ++ return handle.canContinueToUse(); + } + + @Override @@ -857,14 +857,13 @@ index 9df0006c1a283f77c4d01d9fce9062fc1c9bbb1f..b3329c6fcd6758a781a51f5ba8f5052a + } } diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -index 8c2ec30a35e86f2b30863045b586a67e485c624b..5a92574307bc27a18a383f1356a7007e1dd15f9c 100644 +index 8c2ec30a35e86f2b30863045b586a67e485c624b..9cb5ccf4815b56169b63b34da88e73944f5d4f80 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -@@ -6,9 +6,17 @@ public abstract class Goal { +@@ -6,6 +6,14 @@ public abstract class Goal { private final EnumSet flags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector -- public abstract boolean canUse(); + // Paper start make sure goaltypes is never empty + public Goal() { + if (this.goalTypes.size() == 0) { @@ -873,23 +872,13 @@ index 8c2ec30a35e86f2b30863045b586a67e485c624b..5a92574307bc27a18a383f1356a7007e + } + // Paper end + -+ public boolean canUse() { return this.shouldActivate(); } @Deprecated public boolean shouldActivate() { return false;} @Deprecated public boolean shouldActivate2() { return canUse(); } // Paper - OBFHELPER, for both directions... + public abstract boolean canUse(); -- public boolean canContinueToUse() { -+ public boolean canContinueToUse() { return this.shouldStayActive(); } @Deprecated public boolean shouldStayActive2() { return canContinueToUse(); } @Deprecated public boolean shouldStayActive() { // Paper - OBFHELPER, for both directions... - return this.canUse(); - } - -@@ -25,10 +33,14 @@ public abstract class Goal { - public void tick() { - } - -- public void setFlags(EnumSet controls) { -+ @Deprecated public void setFlags(EnumSet controls) { this.setTypes(controls); } public void setTypes(EnumSet enumset) { // Paper - OBFHELPER + public boolean canContinueToUse() { +@@ -29,6 +37,10 @@ public abstract class Goal { // Paper start - remove streams from pathfindergoalselector this.goalTypes.clear(); -- this.goalTypes.addAllUnchecked(controls); -+ this.goalTypes.addAllUnchecked(enumset); + this.goalTypes.addAllUnchecked(controls); + // make sure its never empty + if (this.goalTypes.size() == 0) { + this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR); diff --git a/patches/server/0434-Add-villager-reputation-API.patch b/patches/server/0434-Add-villager-reputation-API.patch index 1a27f0065..19e68dc64 100644 --- a/patches/server/0434-Add-villager-reputation-API.patch +++ b/patches/server/0434-Add-villager-reputation-API.patch @@ -61,20 +61,8 @@ index 2e342e1c258180dc02080f76385351c0a65eade2..39c0fbae8b94dabd27ee8687015557c6 } static class GossipEntry { -diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 29d8448e1e38c571f6c0019fcb45a9df82eabbe5..2a3dcabead39d74532613b8fc28924ec251e2d85 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/Villager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -1080,6 +1080,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - this.numberOfRestocksToday = 0; - } - -+ @Deprecated public GossipContainer getReputation() { return this.getGossips(); } // Paper - OBFHELPER - public GossipContainer getGossips() { - return this.gossips; - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9bee725f01 100644 +index fe3a73e9cdb85fdf8385f0a0d096a991541cbf60..aa6d3ff2abc9f0c65dd51b2a30d327fea827bb42 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -16,6 +16,13 @@ import org.bukkit.entity.Villager; @@ -99,7 +87,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b + // Paper start - Add villager reputation API + @Override + public Reputation getReputation(UUID uniqueId) { -+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getReputation().getReputations().get(uniqueId); ++ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getGossips().getReputations().get(uniqueId); + if (rep == null) { + return new Reputation(Maps.newHashMap()); + } @@ -109,7 +97,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b + + @Override + public Map getReputations() { -+ return getHandle().getReputation().getReputations().entrySet() ++ return getHandle().getGossips().getReputations().entrySet() + .stream() + .collect(java.util.stream.Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getPaperReputation())); + } @@ -117,7 +105,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b + @Override + public void setReputation(UUID uniqueId, Reputation reputation) { + net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips nmsReputation = -+ getHandle().getReputation().getReputations().computeIfAbsent( ++ getHandle().getGossips().getReputations().computeIfAbsent( + uniqueId, + key -> new net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips() + ); @@ -133,7 +121,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b + + @Override + public void clearReputations() { -+ getHandle().getReputation().getReputations().clear(); ++ getHandle().getGossips().getReputations().clear(); + } + // Paper end } diff --git a/patches/server/0441-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/patches/server/0441-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch index 3985934cc..a2bb26838 100644 --- a/patches/server/0441-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch +++ b/patches/server/0441-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch @@ -6,23 +6,14 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java -index 37f4becb39d6d4c13aa0c3901ed123083518cdbf..19d1070afc7f6af92beb1fe7e90b67358596eca3 100644 +index 37f4becb39d6d4c13aa0c3901ed123083518cdbf..54b5cfa35e5fe9138d39a73f2085f594f1987cda 100644 --- a/src/main/java/net/minecraft/world/entity/raid/Raider.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java -@@ -305,7 +305,7 @@ public abstract class Raider extends PatrollingMonster { - - public class ObtainRaidLeaderBannerGoal extends Goal { - -- private final T mob; -+ private final T mob; @Deprecated private T getRaider() { return mob; } // Paper - obfhelper - - public ObtainRaidLeaderBannerGoal(T entityraider) { // CraftBukkit - decompile error - this.mob = entityraider; @@ -314,6 +314,7 @@ public abstract class Raider extends PatrollingMonster { @Override public boolean canUse() { -+ if (!getRaider().level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !getRaider().canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items ++ if (!this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items Raid raid = this.mob.getCurrentRaid(); if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) { diff --git a/patches/server/0482-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0482-Update-itemstack-legacy-name-and-lore.patch index f317d9326..37bb60bdf 100644 --- a/patches/server/0482-Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/0482-Update-itemstack-legacy-name-and-lore.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 2fd3d56768f9121c1e5de3f193258bb360bb103b..d74f5a722e566143472dd2e23cb1eb1233f369ae 100644 +index 2fd3d56768f9121c1e5de3f193258bb360bb103b..5bc46a670b1dd9d89f39626a82959410b5987bb1 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -170,6 +170,44 @@ public final class ItemStack { @@ -14,7 +14,7 @@ index 2fd3d56768f9121c1e5de3f193258bb360bb103b..d74f5a722e566143472dd2e23cb1eb12 } + + private void processText() { -+ CompoundTag display = getSubTag("display"); ++ CompoundTag display = getTagElement("display"); + if (display != null) { + if (display.contains("Name", 8)) { + String json = display.getString("Name"); @@ -61,11 +61,3 @@ index 2fd3d56768f9121c1e5de3f193258bb360bb103b..d74f5a722e566143472dd2e23cb1eb12 this.getItem().verifyTagAfterLoad(this.tag); } -@@ -728,6 +767,7 @@ public final class ItemStack { - } - } - -+ @Deprecated @Nullable public CompoundTag getSubTag(String s) { return getTagElement(s); } // Paper - OBFHELPER - @Nullable - public CompoundTag getTagElement(String key) { - return this.tag != null && this.tag.contains(key, 10) ? this.tag.getCompound(key) : null; diff --git a/patches/server/0500-Fix-some-rails-connecting-improperly.patch b/patches/server/0500-Fix-some-rails-connecting-improperly.patch index 847aa1416..43207ba7b 100644 --- a/patches/server/0500-Fix-some-rails-connecting-improperly.patch +++ b/patches/server/0500-Fix-some-rails-connecting-improperly.patch @@ -29,26 +29,16 @@ index 2335e7af6bc16a0d65c7818c316f3194c680c69d..63c7f2cf530ac9562960ae5a3cbc6e51 boolean flag1 = false; List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/main/java/net/minecraft/world/level/block/RailState.java -index a205e04bce8706302e4a077646749d05dee98251..abb388df212b2feabcaa2f9b4576a0d9dbf4db4b 100644 +index a205e04bce8706302e4a077646749d05dee98251..2a642275522c1d718dd6052f5ac942579cc31e9e 100644 --- a/src/main/java/net/minecraft/world/level/block/RailState.java +++ b/src/main/java/net/minecraft/world/level/block/RailState.java -@@ -10,13 +10,19 @@ import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.block.state.properties.RailShape; - - public class RailState { -- private final Level level; -- private final BlockPos pos; -+ private final Level level; @Deprecated public final Level getWorld() { return this.level; } // Paper - OBFHELPER -+ private final BlockPos pos; @Deprecated public final BlockPos getPos() { return this.pos; } // Paper - OBFHELPER - private final BaseRailBlock block; -- private BlockState state; -+ private BlockState state; @Deprecated public final BlockState getRailState() { return this.state; } // Paper - OBFHELPER +@@ -17,6 +17,12 @@ public class RailState { private final boolean isStraight; private final List connections = Lists.newArrayList(); + // Paper start - prevent desync + public boolean isValid() { -+ return this.getWorld().getBlockState(this.getPos()).getBlock() == this.getRailState().getBlock(); ++ return this.level.getBlockState(this.pos).getBlock() == this.state.getBlock(); + } + // Paper end - prevent desync + @@ -89,6 +79,6 @@ index a205e04bce8706302e4a077646749d05dee98251..abb388df212b2feabcaa2f9b4576a0d9 public BlockState getState() { - return this.state; -+ return this.getWorld().getBlockState(this.getPos()); // Paper - prevent desync ++ return this.level.getBlockState(this.pos); // Paper - prevent desync } } diff --git a/patches/server/0510-Prevent-headless-pistons-from-being-created.patch b/patches/server/0510-Prevent-headless-pistons-from-being-created.patch index 7a5c642dd..6c0457d68 100644 --- a/patches/server/0510-Prevent-headless-pistons-from-being-created.patch +++ b/patches/server/0510-Prevent-headless-pistons-from-being-created.patch @@ -23,7 +23,7 @@ index fdbd8b89bb8bf3b61f60b812b90483c98a3d5ccb..faa1b775e45563b93ac1d5b904938b1f public static int maxPlayerAutoSavePerTick = 10; private static void playerAutoSaveRate() { diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index a12af10e28f2d023ba6f916b5e7a53539416713f..822a8dbfaea0a312c4eb2849f2386ecd401b13e9 100644 +index a12af10e28f2d023ba6f916b5e7a53539416713f..d4785160c1477ed13343e30c913b08175011d048 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -15,6 +15,7 @@ import java.util.Random; @@ -50,7 +50,7 @@ index a12af10e28f2d023ba6f916b5e7a53539416713f..822a8dbfaea0a312c4eb2849f2386ecd + // Paper start - prevent headless pistons from forming + if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { + BlockEntity extension = this.level.getBlockEntity(blockposition); -+ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isHead()) { ++ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isSourcePiston()) { + Direction direction = iblockdata.getValue(PistonHeadBlock.FACING); + set.add(blockposition.relative(direction.getOpposite())); + } @@ -59,16 +59,3 @@ index a12af10e28f2d023ba6f916b5e7a53539416713f..822a8dbfaea0a312c4eb2849f2386ecd } d4 += d0 * 0.30000001192092896D; -diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 87bedba9ab495edcce289c6665271d92b7165944..4a6ee6a01aeb6c09149c7a16230399abaec5fd91 100644 ---- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -66,6 +66,8 @@ public class PistonMovingBlockEntity extends BlockEntity { - return this.direction; - } - -+ @Deprecated public final boolean isHead() { return this.isSourcePiston(); } // Paper - OBFHELPER -+ - public boolean isSourcePiston() { - return this.isSourcePiston; - } diff --git a/patches/server/0519-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/patches/server/0519-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch index 7d72081e5..63bc77f43 100644 --- a/patches/server/0519-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch +++ b/patches/server/0519-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch @@ -5,18 +5,6 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and materials -diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index f38ccdecbade43983358dfbeadca86be7d15a68c..a8d9df5a31ba5d2ff01a7a7b3e99faa47e5eb1ef 100644 ---- a/src/main/java/net/minecraft/world/entity/EntityType.java -+++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -290,6 +290,7 @@ public class EntityType implements EntityTypeTest { - return Registry.ENTITY_TYPE.getKey(type); - } - -+ @Deprecated public static Optional> getByName(String name) { return byString(name); } // Paper - OBFHELPER - public static Optional> byString(String id) { - return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id)); - } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 64c304cab8c7c4c9c29f73465f99c11f224a72bd..b31eaa1459690d7f54989ba7a01f96a3f0d8d3b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -33,7 +21,7 @@ index 64c304cab8c7c4c9c29f73465f99c11f224a72bd..b31eaa1459690d7f54989ba7a01f96a3 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d18f8d7c699893740fa709ef1f0caa4390e7eb20..91e61e7f5c1b47534408c48a280587ea03ae5a17 100644 +index d18f8d7c699893740fa709ef1f0caa4390e7eb20..736cbdc118b7a19b724a3afd433927e8e8316d23 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -43,6 +43,7 @@ import org.bukkit.Registry; @@ -64,7 +52,7 @@ index d18f8d7c699893740fa709ef1f0caa4390e7eb20..91e61e7f5c1b47534408c48a280587ea + + @Override + public String getTranslationKey(org.bukkit.entity.EntityType type) { -+ return net.minecraft.world.entity.EntityType.getByName(type.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(null); ++ return net.minecraft.world.entity.EntityType.byString(type.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(null); + } + + @Override diff --git a/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch index 9f5cfb359..27c7932fd 100644 --- a/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch +++ b/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch @@ -24,7 +24,7 @@ index 208690ceca2485b54acde5123ba494d71367791b..561976466cae6e4df63433c4631c516c private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index fe9ee43bf0c49c0541bc4fb114e63b8a0fcf1967..18b35c8d2160d24c31483edef13cc5e8d93ed09b 100644 +index 67ff39fa0a94aec858ee7f9643565b4a16e4444a..1741b04b470443fcc534a49b16bc0b247160f8ea 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -1056,6 +1056,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -33,7 +33,7 @@ index fe9ee43bf0c49c0541bc4fb114e63b8a0fcf1967..18b35c8d2160d24c31483edef13cc5e8 if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) { + // Paper start - fix MC-181190 + if (level.paperConfig.fixCuringZombieVillagerDiscountExploit) { -+ final GossipContainer.EntityGossips playerReputation = this.getReputation().getReputations().get(entity.getUUID()); ++ final GossipContainer.EntityGossips playerReputation = this.getGossips().getReputations().get(entity.getUUID()); + if (playerReputation != null) { + playerReputation.remove(GossipType.MAJOR_POSITIVE); + playerReputation.remove(GossipType.MINOR_POSITIVE); diff --git a/patches/server/0643-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/0643-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch index f21119507..1a1ae8594 100644 --- a/patches/server/0643-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch +++ b/patches/server/0643-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only set despawnTimer for Wandering Traders spawned by diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index bd51753e3afaa5e025583964b16851dfa5dc8796..b48548d284e55c9010b99823325fcc14aa5ab051 100644 +index f38ccdecbade43983358dfbeadca86be7d15a68c..b50bf044a3cb05b811fd06796a351e6b15b352ad 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -333,6 +333,12 @@ public class EntityType implements EntityTypeTest { +@@ -332,6 +332,12 @@ public class EntityType implements EntityTypeTest { @Nullable public T spawnCreature(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { @@ -22,7 +22,7 @@ index bd51753e3afaa5e025583964b16851dfa5dc8796..b48548d284e55c9010b99823325fcc14 // Paper start - Call PreCreatureSpawnEvent org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath()); if (type != null) { -@@ -348,6 +354,7 @@ public class EntityType implements EntityTypeTest { +@@ -347,6 +353,7 @@ public class EntityType implements EntityTypeTest { } // Paper end T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); diff --git a/patches/server/0648-Entity-load-save-limit-per-chunk.patch b/patches/server/0648-Entity-load-save-limit-per-chunk.patch index 60e0d471c..a9ce8f9a4 100644 --- a/patches/server/0648-Entity-load-save-limit-per-chunk.patch +++ b/patches/server/0648-Entity-load-save-limit-per-chunk.patch @@ -9,7 +9,7 @@ defaults are only included for certain entites, this allows setting limits for any entity type. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index acd61a9033fdfb91e29a5fa6a10b8983ed94baa5..20ce2c304ba57e2399e966da7dee9a02e57d9fa5 100644 +index acd61a9033fdfb91e29a5fa6a10b8983ed94baa5..c94579d5db6802ef27c6c64cde1cdfdff5040ed2 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,9 +1,12 @@ @@ -36,7 +36,7 @@ index acd61a9033fdfb91e29a5fa6a10b8983ed94baa5..20ce2c304ba57e2399e966da7dee9a02 + getInt("entity-per-chunk-save-limit.ender_pearl", -1); + getInt("entity-per-chunk-save-limit.arrow", -1); + EntityType.getEntityNameList().forEach(name -> { -+ final EntityType type = EntityType.getByName(name.getPath()).orElseThrow(() -> new IllegalStateException("Unknown Entity Type: " + name.toString())); ++ final EntityType type = EntityType.byString(name.getPath()).orElseThrow(() -> new IllegalStateException("Unknown Entity Type: " + name.toString())); + final String path = ".entity-per-chunk-save-limit." + name.getPath(); + final int value = config.getInt("world-settings." + worldName + path, config.getInt("world-settings.default" + path, -1)); // get without setting defaults + if (value != -1) entityPerChunkSaveLimits.put(type, value); @@ -47,10 +47,10 @@ index acd61a9033fdfb91e29a5fa6a10b8983ed94baa5..20ce2c304ba57e2399e966da7dee9a02 private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index b48548d284e55c9010b99823325fcc14aa5ab051..56d9102b1a0e9d45cb1696fe5ec771972512a130 100644 +index b50bf044a3cb05b811fd06796a351e6b15b352ad..ac99265aacd4a28490705e3079ed04023fb1c54a 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -561,9 +561,20 @@ public class EntityType implements EntityTypeTest { +@@ -560,9 +560,20 @@ public class EntityType implements EntityTypeTest { final Spliterator spliterator = entityNbtList.spliterator(); return StreamSupport.stream(new Spliterator() { diff --git a/patches/server/0677-call-PortalCreateEvent-players-and-end-platform.patch b/patches/server/0677-call-PortalCreateEvent-players-and-end-platform.patch index 8ce7ff7b2..a150865be 100644 --- a/patches/server/0677-call-PortalCreateEvent-players-and-end-platform.patch +++ b/patches/server/0677-call-PortalCreateEvent-players-and-end-platform.patch @@ -4,18 +4,6 @@ Date: Wed, 12 May 2021 03:21:22 -0700 Subject: [PATCH] call PortalCreateEvent players and end platform -diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 1c980abc4fb5cab2a6dc9d1a8a3e8fdd0a7e3a4b..5c194f32f273350afcc33ec8b4d4a3e5ee599836 100644 ---- a/src/main/java/net/minecraft/core/BlockPos.java -+++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -522,6 +522,7 @@ public class BlockPos extends Vec3i { - return this.set(this.getX() + direction.getStepX() * distance, this.getY() + direction.getStepY() * distance, this.getZ() + direction.getStepZ() * distance); - } - -+ @Deprecated public BlockPos.MutableBlockPos withOffset(int x, int y, int z) { return move(x, y, z); } // Paper - OBFHELPER - public BlockPos.MutableBlockPos move(int dx, int dy, int dz) { - return this.set(this.getX() + dx, this.getY() + dy, this.getZ() + dz); - } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index 1d885c1c0709d49c3fddc174300b3fdd478e761b..90b5bfe7bd0deae842bf6ef228f5a0e09326518e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java