mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
Update to Minecraft 1.13-pre7
This commit is contained in:
@@ -2,36 +2,37 @@
|
||||
+++ b/net/minecraft/server/BlockDoor.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -137,9 +139,23 @@
|
||||
this.b(world, blockposition, iblockdata, 0);
|
||||
}
|
||||
} else {
|
||||
- boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3);
|
||||
@@ -169,9 +171,24 @@
|
||||
}
|
||||
|
||||
- if (block != this && (flag1 || block.getBlockData().m()) && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) {
|
||||
+ // CraftBukkit start
|
||||
+ 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(blockposition3.getX(), blockposition3.getY(), blockposition3.getZ());
|
||||
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);
|
||||
+
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+ int powerTop = blockTop.getBlockPower();
|
||||
+ if (powerTop > power) power = powerTop;
|
||||
+ int oldPower = (Boolean) iblockdata2.get(BlockDoor.POWERED) ? 15 : 0;
|
||||
+ 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());
|
||||
+
|
||||
+ if (oldPower == 0 ^ power == 0) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+ int powerTop = blockTop.getBlockPower();
|
||||
+ if (powerTop > power) power = powerTop;
|
||||
+ int oldPower = ((Boolean) iblockdata.get(BlockDoor.POWERED)).booleanValue() ? 15 : 0;
|
||||
+
|
||||
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition3, iblockdata2.set(BlockDoor.POWERED, Boolean.valueOf(flag1)), 2);
|
||||
if (flag1 != ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.OPEN, Boolean.valueOf(flag1)), 2);
|
||||
+ if (oldPower == 0 ^ power == 0) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
- if (block != this && flag != ((Boolean) iblockdata.get(BlockDoor.POWERED)).booleanValue()) {
|
||||
+ boolean flag = eventRedstone.getNewCurrent() > 0;
|
||||
+ // CraftBukkit end
|
||||
if (flag != ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
|
||||
this.b(world, blockposition, flag);
|
||||
}
|
||||
|
Reference in New Issue
Block a user