From 023b612f6238a524f5e06964b134d9282d8dc9a7 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 15 Nov 2021 11:01:19 -0800 Subject: [PATCH] cleanup: Add hand to bucket events patch (#6881) --- build-data/reobf-mappings-patch.tiny | 4 -- .../server/Add-hand-to-bucket-events.patch | 68 +------------------ ...x-items-vanishing-through-end-portal.patch | 2 +- 3 files changed, 4 insertions(+), 70 deletions(-) diff --git a/build-data/reobf-mappings-patch.tiny b/build-data/reobf-mappings-patch.tiny index ff20e13a65..41b3374398 100644 --- a/build-data/reobf-mappings-patch.tiny +++ b/build-data/reobf-mappings-patch.tiny @@ -19,10 +19,6 @@ c net/minecraft/server/level/ServerLevel net/minecraft/server/level/WorldServer c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chunk f Lnet/minecraft/server/level/ServerLevel; level i -# Paper moves method up from ServerLevel to Level -c net/minecraft/world/level/Level net/minecraft/world/level/World - m ()Lnet/minecraft/core/BlockPos; getSharedSpawnPos getSpawn - # Paper changes type c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw diff --git a/patches/server/Add-hand-to-bucket-events.patch b/patches/server/Add-hand-to-bucket-events.patch index 1c0ffa0fca..3f97c69d1d 100644 --- a/patches/server/Add-hand-to-bucket-events.patch +++ b/patches/server/Add-hand-to-bucket-events.patch @@ -4,37 +4,6 @@ Date: Thu, 2 Aug 2018 08:44:35 -0500 Subject: [PATCH] Add hand to bucket events -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle)); - } - -- public BlockPos getSharedSpawnPos() { -- BlockPos blockposition = new BlockPos(this.levelData.getXSpawn(), this.levelData.getYSpawn(), this.levelData.getZSpawn()); -- -- if (!this.getWorldBorder().isWithinBounds(blockposition)) { -- blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, new BlockPos(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -- } -- -- return blockposition; -- } -+ // Paper - moved up to Level -+ //public BlockPosition getSpawn() { -+ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); -+ // -+ // if (!this.getWorldBorder().a(blockposition)) { -+ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -+ // } -+ // -+ // return blockposition; -+ //} -+ // Paper end - - public float getSharedSpawnAngle() { - return this.levelData.getSpawnAngle(); diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Cow.java @@ -116,41 +85,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (world.dimensionType().ultraWarm() && this.content.is((Tag) FluidTags.WATER)) { int i = blockposition.getX(); int j = blockposition.getY(); -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return true; - } - // Paper end -+ // Paper start - moved up from ServerLevel -+ public BlockPos getSharedSpawnPos() { -+ BlockPos blockposition = new BlockPos(this.levelData.getXSpawn(), this.levelData.getYSpawn(), this.levelData.getZSpawn()); -+ -+ if (!this.getWorldBorder().isWithinBounds(blockposition)) { -+ blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, new BlockPos(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -+ } -+ -+ return blockposition; -+ } -+ // Paper end - @Override - public boolean isClientSide() { - return this.isClientSide; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ public class CraftEventFactory { - public static Entity entityDamage; // For use in EntityDamageByEntityEvent - - // helper methods -- private static boolean canBuild(ServerLevel world, Player player, int x, int z) { -+ private static boolean canBuild(Level world, Player player, int x, int z) { - int spawnSize = Bukkit.getServer().getSpawnRadius(); - - if (world.dimension() != Level.OVERWORLD) return true; @@ -0,0 +0,0 @@ public class CraftEventFactory { } @@ -159,15 +97,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); + } + -+ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, InteractionHand enumHand) { ++ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(ServerLevel world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, InteractionHand enumHand) { + return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); + } + -+ public static PlayerBucketFillEvent callPlayerBucketFillEvent(Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemInHand, net.minecraft.world.item.Item bucket, InteractionHand enumHand) { ++ public static PlayerBucketFillEvent callPlayerBucketFillEvent(ServerLevel world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemInHand, net.minecraft.world.item.Item bucket, InteractionHand enumHand) { + return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); + } + -+ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item, InteractionHand enumHand) { ++ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, ServerLevel world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item, InteractionHand enumHand) { + // Paper end Player player = (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); diff --git a/patches/server/Fix-items-vanishing-through-end-portal.patch b/patches/server/Fix-items-vanishing-through-end-portal.patch index 04b7e40849..b9846d0dd7 100644 --- a/patches/server/Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/Fix-items-vanishing-through-end-portal.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (flag1) { + // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate -+ this.level.getChunkAt(this.level.getSharedSpawnPos()); ++ this.level.getChunkAt(((ServerLevel) this.level).getSharedSpawnPos()); + // Paper end blockposition1 = ServerLevel.END_SPAWN_POINT; } else {