Merge pull request #1843 from Xenox003/master

Add Look overlay to Leviathan Turbine
This commit is contained in:
HbmMods 2025-01-06 18:22:44 +01:00 committed by GitHub
commit 3400fed16e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 50 additions and 4 deletions

View File

@ -32,4 +32,4 @@
* Like previously, due to the archaic nature of the model, the rotations are not very precise, and will most likely break when holding an akimbo gun
* Potentially fixed an issue where cargo planes do not successfully spawn on lower render distances
* Fixed glyphids not calling their `onDeath` function properly, causing them to not drop anything and preventing the appropriate forge events from firing
* Fixed GL state leak caused by plasma blast particles, causing other particles (especially bones) to render weird
* Fixed GL state leak caused by plasma blast particles, causing other particles (especially bones) to render weird

View File

@ -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);
}
}

View File

@ -138,9 +138,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
turnTimer--;
if(operational) turnTimer = 25;
networkPackNT(150);
} else {
this.lastRotor = this.rotor;
@ -214,6 +213,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
buf.writeLong(this.power);
buf.writeInt(this.turnTimer);
this.tanks[0].serialize(buf);
this.tanks[1].serialize(buf);
}
@Override
@ -221,6 +221,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
this.power = buf.readLong();
this.turnTimer = buf.readInt();
this.tanks[0].deserialize(buf);
this.tanks[1].deserialize(buf);
}
@Override