some more catalytic reformer work

This commit is contained in:
Bob 2023-03-07 23:12:15 +01:00
parent b5f80f96f1
commit 8b2a530c16
3 changed files with 71 additions and 11 deletions

View File

@ -28,11 +28,11 @@ public class GUIMachineCatalyticReformer extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 70 - 52, 16, 52);
refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 70 - 52, 16, 52);
refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 98, guiTop + 70 - 52, 16, 52);
refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 70 - 52, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 70 - 52, 16, 52, refinery.power, refinery.maxPower);
refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 70 - 52, 16, 52);
refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 107, guiTop + 70 - 52, 16, 52);
refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 125, guiTop + 70 - 52, 16, 52);
refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 143, guiTop + 70 - 52, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 17, guiTop + 70 - 52, 16, 52, refinery.power, refinery.maxPower);
}
@Override
@ -50,11 +50,11 @@ public class GUIMachineCatalyticReformer extends GuiInfoContainer {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int j = (int) (refinery.power * 54 / refinery.maxPower);
drawTexturedModalRect(guiLeft + 26, guiTop + 70 - j, 176, 52 - j, 16, j);
drawTexturedModalRect(guiLeft + 17, guiTop + 70 - j, 176, 52 - j, 16, j);
refinery.tanks[0].renderTank(guiLeft + 44, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[1].renderTank(guiLeft + 80, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[2].renderTank(guiLeft + 98, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[3].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[0].renderTank(guiLeft + 35, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[1].renderTank(guiLeft + 107, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[2].renderTank(guiLeft + 125, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[3].renderTank(guiLeft + 143, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -1,6 +1,7 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
@ -46,12 +47,13 @@ public class RenderCatalyticReformer extends TileEntitySpecialRenderer implement
GL11.glShadeModel(GL11.GL_FLAT);
/// rapidly spinning dicks ///
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslated(-1.125, 1.375, 1);
double s = 0.125D;
GL11.glScaled(s, s, s);
GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0);
GL11.glTranslated(0, 0.1, -0.5);
this.bindTexture(extra);
HorsePronter.reset();
double r = 60;

View File

@ -1,13 +1,16 @@
package com.hbm.tileentity.machine.oil;
import com.hbm.blocks.BlockDummyable;
import com.hbm.inventory.container.ContainerMachineCatalyticReformer;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineCatalyticReformer;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IPersistentNBT;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardTransceiver;
@ -46,6 +49,61 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.updateConnections();
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
tanks[0].setType(9, slots);
tanks[0].loadTank(1, 2, slots);
reform();
tanks[1].unloadTank(3, 4, slots);
tanks[2].unloadTank(5, 6, slots);
tanks[3].unloadTank(7, 8, slots);
for(DirPos pos : getConPos()) {
for(int i = 1; i < 4; i++) {
if(tanks[i].getFill() > 0) {
this.sendFluid(tanks[i].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", this.power);
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "" + i);
this.networkPack(data, 150);
}
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.power = nbt.getLong("power");
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "" + i);
}
private void reform() {
//TODO: add recipe handler
}
private void updateConnections() {
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ, dir),
new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 - rot.offsetZ, dir),
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ, dir.getOpposite()),
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ, dir.getOpposite())
};
}
@Override