Search in sources :

Example 1 with TileChaosPlinth

use of net.silentchaos512.gems.tile.TileChaosPlinth in project SilentGems by SilentChaos512.

the class BlockChaosPlinth method clOnBlockActivated.

@Override
protected boolean clOnBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack heldItem = player.getHeldItem(hand);
    TileEntity t = world.getTileEntity(pos);
    if (t != null && t instanceof TileChaosPlinth) {
        TileChaosPlinth tile = (TileChaosPlinth) t;
        ItemStack currentGem = tile.getStackInSlot(0);
        if (StackHelper.isValid(heldItem) && heldItem.getItem() instanceof ItemChaosGem) {
            player.setHeldItem(hand, currentGem);
            tile.setInventorySlotContents(0, heldItem);
            return true;
        } else if (StackHelper.isValid(currentGem) && StackHelper.isEmpty(heldItem)) {
        // TODO
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ItemChaosGem(net.silentchaos512.gems.item.ItemChaosGem) ItemStack(net.minecraft.item.ItemStack) TileChaosPlinth(net.silentchaos512.gems.tile.TileChaosPlinth)

Aggregations

ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ItemChaosGem (net.silentchaos512.gems.item.ItemChaosGem)1 TileChaosPlinth (net.silentchaos512.gems.tile.TileChaosPlinth)1