Search in sources :

Example 6 with TileEntityDarkEnergyGenerator

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);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TileEntityDarkEnergyGenerator(stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDarkEnergyGenerator)

Aggregations

TileEntityDarkEnergyGenerator (stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDarkEnergyGenerator)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 TileEntity (net.minecraft.tileentity.TileEntity)4 ItemStack (net.minecraft.item.ItemStack)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 TileEntityNuclearWasteGenerator (stevekung.mods.moreplanets.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator)2 TileEntityNuclearWasteTank (stevekung.mods.moreplanets.planets.nibiru.tileentity.TileEntityNuclearWasteTank)2 TileEntityEnergyStorageClusterMP (stevekung.mods.moreplanets.utils.tileentity.TileEntityEnergyStorageClusterMP)2 TileBaseUniversalElectrical (micdoodle8.mods.galacticraft.core.energy.tile.TileBaseUniversalElectrical)1 Block (net.minecraft.block.Block)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 BlockPos (net.minecraft.util.math.BlockPos)1 TileEntityDarkEnergyCore (stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDarkEnergyCore)1 IDescription (stevekung.mods.moreplanets.utils.IDescription)1 BlockTileMP (stevekung.mods.moreplanets.utils.blocks.BlockTileMP)1 IDarkEnergyFuel (stevekung.mods.moreplanets.utils.items.IDarkEnergyFuel)1