use of stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDarkEnergyGenerator in project MorePlanets by SteveKunG.
the class BlockDarkEnergyGenerator method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack itemStack) {
world.setBlockState(pos, this.getDefaultState().withProperty(BlockStateProperty.FACING_HORIZON, placer.getHorizontalFacing().getOpposite()));
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityDarkEnergyGenerator) {
TileEntityDarkEnergyGenerator energy = (TileEntityDarkEnergyGenerator) world.getTileEntity(pos);
if (itemStack.hasTagCompound()) {
NBTTagCompound nbt = itemStack.getTagCompound();
energy.storage.setEnergyStored(nbt.getFloat("EnergyStored"));
energy.darkEnergyFuel = nbt.getInteger("DarkEnergyFuel");
energy.inventory = NonNullList.withSize(energy.getSizeInventory(), ItemStack.EMPTY);
ItemStackHelper.loadAllItems(nbt, energy.inventory);
}
}
}
Aggregations