readd dropped event in InteractWithDoor

This commit is contained in:
Lulu13022002 2024-12-16 17:29:46 +01:00
parent 9c973e84bc
commit 783b3b70e6
No known key found for this signature in database
GPG key ID: 491C8F0B8ACDEB01
33 changed files with 175 additions and 172 deletions

View file

@ -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 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 --- a/net/minecraft/world/entity/vehicle/AbstractBoat.java
+++ b/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); this.waterLevel = this.getY(1.0);
double d2 = this.getWaterLevelAbove() - this.getBbHeight() + 0.101; double d2 = this.getWaterLevelAbove() - this.getBbHeight() + 0.101;
if (this.level().noCollision(this, this.getBoundingBox().move(0.0, d2 - this.getY(), 0.0))) { if (this.level().noCollision(this, this.getBoundingBox().move(0.0, d2 - this.getY(), 0.0))) {

View file

@ -15,16 +15,16 @@
+ return result; + return result;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.container1.onOpen(who); + this.container1.onOpen(player);
+ this.container2.onOpen(who); + this.container2.onOpen(player);
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.container1.onClose(who); + this.container1.onClose(player);
+ this.container2.onClose(who); + this.container2.onClose(player);
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -19,9 +19,9 @@
+ // Paper start + // Paper start
+ java.util.List<ItemStack> getContents(); + java.util.List<ItemStack> 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<org.bukkit.entity.HumanEntity> getViewers(); + java.util.List<org.bukkit.entity.HumanEntity> getViewers();
+ +
@ -31,6 +31,6 @@
+ +
+ org.bukkit.Location getLocation(); + org.bukkit.Location getLocation();
+ +
+ int MAX_STACK = 99; + int MAX_STACK = Item.ABSOLUTE_MAX_STACK_SIZE;
+ // Paper end + // Paper end
} }

View file

@ -13,12 +13,12 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public List<org.bukkit.entity.HumanEntity> getViewers() { + public List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -1,12 +1,10 @@
--- a/net/minecraft/world/entity/ai/behavior/Behavior.java --- a/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/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 long endTimestamp;
private final int minDuration; private final int minDuration;
private final int maxDuration; private final int maxDuration;
+ // Paper start - configurable behavior tick rate and timings + private final String configKey; // Paper - configurable behavior tick rate and timings
+ private final String configKey;
+ // Paper end - configurable behavior tick rate and timings
public Behavior(Map<MemoryModuleType<?>, MemoryStatus> entryCondition) { public Behavior(Map<MemoryModuleType<?>, MemoryStatus> entryCondition) {
this(entryCondition, 60); this(entryCondition, 60);

View file

@ -11,12 +11,12 @@
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return false; + 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(); + nearestVisibleWantedItem.erase();
+ return false; // Paper - only erase allay memory on non-item targets + 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 + // CraftBukkit end
WalkTarget walkTarget1 = new WalkTarget(new EntityTracker(itemEntity, false), speedModifier, 0); WalkTarget walkTarget1 = new WalkTarget(new EntityTracker(itemEntity, false), speedModifier, 0);

View file

@ -9,7 +9,20 @@
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return false; + return false;
+ } + }
+ // CraftBukkit end + // CraftBukkit end - entities opening doors
doorBlock.setOpen(entity, level, blockState, blockPos, true); 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);
}

View file

