This commit is contained in:
PewPewCricket 2025-07-15 04:11:47 -05:00
commit fa6d8c1a54
9 changed files with 78 additions and 57 deletions

View File

@ -94,7 +94,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
@Override
public void addCollisionBoxesToList(World worldIn, int x, int y, int z, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn) {
AxisAlignedBB box = getBoundingBox(worldIn, x, y ,z);
AxisAlignedBB box = getBoundingBox(worldIn, x, y, z, true);
box = AxisAlignedBB.getBoundingBox(
Math.min(box.minX, box.maxX), Math.min(box.minY, box.maxY), Math.min(box.minZ, box.maxZ),
Math.max(box.minX, box.maxX), Math.max(box.minY, box.maxY), Math.max(box.minZ, box.maxZ));
@ -113,7 +113,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
AxisAlignedBB aabb = this.getBoundingBox(world, x, y, z);
AxisAlignedBB aabb = this.getBoundingBox(world, x, y, z, true);
if(aabb.minX == aabb.maxX && aabb.minY == aabb.maxY && aabb.minZ == aabb.maxZ) return null;
return aabb;
}
@ -121,7 +121,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
// Enables clicking through the open door
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
AxisAlignedBB box = getBoundingBox(world, x, y ,z);
AxisAlignedBB box = getBoundingBox(world, x, y, z, false);
box = AxisAlignedBB.getBoundingBox(
Math.min(box.minX, box.maxX), Math.min(box.minY, box.maxY), Math.min(box.minZ, box.maxZ),
Math.max(box.minX, box.maxX), Math.max(box.minY, box.maxY), Math.max(box.minZ, box.maxZ)
@ -158,11 +158,11 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
return getBoundingBox(world, x, y, z);
return getBoundingBox(world, x, y, z, false);
//return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
}
public AxisAlignedBB getBoundingBox(World world, int x, int y, int z) {
public AxisAlignedBB getBoundingBox(World world, int x, int y, int z, boolean forCollision) {
int meta = world.getBlockMetadata(x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
int[] core = this.findCore(world, x, y, z);
@ -173,7 +173,7 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
TileEntity te2 = world.getTileEntity(core[0], core[1], core[2]);
ForgeDirection dir = ForgeDirection.getOrientation(te2.getBlockMetadata() - BlockDummyable.offset);
BlockPos pos = new BlockPos(x - core[0], y - core[1], z - core[2]).rotate(Rotation.getBlockRotation(dir).add(Rotation.COUNTERCLOCKWISE_90));
AxisAlignedBB box = type.getBlockBound(pos.getX(), pos.getY(), pos.getZ(), open);
AxisAlignedBB box = type.getBlockBound(pos.getX(), pos.getY(), pos.getZ(), open, forCollision);
switch(te2.getBlockMetadata() - offset){
case 2: return AxisAlignedBB.getBoundingBox(x + 1 - box.minX, y + box.minY, z + 1 - box.minZ, x + 1 - box.maxX, y + box.maxY, z + 1 - box.maxZ);

View File

@ -35,7 +35,7 @@ public class MachineElectrolyser extends BlockDummyable {
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
return this.standardOpenBehavior(world, x, y, z, player, -1);
}
@Override

View File

@ -282,8 +282,6 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
if(this.slot != null) {
BufferUtil.writeNBT(buf, slot.stackTagCompound);
}
this.turnProgress = 2;
}
@Override

View File

@ -115,15 +115,18 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 108, 142, 16, turbinegas.power, turbinegas.getMaxPower());
if(turbinegas.powerSliderPos == 0)
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Turbine idle"});
else
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {(turbinegas.powerSliderPos) * 100 / 60 + "% power"});
if(turbinegas.state == 1) {
double consumption = turbinegas.fuelMaxCons.containsKey(turbinegas.tanks[0].getTankType()) ? turbinegas.fuelMaxCons.get(turbinegas.tanks[0].getTankType()) : 5D;
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Fuel consumption: " + 20 * (consumption * 0.05D + consumption * turbinegas.throttle / 100) + " mb/s"});
}
else {
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Generator offline"});
}
if(turbinegas.temp >= 20)
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: " + (turbinegas.temp) + "°C"});
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: " + (turbinegas.temp) + "°C"});
else
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: 20°C"});
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: 20°C"});
turbinegas.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 16, 16, 48);
turbinegas.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 70, 16, 32);
@ -146,6 +149,7 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
if(turbinegas.tanks[0].getFill() < 5000 || turbinegas.tanks[1].getFill() < 1000)
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34 + 32, 16, 16, guiLeft - 8, guiTop + 44 + 16, warning);
}
@Override
protected void drawGuiContainerBackgroundLayer(float iinterpolation, int x, int y) {

View File

@ -67,8 +67,8 @@ public abstract class DoorDecl {
}
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
return super.getBlockBound(x, y, z, open);
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
return super.getBlockBound(x, y, z, open, forCollision);
}
@Override
@ -156,7 +156,7 @@ public abstract class DoorDecl {
}
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(!open)
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
if(z == 1) {
@ -166,9 +166,9 @@ public abstract class DoorDecl {
} else if(y > 1) {
return AxisAlignedBB.getBoundingBox(0, 0.75, 0, 1, 1, 1);
} else if(y == 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.1, 1);
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, forCollision ? 0 : 0.1, 1);
} else {
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
}
}
@ -240,15 +240,15 @@ public abstract class DoorDecl {
}
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(open) {
if(y == 3) {
return AxisAlignedBB.getBoundingBox(0, 0.5, 0, 1, 1, 1);
} else if(y == 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.08, 1);
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, forCollision ? 0 : 0.08, 1);
}
}
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
}
@Override
@ -327,10 +327,9 @@ public abstract class DoorDecl {
};
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
if(open) {
if(y == 0) return AxisAlignedBB.getBoundingBox(0, 0, 1 - 0.25, 1, 0, 1);
return AxisAlignedBB.getBoundingBox(0, 0.9375, 1 - 0.25, 1, 1, 1);
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(forCollision && open) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
} else {
return AxisAlignedBB.getBoundingBox(0, 0, 1 - 0.25, 1, 1, 1);
}
@ -429,7 +428,7 @@ public abstract class DoorDecl {
}
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(!open) {
if(y > 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0.375, 1, 1, 0.625);
@ -437,11 +436,13 @@ public abstract class DoorDecl {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}
if(y == 1) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.0625, 1);
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, forCollision ? 0 : 0.0625, 1);
} else if(y == 4) {
return AxisAlignedBB.getBoundingBox(0, 0.5, 0.15, 1, 1, 0.85);
} else {
return super.getBlockBound(x, y, z, open);
} else if(y == 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}else {
return super.getBlockBound(x, y, z, open, forCollision);
}
}
@ -504,9 +505,9 @@ public abstract class DoorDecl {
};
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(!open)
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
if(z == 1) {
return AxisAlignedBB.getBoundingBox(0.4, 0, 0, 1, 1, 1);
} else if(z == -2) {
@ -514,9 +515,9 @@ public abstract class DoorDecl {
} else if(y == 3) {
return AxisAlignedBB.getBoundingBox(0, 0.5, 0, 1, 1, 1);
} else if(y == 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.0625, 1);
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, forCollision ? 0 : 0.0625, 1);
}
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
};
@Override
@ -595,8 +596,8 @@ public abstract class DoorDecl {
};
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
if(open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(forCollision && open) {
if(z == 0) {
return AxisAlignedBB.getBoundingBox(1 - 0.125, 0, 1 - 0.1875, 1, 1, 1);
} else {
@ -691,14 +692,14 @@ public abstract class DoorDecl {
}
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(!open)
return AxisAlignedBB.getBoundingBox(0, 0, 0.5, 1, 1, 1);
if(y > 1)
return AxisAlignedBB.getBoundingBox(0, 0.5, 0.5, 1, 1, 1);
else if(y == 0)
return AxisAlignedBB.getBoundingBox(0, 0, 0.5, 1, 0.1, 1);
return super.getBlockBound(x, y, z, open);
return AxisAlignedBB.getBoundingBox(0, 0, 0.5, 1, forCollision ? 0 : 0.1, 1);
return super.getBlockBound(x, y, z, open, forCollision);
};
@Override
@ -814,15 +815,15 @@ public abstract class DoorDecl {
};
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(!open) {
return AxisAlignedBB.getBoundingBox(0, 0, 0.75, 1, 1, 1);
} else if(y > 1) {
return AxisAlignedBB.getBoundingBox(0, 0.85, 0.75, 1, 1, 1);
} else if(y == 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0.75, 1, 0.15, 1);
return AxisAlignedBB.getBoundingBox(0, 0, 0.75, 1, forCollision ? 0 : 0.15, 1);
}
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
};
@Override
@ -1018,15 +1019,17 @@ public abstract class DoorDecl {
};
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
if(!open)
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
if(z == 3) {
return AxisAlignedBB.getBoundingBox(0.4, 0, 0, 1, 1, 1);
} else if(z == -3) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 0.6, 1, 1);
} else if(y == 0) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, forCollision ? 0 : 0.0625, 1);
}
return super.getBlockBound(x, y, z, open);
return super.getBlockBound(x, y, z, open, forCollision);
};
@Override
@ -1159,7 +1162,7 @@ public abstract class DoorDecl {
public void doOffsetTransform() {
}
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) {
return open ? AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0) : AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}

