mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
feat: Add look overlay to Leviathan Turbine (aka. Big Chungus)
This commit is contained in:
parent
5cf06f2055
commit
c94292a667
@ -1,23 +1,32 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityChungus;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineChungus extends BlockDummyable implements ITooltipProvider {
|
||||
public class MachineChungus extends BlockDummyable implements ITooltipProvider, ILookOverlay {
|
||||
|
||||
public MachineChungus(Material mat) {
|
||||
super(mat);
|
||||
@ -135,4 +144,40 @@ public class MachineChungus extends BlockDummyable implements ITooltipProvider {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(!(te instanceof TileEntityChungus))
|
||||
return;
|
||||
|
||||
TileEntityChungus chungus = (TileEntityChungus) te;
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
FluidTank tankInput = chungus.getReceivingTanks()[0];
|
||||
FluidTank tankOutput = chungus.getSendingTanks()[0];
|
||||
|
||||
FluidType inputType = tankInput.getTankType();
|
||||
FluidType outputType = Fluids.NONE;
|
||||
|
||||
if (inputType.hasTrait(FT_Coolable.class)) {
|
||||
outputType = inputType.getTrait(FT_Coolable.class).coolsTo;
|
||||
}
|
||||
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + inputType.getLocalizedName() + ": " + tankInput.getFill() + "/" + tankInput.getMaxFill() + "mB");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + outputType.getLocalizedName() + ": " + tankOutput.getFill() + "/" + tankOutput.getMaxFill() + "mB");
|
||||
|
||||
|
||||
text.add(EnumChatFormatting.YELLOW + "** " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(chungus.power) + "/" + BobMathUtil.getShortNumber(chungus.getMaxPower()) + "HE");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +144,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
||||
data.setLong("power", power);
|
||||
data.setInteger("type", tanks[0].getTankType().getID());
|
||||
data.setInteger("operational", turnTimer);
|
||||
data.setInteger("input_fill", tanks[0].getFill());
|
||||
data.setInteger("output_fill", tanks[1].getFill());
|
||||
this.networkPack(data, 150);
|
||||
|
||||
} else {
|
||||
@ -223,6 +225,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
||||
this.power = data.getLong("power");
|
||||
this.turnTimer = data.getInteger("operational");
|
||||
this.tanks[0].setTankType(Fluids.fromID(data.getInteger("type")));
|
||||
this.tanks[0].setFill(data.getInteger("input_fill"));
|
||||
this.tanks[1].setFill(data.getInteger("output_fill"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user