@ -33,13 +33,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(CraftHumanEntity who) { + public void onOpen(CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(CraftHumanEntity who) { + public void onClose(CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -5,7 +5,7 @@
private int timesChanged; private int timesChanged;
+ // CraftBukkit start - add fields and methods + // CraftBukkit start - add fields and methods
+ public List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<org.bukkit.entity.HumanEntity>(); + public List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK; + private int maxStack = MAX_STACK;
+ +
+ public List<ItemStack> getContents() { + public List<ItemStack> getContents() {
@ -21,12 +21,12 @@
+ return this.armor; + return this.armor;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public List<org.bukkit.entity.HumanEntity> getViewers() { + public List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/AbstractBoat.java --- a/net/minecraft/world/entity/vehicle/AbstractBoat.java
+++ b/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 Leashable.LeashData leashData;
private final Supplier<Item> dropItem; private final Supplier<Item> dropItem;
@ -10,6 +10,7 @@
+ public double occupiedDeceleration = 0.2D; + public double occupiedDeceleration = 0.2D;
+ public double unoccupiedDeceleration = -1; + public double unoccupiedDeceleration = -1;
+ public boolean landBoats = false; + public boolean landBoats = false;
+ private org.bukkit.Location lastLocation;
+ // CraftBukkit end + // CraftBukkit end
+ +
public AbstractBoat(EntityType<? extends AbstractBoat> entityType, Level level, Supplier<Item> dropItem) { public AbstractBoat(EntityType<? extends AbstractBoat> entityType, Level level, Supplier<Item> dropItem) {
@ -55,30 +56,19 @@
super.push(entity); super.push(entity);
} }
} }
@@ -243,6 +_,7 @@ @@ -283,6 +_,18 @@
return this.getDirection().getClockWise();
}
+ private org.bukkit.Location lastLocation; // CraftBukkit
@Override
public void tick() {
this.oldStatus = this.status;
@@ -283,6 +_,21 @@
this.setDeltaMovement(Vec3.ZERO); this.setDeltaMovement(Vec3.ZERO);
} }
+ // CraftBukkit start + // CraftBukkit start
+ org.bukkit.Server server = this.level().getCraftServer(); + org.bukkit.Location to = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.position(), this.level().getWorld(), this.getYRot(), this.getXRot());
+ 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.entity.Vehicle vehicle = (org.bukkit.entity.Vehicle) this.getBukkitEntity(); + 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)) { + if (this.lastLocation != null && !this.lastLocation.equals(to)) {
+ org.bukkit.event.vehicle.VehicleMoveEvent event = new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, this.lastLocation, 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(); + this.lastLocation = vehicle.getLocation();
+ // CraftBukkit end + // CraftBukkit end

View file

@ -40,12 +40,11 @@
return null; return null;
} else { } else {
this.unpackLootTable(playerInventory.player); this.unpackLootTable(playerInventory.player);
@@ -198,4 +_,59 @@ @@ -198,4 +_,58 @@
public void stopOpen(Player player) { public void stopOpen(Player player) {
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(player)); this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(player));
} }
+ +
+
+ // Paper start - LootTable API + // Paper start - LootTable API
+ final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); + final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData();
+ +
@ -64,13 +63,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -28,8 +28,8 @@
+ if (!collides) { + if (!collides) {
+ return false; + 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(); + return collisionEvent.callEvent();
+ // Paper end - fix VehicleEntityCollisionEvent not called when colliding with player + // Paper end - fix VehicleEntityCollisionEvent not called when colliding with player
} }
@ -141,7 +141,7 @@
double d = entity.getX() - this.getX(); double d = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double d2 = d * d + d1 * d1; double d2 = d * d + d1 * d1;
@@ -602,4 +_,27 @@ @@ -602,4 +_,28 @@
public boolean isFurnace() { public boolean isFurnace() {
return false; return false;
} }
@ -167,5 +167,6 @@
+ this.derailedZ = derailed.getZ(); + this.derailedZ = derailed.getZ();
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
+ public net.minecraft.world.item.Item publicGetDropItem() { return getDropItem(); } // Paper - api to get boat and minecart material - expose public drop item + public net.minecraft.world.item.Item publicGetDropItem() { return getDropItem(); } // Paper - api to get boat and minecart material - expose public drop item
} }

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java --- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
+++ b/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; import net.minecraft.world.phys.Vec3;
public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity { public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity {
@ -9,15 +9,42 @@
@Nullable @Nullable
public ResourceKey<LootTable> lootTable; public ResourceKey<LootTable> lootTable;
public long lootTableSeed; public long lootTableSeed;
+ private final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); // Paper - LootTable API
+ // Paper start - LootTable API protected AbstractMinecartContainer(EntityType<?> entityType, Level level) {
+ final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); super(entityType, level);
@@ -72,11 +_,18 @@
@Override
public void remove(Entity.RemovalReason reason) {
+ // CraftBukkit start - add Bukkit remove cause
+ this.remove(reason, null);
+ }
+ +
+ @Override + @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() { + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData() {
+ return this.lootableData; + return this.lootableData;
+ } + }
+ // Paper end - LootTable API + // Paper end - LootTable API
+
+ // CraftBukkit start + // CraftBukkit start
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>(); + public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK; + private int maxStack = MAX_STACK;
@ -26,12 +53,12 @@
+ return this.itemStacks; + return this.itemStacks;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
@ -56,28 +83,4 @@
+ return this.getBukkitEntity().getLocation(); + return this.getBukkitEntity().getLocation();
+ } + }
+ // CraftBukkit end + // 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

View file

@ -28,7 +28,7 @@
+ // CraftBukkit start + // CraftBukkit start
+ org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent( + org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent(
+ this.getBukkitEntity(), + 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 + this.isIncendiary
+ ); + );
+ if (!event.callEvent()) { + if (!event.callEvent()) {

View file

@ -12,12 +12,12 @@
+ return this.itemStacks; + return this.itemStacks;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ this.merchant.setTradingPlayer((Player) null); // SPIGOT-4860 + this.merchant.setTradingPlayer((Player) null); // SPIGOT-4860
+ } + }
+ +

