use of WayofTime.bloodmagic.tile.TileAlchemyArray in project BloodMagic by WayofTime.
the class ItemArcaneAshes method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
BlockPos newPos = blockPos.offset(side);
if (world.isAirBlock(newPos)) {
if (!world.isRemote) {
EnumFacing rotation = EnumFacing.fromAngle(player.getRotationYawHead());
world.setBlockState(newPos, RegistrarBloodMagicBlocks.ALCHEMY_ARRAY.getDefaultState());
TileEntity tile = world.getTileEntity(newPos);
if (tile instanceof TileAlchemyArray) {
((TileAlchemyArray) tile).setRotation(rotation);
}
stack.damageItem(1, player);
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.FAIL;
}
Aggregations