Search in sources :

Example 1 with IAltarReader

use of WayofTime.bloodmagic.iface.IAltarReader in project BloodMagic by WayofTime.

the class BlockAltar method onBlockActivated.

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
    TileAltar altar = (TileAltar) world.getTileEntity(pos);
    if (altar == null || player.isSneaking())
        return false;
    ItemStack playerItem = player.getHeldItem(hand);
    if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator) {
        playerItem.getItem().onItemRightClick(world, player, hand);
        return true;
    }
    if (Utils.insertItemToTile(altar, player))
        altar.startCycle();
    else
        altar.setActive();
    world.notifyBlockUpdate(pos, state, state, 3);
    return true;
}
Also used : ItemStack(net.minecraft.item.ItemStack) TileAltar(WayofTime.bloodmagic.tile.TileAltar) IAltarReader(WayofTime.bloodmagic.iface.IAltarReader)

Aggregations

IAltarReader (WayofTime.bloodmagic.iface.IAltarReader)1 TileAltar (WayofTime.bloodmagic.tile.TileAltar)1 ItemStack (net.minecraft.item.ItemStack)1