use of mcjty.lib.api.Infusable in project RFTools by McJty.
the class MachineInfuserTileEntity method getTagCompound.
public static NBTTagCompound getTagCompound(ItemStack stack) {
if (stack.isEmpty()) {
return null;
}
if (stack.getCount() != 1) {
return null;
}
Item item = stack.getItem();
if (!(item instanceof ItemBlock)) {
return null;
}
Block block = ((ItemBlock) item).getBlock();
if (!(block instanceof Infusable)) {
return null;
}
NBTTagCompound tagCompound = stack.getTagCompound();
if (tagCompound == null) {
return new NBTTagCompound();
} else {
return tagCompound;
}
}
use of mcjty.lib.api.Infusable in project RFTools by McJty.
the class ShardWandItem method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof Infusable) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof GenericTileEntity) {
GenericTileEntity genericTileEntity = (GenericTileEntity) te;
int infused = genericTileEntity.getInfused();
if (infused < GeneralConfig.maxInfuse) {
infused = GeneralConfig.maxInfuse;
Logging.message(player, "Maximized infusion level!");
} else {
infused = 0;
Logging.message(player, "Cleared infusion level!");
}
genericTileEntity.setInfused(infused);
} else {
Logging.message(player, "This block doesn't have the right tile entity!");
}
} else {
Logging.message(player, "This block is not infusable!");
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.SUCCESS;
}
Aggregations