Search in sources :

Example 6 with SingleSlotTileEntity

use of com.almuradev.almura.shared.tileentity.SingleSlotTileEntity in project Almura by AlmuraDev.

the class CacheBlock method getDrops.

@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
    if (!(world instanceof WorldServer) || ((WorldServer) world).isRemote) {
        return;
    }
    final ItemStack toDrop = new ItemStack(this, 1, 0);
    drops.add(toDrop);
    TileEntity te = world.getTileEntity(pos);
    if (te == null) {
        te = cacheTe;
    }
    if (te == null || !(te instanceof SingleSlotTileEntity)) {
        return;
    }
    final SingleSlotTileEntity cte = (SingleSlotTileEntity) te;
    this.addCacheToStack(toDrop, cte);
    cacheTe = null;
}
Also used : SingleSlotTileEntity(com.almuradev.almura.shared.tileentity.SingleSlotTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) SingleSlotTileEntity(com.almuradev.almura.shared.tileentity.SingleSlotTileEntity) WorldServer(net.minecraft.world.WorldServer) ItemStack(net.minecraft.item.ItemStack)

Aggregations

SingleSlotTileEntity (com.almuradev.almura.shared.tileentity.SingleSlotTileEntity)6 TileEntity (net.minecraft.tileentity.TileEntity)5 ISingleSlotItemHandler (com.almuradev.almura.shared.capability.ISingleSlotItemHandler)4 ItemStack (net.minecraft.item.ItemStack)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 Player (org.spongepowered.api.entity.living.player.Player)2 SingleSlotItemHandler (com.almuradev.almura.shared.capability.impl.SingleSlotItemHandler)1 Nullable (javax.annotation.Nullable)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 WorldServer (net.minecraft.world.WorldServer)1