readd dropped event in InteractWithDoor

This commit is contained in:
Lulu13022002
2024-12-16 17:29:46 +01:00
parent 9c973e84bc
commit 783b3b70e6
33 changed files with 175 additions and 172 deletions

View File

@@ -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);

View File

@@ -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() {

View File

@@ -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

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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

View File

@@ -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

View File

@@ -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() {