2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockDoor.java
|
|
|
|
+++ b/net/minecraft/server/BlockDoor.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -2,6 +2,8 @@
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockDoor extends Block {
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
2018-12-06 00:00:00 +01:00
|
|
|
@@ -163,9 +165,24 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1) {
|
|
|
|
- boolean flag = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition.shift(iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN));
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ BlockPosition otherHalf = blockposition.shift(iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
+ org.bukkit.World bworld = world.getWorld();
|
|
|
|
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
|
|
+ org.bukkit.block.Block blockTop = bworld.getBlockAt(otherHalf.getX(), otherHalf.getY(), otherHalf.getZ());
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
+ int power = bukkitBlock.getBlockPower();
|
|
|
|
+ int powerTop = blockTop.getBlockPower();
|
|
|
|
+ if (powerTop > power) power = powerTop;
|
2018-12-06 00:00:00 +01:00
|
|
|
+ int oldPower = (Boolean) iblockdata.get(BlockDoor.POWERED) ? 15 : 0;
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
+ if (oldPower == 0 ^ power == 0) {
|
|
|
|
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
|
|
|
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
|
|
|
|
2018-12-06 00:00:00 +01:00
|
|
|
- if (block != this && flag != (Boolean) iblockdata.get(BlockDoor.POWERED)) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ boolean flag = eventRedstone.getNewCurrent() > 0;
|
|
|
|
+ // CraftBukkit end
|
2018-12-06 00:00:00 +01:00
|
|
|
if (flag != (Boolean) iblockdata.get(BlockDoor.OPEN)) {
|
2018-07-15 02:00:00 +02:00
|
|
|
this.b(world, blockposition, flag);
|
|
|
|
}
|