View file

@ -21,8 +21,8 @@
+ } + }
+ +
+ // Don't need a transaction; the InventoryCrafting keeps track of it for us + // Don't need a transaction; the InventoryCrafting keeps track of it for us
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {} + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {}
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {} + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {}
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return new java.util.ArrayList<>(); + return new java.util.ArrayList<>();
+ } + }

View file

@ -15,16 +15,16 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public org.bukkit.event.inventory.InventoryType getInvType() { + public org.bukkit.event.inventory.InventoryType getInvType() {
+ return this.items.size() == 4 ? org.bukkit.event.inventory.InventoryType.CRAFTING : org.bukkit.event.inventory.InventoryType.WORKBENCH; + 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) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public List<org.bukkit.entity.HumanEntity> getViewers() { + public List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/DoorBlock.java --- a/net/minecraft/world/level/block/DoorBlock.java
+++ b/net/minecraft/world/level/block/DoorBlock.java +++ b/net/minecraft/world/level/block/DoorBlock.java
@@ -229,9 +_,23 @@ @@ -229,9 +_,22 @@
@Override @Override
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) { protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) {
@ -9,20 +9,19 @@
- if (!this.defaultBlockState().is(neighborBlock) && flag != state.getValue(POWERED)) { - if (!this.defaultBlockState().is(neighborBlock) && flag != state.getValue(POWERED)) {
+ // CraftBukkit start + // CraftBukkit start
+ BlockPos otherHalf = pos.relative(state.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? Direction.UP : Direction.DOWN); + 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 = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos);
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()); + org.bukkit.block.Block blockTop = org.bukkit.craftbukkit.block.CraftBlock.at(level, otherHalf);
+ org.bukkit.block.Block blockTop = bworld.getBlockAt(otherHalf.getX(), otherHalf.getY(), otherHalf.getZ());
+ +
+ int power = bukkitBlock.getBlockPower(); + int power = bukkitBlock.getBlockPower();
+ int powerTop = blockTop.getBlockPower(); + int powerTop = blockTop.getBlockPower();
+ if (powerTop > power) power = powerTop; + 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) { + if (oldPower == 0 ^ power == 0) {
+ org.bukkit.event.block.BlockRedstoneEvent eventRedstone = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, power); + org.bukkit.event.block.BlockRedstoneEvent event = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, power);
+ level.getCraftServer().getPluginManager().callEvent(eventRedstone); + event.callEvent();
+ +
+ boolean flag = eventRedstone.getNewCurrent() > 0; + boolean flag = event.getNewCurrent() > 0;
+ // CraftBukkit end + // CraftBukkit end
if (flag != state.getValue(OPEN)) { if (flag != state.getValue(OPEN)) {
this.playSound(null, level, pos, flag); this.playSound(null, level, pos, flag);

View file

@ -22,12 +22,12 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public List<org.bukkit.entity.HumanEntity> getViewers() { + public List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -14,13 +14,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -39,12 +39,12 @@
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>(); + public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK; + private int maxStack = MAX_STACK;
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -12,12 +12,12 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -14,13 +14,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -14,13 +14,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -15,13 +15,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -12,12 +12,12 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -12,12 +12,12 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -16,13 +16,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -17,13 +17,13 @@
+ } + }
+ +
+ @Override + @Override
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ @Override + @Override
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ @Override + @Override

View file

@ -13,12 +13,12 @@
+ return this.itemStacks; + return this.itemStacks;
+ } + }
+ +
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.add(who); + this.transaction.add(player);
+ } + }
+ +
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(who); + this.transaction.remove(player);
+ } + }
+ +
+ public List<org.bukkit.entity.HumanEntity> getViewers() { + public List<org.bukkit.entity.HumanEntity> getViewers() {

View file

@ -105,13 +105,13 @@ public final class PaperInventoryCustomHolderContainer implements Container {
} }
@Override @Override
public void onOpen(CraftHumanEntity who) { public void onOpen(CraftHumanEntity player) {
this.delegate.onOpen(who); this.delegate.onOpen(player);
} }
@Override @Override
public void onClose(CraftHumanEntity who) { public void onClose(CraftHumanEntity player) {
this.delegate.onClose(who); this.delegate.onClose(player);
} }
@Override @Override

View file

@ -194,13 +194,13 @@ public class CraftInventoryCustom extends CraftInventory {
} }
@Override @Override
public void onOpen(CraftHumanEntity who) { public void onOpen(CraftHumanEntity player) {
this.viewers.add(who); this.viewers.add(player);
} }
@Override @Override
public void onClose(CraftHumanEntity who) { public void onClose(CraftHumanEntity player) {
this.viewers.remove(who); this.viewers.remove(player);
} }
@Override @Override