From 783b3b70e66919667d1c996cf23588473327ed0f Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:29:46 +0100 Subject: readd dropped event in InteractWithDoor --- ...013-Check-distance-in-entity-interactions.patch | 4 +- .../minecraft/server/level/ServerPlayer.java.patch | 2 +- .../minecraft/world/CompoundContainer.java.patch | 16 +++--- .../net/minecraft/world/Container.java.patch | 6 +- .../net/minecraft/world/SimpleContainer.java.patch | 8 +-- .../world/entity/ai/behavior/Behavior.java.patch | 18 +++--- .../entity/ai/behavior/GoToWantedItem.java.patch | 4 +- .../entity/ai/behavior/InteractWithDoor.java.patch | 15 ++++- .../entity/animal/horse/AbstractHorse.java.patch | 8 +-- .../world/entity/player/Inventory.java.patch | 10 ++-- .../world/entity/vehicle/AbstractBoat.java.patch | 22 ++----- .../entity/vehicle/AbstractChestBoat.java.patch | 11 ++-- .../entity/vehicle/AbstractMinecart.java.patch | 5 +- .../vehicle/AbstractMinecartContainer.java.patch | 67 +++++++++++----------- .../world/entity/vehicle/MinecartTNT.java.patch | 2 +- .../world/inventory/MerchantContainer.java.patch | 8 +-- .../world/inventory/ResultContainer.java.patch | 4 +- .../TransientCraftingContainer.java.patch | 8 +-- .../world/level/block/DoorBlock.java.patch | 17 +++--- .../entity/AbstractFurnaceBlockEntity.java.patch | 8 +-- .../block/entity/BarrelBlockEntity.java.patch | 8 +-- .../entity/BrewingStandBlockEntity.java.patch | 8 +-- .../level/block/entity/ChestBlockEntity.java.patch | 8 +-- .../entity/ChiseledBookShelfBlockEntity.java.patch | 8 +-- .../block/entity/CrafterBlockEntity.java.patch | 8 +-- .../entity/DecoratedPotBlockEntity.java.patch | 8 +-- .../block/entity/DispenserBlockEntity.java.patch | 8 +-- .../block/entity/HopperBlockEntity.java.patch | 8 +-- .../block/entity/JukeboxBlockEntity.java.patch | 8 +-- .../block/entity/LecternBlockEntity.java.patch | 8 +-- .../block/entity/ShulkerBoxBlockEntity.java.patch | 8 +-- .../PaperInventoryCustomHolderContainer.java | 8 +-- .../inventory/CraftInventoryCustom.java | 8 +-- 33 files changed, 175 insertions(+), 172 deletions(-) diff --git a/paper-server/patches/features/0013-Check-distance-in-entity-interactions.patch b/paper-server/patches/features/0013-Check-distance-in-entity-interactions.patch index ed5541da75..6e558c931a 100644 --- a/paper-server/patches/features/0013-Check-distance-in-entity-interactions.patch +++ b/paper-server/patches/features/0013-Check-distance-in-entity-interactions.patch @@ -54,10 +54,10 @@ index 9de400977ec33e485e87cdf1cf145588527e1e10..c83aeaf4e50dd7290c608dfe260a3bd2 } } diff --git a/net/minecraft/world/entity/vehicle/AbstractBoat.java b/net/minecraft/world/entity/vehicle/AbstractBoat.java -index 5cd65e94ac7830aaa2a64057fc2a81478b55ea41..b9cb86717d7e6c05eb97f3b1bbf1d0111a0ba6ed 100644 +index 3bdb3b0984d0fee21b2c094e1d4c1f917ab68f92..54a4bf2f7df87b4a694187ade81ba158f83f0246 100644 --- a/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/net/minecraft/world/entity/vehicle/AbstractBoat.java -@@ -641,7 +641,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -638,7 +638,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { this.waterLevel = this.getY(1.0); double d2 = this.getWaterLevelAbove() - this.getBbHeight() + 0.101; if (this.level().noCollision(this, this.getBoundingBox().move(0.0, d2 - this.getY(), 0.0))) { diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index debc79d7cc..64c374439b 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -881,7 +881,7 @@ + { + { + Either either = super.startSleepInBed(at, force).ifRight((unit) -> { -+ // CraftBukkit end ++ // CraftBukkit end this.awardStat(Stats.SLEEP_IN_BED); CriteriaTriggers.SLEPT_IN_BED.trigger(this); }); diff --git a/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch index 54adbbf786..adc2c80c8e 100644 --- a/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/CompoundContainer.java.patch @@ -15,16 +15,16 @@ + return result; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.container1.onOpen(who); -+ this.container2.onOpen(who); -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.container1.onOpen(player); ++ this.container2.onOpen(player); ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.container1.onClose(who); -+ this.container2.onClose(who); -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.container1.onClose(player); ++ this.container2.onClose(player); ++ this.transaction.remove(player); + } + + public java.util.List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/Container.java.patch b/paper-server/patches/sources/net/minecraft/world/Container.java.patch index ac7f19ed19..1250bede66 100644 --- a/paper-server/patches/sources/net/minecraft/world/Container.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/Container.java.patch @@ -19,9 +19,9 @@ + // Paper start + java.util.List getContents(); + -+ void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who); ++ void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player); + -+ void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who); ++ void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player); + + java.util.List getViewers(); + @@ -31,6 +31,6 @@ + + org.bukkit.Location getLocation(); + -+ int MAX_STACK = 99; ++ int MAX_STACK = Item.ABSOLUTE_MAX_STACK_SIZE; + // Paper end } diff --git a/paper-server/patches/sources/net/minecraft/world/SimpleContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/SimpleContainer.java.patch index 314fec3e3b..7fe6062581 100644 --- a/paper-server/patches/sources/net/minecraft/world/SimpleContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/SimpleContainer.java.patch @@ -13,12 +13,12 @@ + return this.items; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/Behavior.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/Behavior.java.patch index d205203f19..5088503a08 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/Behavior.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/Behavior.java.patch @@ -1,12 +1,10 @@ --- a/net/minecraft/world/entity/ai/behavior/Behavior.java +++ b/net/minecraft/world/entity/ai/behavior/Behavior.java -@@ -14,6 +_,9 @@ +@@ -14,6 +_,7 @@ private long endTimestamp; private final int minDuration; private final int maxDuration; -+ // Paper start - configurable behavior tick rate and timings -+ private final String configKey; -+ // Paper end - configurable behavior tick rate and timings ++ private final String configKey; // Paper - configurable behavior tick rate and timings public Behavior(Map, MemoryStatus> entryCondition) { this(entryCondition, 60); @@ -29,12 +27,12 @@ @Override public final boolean tryStart(ServerLevel level, E owner, long gameTime) { -+ // Paper start - configurable behavior tick rate and timings -+ int tickRate = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.behavior.get(owner.getType(), this.configKey), -1); -+ if (tickRate > -1 && gameTime < this.endTimestamp + tickRate) { -+ return false; -+ } -+ // Paper end - configurable behavior tick rate and timings ++ // Paper start - configurable behavior tick rate and timings ++ int tickRate = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.behavior.get(owner.getType(), this.configKey), -1); ++ if (tickRate > -1 && gameTime < this.endTimestamp + tickRate) { ++ return false; ++ } ++ // Paper end - configurable behavior tick rate and timings if (this.hasRequiredMemories(owner) && this.checkExtraStartConditions(level, owner)) { this.status = Behavior.Status.RUNNING; int i = this.minDuration + level.getRandom().nextInt(this.maxDuration + 1 - this.minDuration); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java.patch index ca1948e8a9..b4c97cad9b 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/GoToWantedItem.java.patch @@ -11,12 +11,12 @@ + if (event.isCancelled()) { + return false; + } -+ if (!(event.getTarget() instanceof org.bukkit.craftbukkit.entity.CraftItem)) { // Paper - only erase allay memory on non-item targets ++ if (!(event.getTarget() instanceof org.bukkit.craftbukkit.entity.CraftItem targetItem)) { // Paper - only erase allay memory on non-item targets + nearestVisibleWantedItem.erase(); + return false; // Paper - only erase allay memory on non-item targets + } + -+ itemEntity = (ItemEntity) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); ++ itemEntity = targetItem.getHandle(); + } + // CraftBukkit end WalkTarget walkTarget1 = new WalkTarget(new EntityTracker(itemEntity, false), speedModifier, 0); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch index 8f8cc15760..05862afb29 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch @@ -9,7 +9,20 @@ + if (!event.callEvent()) { + return false; + } -+ // CraftBukkit end ++ // CraftBukkit end - entities opening doors doorBlock.setOpen(entity, level, blockState, blockPos, true); } +@@ -69,6 +_,12 @@ + if (blockState1.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)) { + DoorBlock doorBlock1 = (DoorBlock)blockState1.getBlock(); + if (!doorBlock1.isOpen(blockState1)) { ++ // CraftBukkit start - entities opening doors ++ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entity.level(), blockPos1)); ++ if (!event.callEvent()) { ++ return false; ++ } ++ // CraftBukkit end - entities opening doors + doorBlock1.setOpen(entity, level, blockState1, blockPos1, true); + optional = rememberDoorToClose(doorsToClose, optional, level, blockPos1); + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index 1b2858a398..19135714d8 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch @@ -33,13 +33,13 @@ + } + + @Override -+ public void onOpen(CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch index ca6987132b..5a84bf452f 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch @@ -5,7 +5,7 @@ private int timesChanged; + // CraftBukkit start - add fields and methods -+ public List transaction = new java.util.ArrayList(); ++ public List transaction = new java.util.ArrayList<>(); + private int maxStack = MAX_STACK; + + public List getContents() { @@ -21,12 +21,12 @@ + return this.armor; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch index 20b17c550f..a0e7f6a45f 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/net/minecraft/world/entity/vehicle/AbstractBoat.java -@@ -83,6 +_,14 @@ +@@ -83,6 +_,15 @@ private Leashable.LeashData leashData; private final Supplier dropItem; @@ -10,6 +10,7 @@ + public double occupiedDeceleration = 0.2D; + public double unoccupiedDeceleration = -1; + public boolean landBoats = false; ++ private org.bukkit.Location lastLocation; + // CraftBukkit end + public AbstractBoat(EntityType entityType, Level level, Supplier dropItem) { @@ -55,30 +56,19 @@ super.push(entity); } } -@@ -243,6 +_,7 @@ - return this.getDirection().getClockWise(); - } - -+ private org.bukkit.Location lastLocation; // CraftBukkit - @Override - public void tick() { - this.oldStatus = this.status; -@@ -283,6 +_,21 @@ +@@ -283,6 +_,18 @@ this.setDeltaMovement(Vec3.ZERO); } + // CraftBukkit start -+ org.bukkit.Server server = this.level().getCraftServer(); -+ org.bukkit.World bworld = this.level().getWorld(); -+ -+ org.bukkit.Location to = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.position(), bworld, this.getYRot(), this.getXRot()); ++ org.bukkit.Location to = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.position(), this.level().getWorld(), this.getYRot(), this.getXRot()); + org.bukkit.entity.Vehicle vehicle = (org.bukkit.entity.Vehicle) this.getBukkitEntity(); + -+ server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle)); ++ new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle).callEvent(); + + if (this.lastLocation != null && !this.lastLocation.equals(to)) { + org.bukkit.event.vehicle.VehicleMoveEvent event = new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, this.lastLocation, to); -+ server.getPluginManager().callEvent(event); ++ event.callEvent(); + } + this.lastLocation = vehicle.getLocation(); + // CraftBukkit end diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractChestBoat.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractChestBoat.java.patch index 3dc8fe5278..9fd4787f99 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractChestBoat.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractChestBoat.java.patch @@ -40,12 +40,11 @@ return null; } else { this.unpackLootTable(playerInventory.player); -@@ -198,4 +_,59 @@ +@@ -198,4 +_,58 @@ public void stopOpen(Player player) { this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(player)); } + -+ + // Paper start - LootTable API + final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); + @@ -64,13 +63,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch index ea248c3955..35881f5e7a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch @@ -28,8 +28,8 @@ + if (!collides) { + return false; + } -+ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) getBukkitEntity(), entity.getBukkitEntity()); + ++ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) getBukkitEntity(), entity.getBukkitEntity()); + return collisionEvent.callEvent(); + // Paper end - fix VehicleEntityCollisionEvent not called when colliding with player } @@ -141,7 +141,7 @@ double d = entity.getX() - this.getX(); double d1 = entity.getZ() - this.getZ(); double d2 = d * d + d1 * d1; -@@ -602,4 +_,27 @@ +@@ -602,4 +_,28 @@ public boolean isFurnace() { return false; } @@ -167,5 +167,6 @@ + this.derailedZ = derailed.getZ(); + } + // CraftBukkit end ++ + public net.minecraft.world.item.Item publicGetDropItem() { return getDropItem(); } // Paper - api to get boat and minecart material - expose public drop item } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch index 5a1e4c8f55..5289f0b57c 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -@@ -21,11 +_,59 @@ +@@ -21,10 +_,11 @@ import net.minecraft.world.phys.Vec3; public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity { @@ -9,15 +9,42 @@ @Nullable public ResourceKey lootTable; public long lootTableSeed; ++ private final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); // Paper - LootTable API -+ // Paper start - LootTable API -+ final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); + protected AbstractMinecartContainer(EntityType entityType, Level level) { + super(entityType, level); +@@ -72,11 +_,18 @@ + + @Override + public void remove(Entity.RemovalReason reason) { ++ // CraftBukkit start - add Bukkit remove cause ++ this.remove(reason, null); ++ } + + @Override ++ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { ++ // CraftBukkit end - add Bukkit remove cause + if (!this.level().isClientSide && reason.shouldDestroy()) { + Containers.dropContents(this.level(), this, this); + } + +- super.remove(reason); ++ super.remove(reason, cause); // CraftBukkit - add Bukkit remove cause + } + + @Override +@@ -164,4 +_,50 @@ + public void clearItemStacks() { + this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + } ++ ++ // Paper start - LootTable API ++ @Override + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData() { + return this.lootableData; + } + // Paper end - LootTable API ++ + // CraftBukkit start + public java.util.List transaction = new java.util.ArrayList<>(); + private int maxStack = MAX_STACK; @@ -26,12 +53,12 @@ + return this.itemStacks; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public java.util.List getViewers() { @@ -56,28 +83,4 @@ + return this.getBukkitEntity().getLocation(); + } + // CraftBukkit end -+ -+ - protected AbstractMinecartContainer(EntityType entityType, Level level) { - super(entityType, level); - } -@@ -72,11 +_,18 @@ - - @Override - public void remove(Entity.RemovalReason reason) { -+ // CraftBukkit start - add Bukkit remove cause -+ this.remove(reason, null); -+ } -+ -+ @Override -+ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { -+ // CraftBukkit end - add Bukkit remove cause - if (!this.level().isClientSide && reason.shouldDestroy()) { - Containers.dropContents(this.level(), this, this); - } - -- super.remove(reason); -+ super.remove(reason, cause); // CraftBukkit - add Bukkit remove cause - } - - @Override + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/MinecartTNT.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/MinecartTNT.java.patch index 8cfbf8de7d..0f23c30d40 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/MinecartTNT.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/MinecartTNT.java.patch @@ -28,7 +28,7 @@ + // CraftBukkit start + org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent( + this.getBukkitEntity(), -+ (float) ((double) this.explosionPowerBase + (double) this.explosionSpeedFactor * this.random.nextDouble() * 1.5D * min), ++ (float) (this.explosionPowerBase + this.explosionSpeedFactor * this.random.nextDouble() * 1.5 * min), + this.isIncendiary + ); + if (!event.callEvent()) { diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch index a460afb9b4..c41d046425 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch @@ -12,12 +12,12 @@ + return this.itemStacks; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + this.merchant.setTradingPlayer((Player) null); // SPIGOT-4860 + } + diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/ResultContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/ResultContainer.java.patch index da8f31ffe7..a384ac95a8 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/ResultContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/ResultContainer.java.patch @@ -21,8 +21,8 @@ + } + + // Don't need a transaction; the InventoryCrafting keeps track of it for us -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {} -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {} ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {} ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {} + public java.util.List getViewers() { + return new java.util.ArrayList<>(); + } diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/TransientCraftingContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/TransientCraftingContainer.java.patch index bc3a488239..898f5850c4 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/TransientCraftingContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/TransientCraftingContainer.java.patch @@ -15,16 +15,16 @@ + return this.items; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + public org.bukkit.event.inventory.InventoryType getInvType() { + return this.items.size() == 4 ? org.bukkit.event.inventory.InventoryType.CRAFTING : org.bukkit.event.inventory.InventoryType.WORKBENCH; + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/DoorBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/DoorBlock.java.patch index 87099f1713..03420b6376 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/DoorBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/DoorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/DoorBlock.java +++ b/net/minecraft/world/level/block/DoorBlock.java -@@ -229,9 +_,23 @@ +@@ -229,9 +_,22 @@ @Override protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) { @@ -9,21 +9,20 @@ - if (!this.defaultBlockState().is(neighborBlock) && flag != state.getValue(POWERED)) { + // CraftBukkit start + BlockPos otherHalf = pos.relative(state.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? Direction.UP : Direction.DOWN); -+ org.bukkit.World bworld = level.getWorld(); -+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()); -+ org.bukkit.block.Block blockTop = bworld.getBlockAt(otherHalf.getX(), otherHalf.getY(), otherHalf.getZ()); ++ org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); ++ org.bukkit.block.Block blockTop = org.bukkit.craftbukkit.block.CraftBlock.at(level, otherHalf); + + int power = bukkitBlock.getBlockPower(); + int powerTop = blockTop.getBlockPower(); + if (powerTop > power) power = powerTop; -+ int oldPower = (Boolean) state.getValue(DoorBlock.POWERED) ? 15 : 0; ++ int oldPower = state.getValue(DoorBlock.POWERED) ? net.minecraft.world.level.redstone.Redstone.SIGNAL_MAX : net.minecraft.world.level.redstone.Redstone.SIGNAL_MIN; + + if (oldPower == 0 ^ power == 0) { -+ org.bukkit.event.block.BlockRedstoneEvent eventRedstone = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, power); -+ level.getCraftServer().getPluginManager().callEvent(eventRedstone); ++ org.bukkit.event.block.BlockRedstoneEvent event = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, power); ++ event.callEvent(); + -+ boolean flag = eventRedstone.getNewCurrent() > 0; -+ // CraftBukkit end ++ boolean flag = event.getNewCurrent() > 0; ++ // CraftBukkit end if (flag != state.getValue(OPEN)) { this.playSound(null, level, pos, flag); level.gameEvent(null, flag ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 5b5640d1f8..092b7d392d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -22,12 +22,12 @@ + return this.items; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BarrelBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BarrelBlockEntity.java.patch index 24372abac2..a7e3cbcde9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BarrelBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BarrelBlockEntity.java.patch @@ -14,13 +14,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index e470fbe622..93f629fdbf 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -39,12 +39,12 @@ + public java.util.List transaction = new java.util.ArrayList<>(); + private int maxStack = MAX_STACK; + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public java.util.List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch index d3845d7cfa..32a967c2c3 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch @@ -12,12 +12,12 @@ + return this.items; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public java.util.List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch index 6248b82627..2c8981a4cb 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch @@ -14,13 +14,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/CrafterBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/CrafterBlockEntity.java.patch index 537c7fdff2..edc04acff8 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/CrafterBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/CrafterBlockEntity.java.patch @@ -14,13 +14,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java.patch index 0b6a7181a9..08a08744a5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java.patch @@ -15,13 +15,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch index 1951b2f1e9..1448e2338d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch @@ -12,12 +12,12 @@ + return this.items; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public java.util.List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch index ebb7abcb76..4c305f64e5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch @@ -12,12 +12,12 @@ + return this.items; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public java.util.List getViewers() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch index 53cf63280b..7ef85bb6b9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch @@ -16,13 +16,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/LecternBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/LecternBlockEntity.java.patch index 3ce197ece6..d3be2ca424 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/LecternBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/LecternBlockEntity.java.patch @@ -17,13 +17,13 @@ + } + + @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + + @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch index 297c0cd136..dba115b265 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch @@ -13,12 +13,12 @@ + return this.itemStacks; + } + -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); ++ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.add(player); + } + -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); ++ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) { ++ this.transaction.remove(player); + } + + public List getViewers() { diff --git a/paper-server/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java b/paper-server/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java index 224d4b2cc4..f3ef363497 100644 --- a/paper-server/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java +++ b/paper-server/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java @@ -105,13 +105,13 @@ public final class PaperInventoryCustomHolderContainer implements Container { } @Override - public void onOpen(CraftHumanEntity who) { - this.delegate.onOpen(who); + public void onOpen(CraftHumanEntity player) { + this.delegate.onOpen(player); } @Override - public void onClose(CraftHumanEntity who) { - this.delegate.onClose(who); + public void onClose(CraftHumanEntity player) { + this.delegate.onClose(player); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java index da1c1fe0fa..393e44cd3e 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -194,13 +194,13 @@ public class CraftInventoryCustom extends CraftInventory { } @Override - public void onOpen(CraftHumanEntity who) { - this.viewers.add(who); + public void onOpen(CraftHumanEntity player) { + this.viewers.add(player); } @Override - public void onClose(CraftHumanEntity who) { - this.viewers.remove(who); + public void onClose(CraftHumanEntity player) { + this.viewers.remove(player); } @Override -- cgit v1.2.3