mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 19:07:40 +01:00
readd dropped event in InteractWithDoor
This commit is contained in:
parent
9c973e84bc
commit
783b3b70e6
@ -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))) {
|
||||
|
@ -881,7 +881,7 @@
|
||||
+ {
|
||||
+ {
|
||||
+ Either<net.minecraft.world.entity.player.Player.BedSleepingProblem, Unit> either = super.startSleepInBed(at, force).ifRight((unit) -> {
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end
|
||||
this.awardStat(Stats.SLEEP_IN_BED);
|
||||
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -19,9 +19,9 @@
|
||||
+ // Paper start
|
||||
+ 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();
|
||||
+
|
||||
@ -31,6 +31,6 @@
|
||||
+
|
||||
+ org.bukkit.Location getLocation();
|
||||
+
|
||||
+ int MAX_STACK = 99;
|
||||
+ int MAX_STACK = Item.ABSOLUTE_MAX_STACK_SIZE;
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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<MemoryModuleType<?>, 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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,7 @@
|
||||
private int timesChanged;
|
||||
|
||||
+ // 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;
|
||||
+
|
||||
+ public List<ItemStack> 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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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<Item> 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<? extends AbstractBoat> entityType, Level level, Supplier<Item> 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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> 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<org.bukkit.entity.HumanEntity> 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<org.bukkit.entity.HumanEntity> 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
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
+ }
|
||||
+
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
+ return new java.util.ArrayList<>();
|
||||
+ }
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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);
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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
|
||||
|
@ -39,12 +39,12 @@
|
||||
+ public java.util.List<org.bukkit.entity.HumanEntity> 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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user