View File

@ -66,6 +66,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
public MaterialStack leftStack;
public MaterialStack rightStack;
public int maxMaterial = MaterialShapes.BLOCK.q(16);
private int lastSelectedGUI = 0;
public FluidTank[] tanks;
@ -248,6 +250,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
buf.writeInt(rightStack.material.id);
buf.writeInt(rightStack.amount);
}
buf.writeInt(lastSelectedGUI);
}
@Override
@ -269,6 +272,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
if(right) {
this.rightStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt());
}
this.lastSelectedGUI = buf.readInt();
}
public boolean canProcessFluid() {
@ -423,6 +427,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount"));
else this.rightStack = null;
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i);
this.lastSelectedGUI = nbt.getInteger("lastSelectedGUI");
}
@Override
@ -443,7 +448,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
nbt.setInteger("rightAmount", rightStack.amount);
}
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(nbt, "t" + i);
nbt.setInteger("lastSelectedGUI", this.lastSelectedGUI);
}
AxisAlignedBB bb = null;
@ -503,6 +508,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(ID == -1) ID = lastSelectedGUI;
if(ID == 0) return new ContainerElectrolyserFluid(player.inventory, this);
return new ContainerElectrolyserMetal(player.inventory, this);
}
@ -510,6 +516,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(ID == -1) ID = lastSelectedGUI;
if(ID == 0) return new GUIElectrolyserFluid(player.inventory, this);
return new GUIElectrolyserMetal(player.inventory, this);
}
@ -520,8 +527,10 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
@Override
public void receiveControl(EntityPlayer player, NBTTagCompound data) {
if(data.hasKey("sgm")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 1, worldObj, xCoord, yCoord, zCoord);
if(data.hasKey("sgf")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, worldObj, xCoord, yCoord, zCoord);
if(data.hasKey("sgm")) lastSelectedGUI = 1;
if(data.hasKey("sgf")) lastSelectedGUI = 0;
FMLNetworkHandler.openGui(player, MainRegistry.instance, lastSelectedGUI, worldObj, xCoord, yCoord, zCoord);
}
@Override

