use of org.bukkit.material.MaterialData in project Glowstone by GlowstoneMC.
the class BlockSnow method updateBlock.
@Override
public void updateBlock(GlowBlock block) {
if (block.getLightFromBlocks() > 11) {
GlowBlockState state = block.getState();
state.setType(Material.AIR);
state.setData(new MaterialData(Material.AIR));
BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state);
EventFactory.callEvent(fadeEvent);
if (!fadeEvent.isCancelled()) {
state.update(true);
}
}
}
use of org.bukkit.material.MaterialData in project Glowstone by GlowstoneMC.
the class BlockSnowBlock method updateBlock.
@Override
public void updateBlock(GlowBlock block) {
if (block.getLightFromBlocks() > 11) {
GlowBlockState state = block.getState();
state.setType(Material.AIR);
state.setData(new MaterialData(Material.AIR));
BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state);
EventFactory.callEvent(fadeEvent);
if (!fadeEvent.isCancelled()) {
state.update(true);
}
}
}
use of org.bukkit.material.MaterialData in project Glowstone by GlowstoneMC.
the class BlockVine method placeBlock.
@Override
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
super.placeBlock(player, state, face, holding, clickedLoc);
MaterialData data = state.getData();
if (data instanceof Vine) {
if (face == BlockFace.DOWN || face == BlockFace.UP) {
return;
} else {
((Vine) data).putOnFace(face.getOppositeFace());
}
state.setData(data);
} else {
warnMaterialData(Vine.class, data);
}
}
use of org.bukkit.material.MaterialData in project Glowstone by GlowstoneMC.
the class BlockTorch method placeBlock.
@Override
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
super.placeBlock(player, state, face, holding, clickedLoc);
MaterialData data = state.getData();
if (data instanceof Torch) {
if (canAttachTo(state.getBlock(), face)) {
((Torch) data).setFacingDirection(face);
} else {
((Torch) data).setFacingDirection(BlockFace.UP);
}
} else {
warnMaterialData(Torch.class, data);
}
}
use of org.bukkit.material.MaterialData 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);
}
}
Aggregations