Search in sources :

Example 1 with TileNeutronBattery

use of arekkuusu.solar.common.block.tile.TileNeutronBattery in project Solar by ArekkuusuJerii.

the class BlockNeutronBattery method getItem.

@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
    Optional<TileNeutronBattery> optional = getTile(TileNeutronBattery.class, world, pos);
    if (optional.isPresent()) {
        TileNeutronBattery neutron = optional.get();
        ItemStack stack = new ItemStack(Item.getItemFromBlock(this));
        neutron.getKey().ifPresent(uuid -> {
            ((IEntangledStack) stack.getItem()).setKey(stack, uuid);
        });
        NBTHelper.setEnum(stack, state.getValue(CAPACITY), "neutron_nbt");
        return stack;
    }
    return super.getItem(world, pos, state);
}
Also used : IEntangledStack(arekkuusu.solar.api.entanglement.IEntangledStack) TileNeutronBattery(arekkuusu.solar.common.block.tile.TileNeutronBattery) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IEntangledStack (arekkuusu.solar.api.entanglement.IEntangledStack)1 TileNeutronBattery (arekkuusu.solar.common.block.tile.TileNeutronBattery)1 ItemStack (net.minecraft.item.ItemStack)1