View File

@ -105,12 +105,19 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
tanks[0].setTankType(fluid);
}
}
if(autoMode) { //power production depending on power requirement
//scales the slider proportionally to the power gauge
int powerSliderTarget = 60 - (int) (60 * power / maxPower);
if(autoMode) { //power production depending on power requirement and fuel level
int powerSliderTarget;
//when low on fuel, decrease consumption linearly
if(tanks[0].getFill() * 10 > tanks[0].getMaxFill()) {
powerSliderTarget = 60 - (int) (60 * power / maxPower); //scales the slider proportionally to the power gauge
}
else {
powerSliderTarget = (int) ( tanks[0].getFill() * 0.0001 * (60 - (int) (60 * power / maxPower)) );
}
if(powerSliderTarget > powerSliderPos) { //makes the auto slider slide instead of snapping into position
powerSliderPos++;
}

View File

@ -1033,7 +1033,7 @@ desc.gui.rtg.pellets=Accepted Pellets:
desc.gui.rtg.pelletHeat=%s (%s heat)
desc.gui.rtg.pelletPower=%s (%s HE/tick)
desc.gui.template=§9Templates§r$Templates can be made by$using the Machine Template Folder.
desc.gui.turbinegas.automode=§2Automatic Turbine Throttling Mode§r$By clicking the "AUTO" button, the turbine$will automatically adjust the power production$based on the power required from the network
desc.gui.turbinegas.automode=§2Automatic turbine throttling mode§r$By clicking the "AUTO" button, the turbine$will automatically adjust the throttle position$based on the power required from the network$and the fuel level in the internal tank
desc.gui.turbinegas.fuels=§6Accepted fuels:§r
desc.gui.turbinegas.warning=§cFuel or lubricant level low!§r
desc.gui.zirnox.coolant=§3Coolant§r$CO2 transfers heat from the core to the water.$This will boil it into super dense steam.$The efficiency of cooling and steam production$is based on pressure.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 35 KiB