use of org.bukkit.material.WoodenStep in project Glowstone by GlowstoneMC.
the class BlockSlab method placeBlock.
@Override
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
super.placeBlock(player, state, face, holding, clickedLoc);
Material blockType = state.getBlock().getType();
if (blockType == Material.STEP) {
state.setType(Material.DOUBLE_STEP);
state.setData(holding.getData());
return;
} else if (blockType == Material.WOOD_STEP) {
state.setType(Material.WOOD_DOUBLE_STEP);
state.setData(holding.getData());
return;
} else if (blockType == Material.STONE_SLAB2) {
state.setType(Material.DOUBLE_STONE_SLAB2);
state.setData(holding.getData());
return;
} else if (blockType == Material.PURPUR_SLAB) {
state.setType(Material.PURPUR_DOUBLE_SLAB);
state.setData(holding.getData());
return;
}
if (face == BlockFace.DOWN || face != BlockFace.UP && clickedLoc.getY() >= 0.5) {
MaterialData data = state.getData();
if (data instanceof Step) {
((Step) data).setInverted(true);
} else if (data instanceof WoodenStep) {
((WoodenStep) data).setInverted(true);
} else if (data.getItemType() == Material.STONE_SLAB2 || data.getItemType() == Material.PURPUR_SLAB) {
Step slab = new Step(data.getItemType());
slab.setInverted(true);
data = slab;
}
state.setData(data);
}
}
Aggregations