use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator in project MorePlanets by SteveKunG.
the class ItemBlockDarkEnergyGenerator method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, @Nullable World world, List<String> list, ITooltipFlag flag) {
if (this.getBlock() instanceof IBlockDescription) {
if (CommonRegisterHelper.isShiftKeyDown()) {
((IBlockDescription) this.block).getDescription().addDescription(itemStack, list);
} else {
if (this.getBlock() instanceof BlockTileGC) {
TileEntity te = ((BlockTileGC) this.getBlock()).createTileEntity(null, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
if (te instanceof TileBaseElectricBlock) {
float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
if (powerDrawn > 0) {
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
}
}
if (te instanceof TileBaseUniversalElectrical) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("EnergyStored")) {
int power = (int) itemStack.getTagCompound().getFloat("EnergyStored");
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.energy_stored.name", EnergyDisplayHelper.getEnergyDisplayS(power)));
}
}
if (te instanceof TileEntityDarkEnergyGenerator) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("DarkEnergyFuel")) {
int power = itemStack.getTagCompound().getInteger("DarkEnergyFuel");
power = power * 100 / 1000;
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.dark_energy_fuel.name", power) + "%");
}
}
} else if (this.getBlock() instanceof BlockAdvancedTile) {
TileEntity te = ((BlockAdvancedTile) this.getBlock()).createTileEntity(world, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
if (te instanceof TileBaseElectricBlock) {
float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
if (powerDrawn > 0) {
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
}
}
}
list.add(GCCoreUtil.translate("desc.shift_info.name"));
}
}
}
use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator in project MorePlanets by SteveKunG.
the class WailaTileEntityProviderMP method getWailaHead.
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileEntity tile = accessor.getTileEntity();
Block block = accessor.getBlock();
IBlockState state = accessor.getBlockState();
NBTTagCompound nbt = accessor.getNBTData();
if (nbt.hasKey("EnergyF") && !(block == MPBlocks.DUMMY_BLOCK && (state.getValue(BlockDummy.VARIANT) == BlockDummy.BlockType.NUCLEAR_WASTE_TANK_MIDDLE || state.getValue(BlockDummy.VARIANT) == BlockDummy.BlockType.NUCLEAR_WASTE_TANK_TOP))) {
tooltip.add(TextFormatting.GREEN + GCCoreUtil.translate("gui.message.energy") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("EnergyF")));
}
// block
if (block == MPBlocks.DUMMY_BLOCK) {
BlockDummy.BlockType type = state.getValue(BlockDummy.VARIANT);
if (type == BlockDummy.BlockType.DARK_ENERGY_SOLAR1 || type == BlockDummy.BlockType.DARK_ENERGY_SOLAR2 || type == BlockDummy.BlockType.DARK_ENERGY_SOLAR3 || type == BlockDummy.BlockType.DARK_ENERGY_SOLAR4) {
int process = nbt.getInteger("ActivatedTick") * 100 / 12000;
int destruct = nbt.getInteger("FailedTick");
if (destruct > 0) {
destruct = 600 - destruct;
tooltip.add(TextFormatting.DARK_RED + GCCoreUtil.translate("gui.status.destruct.name") + ": " + CommonRegisterHelper.ticksToElapsedTime(destruct));
} else {
tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
}
if (process > 0 && process < 100) {
tooltip.add("Process: " + process + "%");
}
}
if (type == BlockDummy.BlockType.WARP_PAD) {
if (tile instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy) tile;
TileEntitySpaceWarpPadFull warp = (TileEntitySpaceWarpPadFull) accessor.getWorld().getTileEntity(dummy.mainBlockPosition);
String dimension = GCCoreUtil.translate("gui.status.unknown.name");
String name = GCCoreUtil.translate("gui.status.unknown.name");
String dest = GCCoreUtil.translate("gui.status.unknown.name");
if (warp.hasWarpCore() && warp.containingItems.get(1).hasTagCompound()) {
NBTTagCompound compound = warp.containingItems.get(1).getTagCompound();
dimension = String.valueOf(compound.getInteger("DimensionID"));
name = WorldUtil.getProviderForDimensionClient(compound.getInteger("DimensionID")).getDimensionType().getName();
dest = compound.getInteger("X") + " " + compound.getInteger("Y") + " " + compound.getInteger("Z");
}
tooltip.add(GCCoreUtil.translate("gui.status.dimension.name") + ": " + dimension + " ");
tooltip.add(GCCoreUtil.translate("gui.status.name.name") + ": " + name);
tooltip.add(GCCoreUtil.translate("gui.status.destination.name") + ": " + dest);
}
}
if (type == BlockDummy.BlockType.SHIELD_GENERATOR_TOP) {
int chargeCooldown = nbt.getInteger("ShieldChargeCooldown");
tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
tooltip.add(GCCoreUtil.translate("gui.status.shield_damage.name") + ": " + nbt.getInteger("ShieldDamage"));
tooltip.add(GCCoreUtil.translate("gui.status.shield_size.name") + ": " + nbt.getInteger("MaxShieldSize"));
tooltip.add(GCCoreUtil.translate("gui.status.shield_capacity.name") + ": " + nbt.getInteger("ShieldCapacity") + "/" + nbt.getInteger("MaxShieldCapacity"));
if (chargeCooldown > 0) {
tooltip.add(GCCoreUtil.translate("gui.status.shield_charge_cooldown.name") + ": " + chargeCooldown / 20);
}
}
}
// tile
if (tile instanceof TileEntityDarkEnergyReceiver) {
int process = nbt.getInteger("ActivatedTick") * 100 / 12000;
int destruct = nbt.getInteger("FailedTick");
if (destruct > 0) {
destruct = 600 - destruct;
tooltip.add(TextFormatting.DARK_RED + GCCoreUtil.translate("gui.status.destruct.name") + ": " + CommonRegisterHelper.ticksToElapsedTime(destruct));
} else {
tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
}
if (process > 0 && process < 100) {
tooltip.add(GCCoreUtil.translate("gui.status.process.name") + ": " + process + "%");
}
}
if (tile instanceof TileEntityDarkEnergyCore) {
int transform = nbt.getInteger("ProduceTime");
if (transform > 0) {
tooltip.add(GCCoreUtil.translate("gui.status.transform_time.name") + ": " + CommonRegisterHelper.ticksToElapsedTime(transform));
}
}
if (tile instanceof TileEntityDarkEnergyGenerator) {
int generateWatts = nbt.getInteger("GenerateWatts");
int fuel = nbt.getInteger("DarkEnergyFuel");
tooltip.add(GCCoreUtil.translate("gui.message.generating.name") + ": " + (generateWatts > 0 ? EnergyDisplayHelper.getEnergyDisplayS(generateWatts) + "/t" : GCCoreUtil.translate("gui.status.not_generating.name")));
tooltip.add(GCCoreUtil.translate("gui.status.dark_energy_fuel.name") + ": " + (fuel > 0 ? String.valueOf(fuel * 100 / 1000) + "%" : TextFormatting.GOLD + GCCoreUtil.translate("gui.status.empty.name")));
}
if (tile instanceof TileEntitySpaceWarpPadFull) {
TileEntitySpaceWarpPadFull warp = (TileEntitySpaceWarpPadFull) tile;
String dimension = GCCoreUtil.translate("gui.status.unknown.name");
String name = GCCoreUtil.translate("gui.status.unknown.name");
String dest = GCCoreUtil.translate("gui.status.unknown.name");
if (warp.hasWarpCore() && warp.containingItems.get(1).hasTagCompound()) {
NBTTagCompound compound = warp.containingItems.get(1).getTagCompound();
dimension = String.valueOf(compound.getInteger("DimensionID"));
name = WorldUtil.getProviderForDimensionClient(compound.getInteger("DimensionID")).getDimensionType().getName();
dest = compound.getInteger("X") + " " + compound.getInteger("Y") + " " + compound.getInteger("Z");
}
tooltip.add(GCCoreUtil.translate("gui.status.dimension.name") + ": " + dimension + " ");
tooltip.add(GCCoreUtil.translate("gui.status.name.name") + ": " + name);
tooltip.add(GCCoreUtil.translate("gui.status.destination.name") + ": " + dest);
}
if (tile instanceof TileEntityDarkEnergyStorageCluster || tile instanceof TileEntityNuclearWasteStorageCluster || tile instanceof TileEntityNuclearWasteGenerator) {
tooltip.add(TextFormatting.GREEN + GCCoreUtil.translate("gui.message.max_energy") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("MaxEnergy")));
tooltip.add(GCCoreUtil.translate("gui.max_output.desc") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("MaxOutput")) + "/t");
if (nbt.hasKey("Status")) {
tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
}
}
if (tile instanceof TileEntityRocketCrusher) {
int scale = (int) ((double) nbt.getInteger("ProcessTicks") / (double) nbt.getInteger("ProcessTime") * 100);
if (scale > 0) {
tooltip.add(GCCoreUtil.translate("gui.electric_compressor.desc.0") + ": " + scale + "%");
}
}
if (tile instanceof TileEntityBlackHoleStorage) {
String owner = GCCoreUtil.translate("gui.status.unknown.name");
String collectMode = nbt.getString("CollectMode").equals("item") ? GCCoreUtil.translate("gui.status.collect_item.name") : nbt.getString("CollectMode").equals("item_and_xp") ? GCCoreUtil.translate("gui.status.collect_item_and_xp.name") : GCCoreUtil.translate("gui.status.collect_xp.name");
try {
owner = accessor.getWorld().getPlayerEntityByUUID(UUID.fromString(nbt.getString("OwnerUUID"))).getName();
} catch (Exception e) {
owner = "";
}
int xp = nbt.hasKey("XpFluid", Constants.NBT.TAG_COMPOUND) ? nbt.getCompoundTag("XpFluid").getInteger("Amount") : 0;
tooltip.add(GCCoreUtil.translate("gui.status.owner.name") + ": " + owner);
tooltip.add(GCCoreUtil.translate("gui.status.mode.name") + ": " + collectMode);
tooltip.add(GCCoreUtil.translate("desc.bhs_xp.name") + ": " + xp + "/" + 1000000);
}
if (tile instanceof TileEntityShieldGenerator) {
int chargeCooldown = nbt.getInteger("ShieldChargeCooldown");
tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
tooltip.add(GCCoreUtil.translate("gui.status.shield_damage.name") + ": " + nbt.getInteger("ShieldDamage"));
tooltip.add(GCCoreUtil.translate("gui.status.shield_size.name") + ": " + nbt.getInteger("MaxShieldSize"));
tooltip.add(GCCoreUtil.translate("gui.status.shield_capacity.name") + ": " + nbt.getInteger("ShieldCapacity") + "/" + nbt.getInteger("MaxShieldCapacity"));
if (chargeCooldown > 0) {
tooltip.add(GCCoreUtil.translate("gui.status.shield_charge_cooldown.name") + ": " + chargeCooldown / 20);
}
}
return tooltip;
}
use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator in project MorePlanets by SteveKunG.
the class WailaTileEntityProviderMP method getNBTData.
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound nbt, World world, BlockPos pos) {
if (tile instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy) tile;
if (world.getTileEntity(dummy.mainBlockPosition) instanceof TileEntityDarkEnergyReceiver) {
TileEntityDarkEnergyReceiver receiver = (TileEntityDarkEnergyReceiver) world.getTileEntity(dummy.mainBlockPosition);
nbt.setString("Status", receiver.getGuiStatusWaila());
return receiver.writeToNBT(nbt);
}
if (world.getTileEntity(dummy.mainBlockPosition) instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) world.getTileEntity(dummy.mainBlockPosition);
nbt.setString("Status", shield.getStatus());
return shield.writeToNBT(nbt);
}
}
if (tile instanceof TileEntityDarkEnergyReceiver) {
TileEntityDarkEnergyReceiver receiver = (TileEntityDarkEnergyReceiver) tile;
nbt.setString("Status", receiver.getGuiStatusWaila());
return receiver.writeToNBT(nbt);
}
if (tile instanceof TileEntityDarkEnergyGenerator) {
TileEntityDarkEnergyGenerator generator = (TileEntityDarkEnergyGenerator) tile;
nbt.setInteger("GenerateWatts", generator.generateWatts);
return generator.writeToNBT(nbt);
}
if (tile instanceof TileEntityDarkEnergyStorageCluster) {
TileEntityDarkEnergyStorageCluster energy = (TileEntityDarkEnergyStorageCluster) tile;
nbt.setFloat("MaxEnergy", energy.getMaxEnergyStoredGC());
nbt.setFloat("MaxOutput", energy.storage.getMaxExtract());
return energy.writeToNBT(nbt);
}
if (tile instanceof TileEntityNuclearWasteStorageCluster) {
TileEntityNuclearWasteStorageCluster energy = (TileEntityNuclearWasteStorageCluster) tile;
nbt.setFloat("MaxEnergy", energy.getMaxEnergyStoredGC());
nbt.setFloat("MaxOutput", energy.storage.getMaxExtract());
return energy.writeToNBT(nbt);
}
if (tile instanceof TileEntityRocketCrusher) {
TileEntityRocketCrusher crusher = (TileEntityRocketCrusher) tile;
nbt.setInteger("ProcessTime", crusher.processTimeRequired);
return crusher.writeToNBT(nbt);
}
if (tile instanceof TileEntityShieldGenerator) {
TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
nbt.setString("Status", shield.getStatus());
return shield.writeToNBT(nbt);
}
if (tile instanceof TileEntityNuclearWasteGenerator) {
TileEntityNuclearWasteGenerator generator = (TileEntityNuclearWasteGenerator) tile;
nbt.setString("Status", generator.getStatus());
nbt.setFloat("MaxEnergy", generator.getMaxEnergyStoredGC());
nbt.setFloat("MaxOutput", generator.storage.getMaxExtract());
return generator.writeToNBT(nbt);
}
return tile.writeToNBT(nbt);
}
use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator in project MorePlanets by SteveKunG.
the class GuiHandlerMP method getServerGuiElement.
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (playerBase == null) {
return null;
}
if (tile != null) {
if (tile instanceof TileEntityRocketCrusher) {
return new ContainerRocketCrusher(player.inventory, (TileEntityRocketCrusher) tile);
} else if (tile instanceof TileEntitySpaceWarpPadFull) {
return new ContainerSpaceWarpPad(player.inventory, (TileEntitySpaceWarpPadFull) tile);
} else if (tile instanceof TileEntityDarkEnergyReceiver) {
return new ContainerDarkEnergyReceiver(player.inventory, (TileEntityDarkEnergyReceiver) tile);
} else if (tile instanceof TileEntityNuclearWasteGenerator) {
return new ContainerNuclearWasteGenerator(player.inventory, (TileEntityNuclearWasteGenerator) tile);
} else if (tile instanceof TileEntityDarkEnergyStorageCluster) {
return new ContainerDarkEnergyStorage(player.inventory, (TileEntityDarkEnergyStorageCluster) tile);
} else if (tile instanceof TileEntityNuclearWasteStorageCluster) {
return new ContainerNuclearWasteEnergyStorage(player.inventory, (TileEntityNuclearWasteStorageCluster) tile);
} else if (tile instanceof TileEntityDarkEnergyGenerator) {
return new ContainerDarkEnergyGenerator(player.inventory, (TileEntityDarkEnergyGenerator) tile);
} else if (tile instanceof TileEntityCrashedAlienProbe) {
return new ContainerCrashedAlienProbe(player.inventory, (TileEntityCrashedAlienProbe) tile, player);
} else if (tile instanceof TileEntityBlackHoleStorage) {
return new ContainerBlackHoleStorage(player.inventory, (TileEntityBlackHoleStorage) tile);
} else if (tile instanceof TileEntityShieldGenerator) {
return new ContainerShieldGenerator(player.inventory, (TileEntityShieldGenerator) tile);
}
return tile;
}
return null;
}
use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator in project MorePlanets by SteveKunG.
the class BlockDarkEnergyGenerator method onUseWrench.
@Override
public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
int change = world.getBlockState(pos).getValue(BlockStateHelper.FACING_HORIZON).rotateY().getHorizontalIndex();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityDarkEnergyGenerator) {
int direction = 0;
if (change == 0) {
direction = 90;
}
if (change == 1) {
direction = 0;
}
if (change == 2) {
direction = -90;
}
if (change == 3) {
direction = -180;
}
TileEntityDarkEnergyGenerator energy = (TileEntityDarkEnergyGenerator) tile;
energy.setFacing(direction);
}
world.setBlockState(pos, this.getStateFromMeta(change), 3);
return true;
}
Aggregations