use of org.bukkit.material.Gate in project Glowstone by GlowstoneMC.
the class BlockFenceGate method onRedstoneUpdate.
@Override
public void onRedstoneUpdate(GlowBlock block) {
GlowBlockState state = block.getState();
Gate gate = (Gate) state.getData();
boolean powered = block.isBlockIndirectlyPowered();
if (powered != gate.isOpen()) {
gate.setOpen(powered);
state.update();
}
}
use of org.bukkit.material.Gate in project Glowstone by GlowstoneMC.
the class BlockFenceGate method onOpened.
@Override
protected void onOpened(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc, GlowBlockState state, MaterialData materialData) {
if (materialData instanceof Gate) {
Gate gate = (Gate) materialData;
gate.setFacingDirection(getOpenDirection(player.getLocation().getYaw(), gate.getFacing()));
} else {
warnMaterialData(Gate.class, materialData);
}
}
use of org.bukkit.material.Gate in project Glowstone by GlowstoneMC.
the class BlockFenceGate method placeBlock.
@Override
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
super.placeBlock(player, state, face, holding, clickedLoc);
MaterialData materialData = state.getData();
if (materialData instanceof Gate) {
Gate gate = (Gate) materialData;
float yaw = player.getLocation().getYaw();
gate.setFacingDirection(blockFaceFromYaw(yaw));
state.update(true);
} else {
warnMaterialData(Gate.class, materialData);
}
}
Aggregations