use of org.bukkit.material.TrapDoor in project Glowstone by GlowstoneMC.
the class BlockTrapDoor method placeBlock.
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
MaterialData materialData = state.getData();
if (materialData instanceof TrapDoor) {
TrapDoor trapDoor = (TrapDoor) materialData;
trapDoor.setFacingDirection(face);
if (clickedLoc.getY() >= 0.5) {
trapDoor.setInverted(true);
} else {
trapDoor.setInverted(false);
}
state.update(true);
} else {
parent.warnMaterialData(TrapDoor.class, materialData);
}
}
use of org.bukkit.material.TrapDoor in project Glowstone by GlowstoneMC.
the class BlockTrapDoor method onRedstoneUpdate.
public void onRedstoneUpdate(GlowBlock block) {
GlowBlockState state = block.getState();
TrapDoor trapdoor = (TrapDoor) state.getData();
boolean powered = block.isBlockIndirectlyPowered();
if (powered != trapdoor.isOpen()) {
trapdoor.setOpen(powered);
state.update();
}
}
Aggregations