Fixed wrong tank type. getInfo returns input tank type and setType also works with input tank type

This commit is contained in:
Toshayo 2025-05-08 22:29:32 +02:00
parent 03c5466c0e
commit be2edd87d8
No known key found for this signature in database
GPG Key ID: 7DC46644B561B1B4
3 changed files with 22 additions and 22 deletions

View File

@ -139,7 +139,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
if(operational) turnTimer = 25;
networkPackNT(150);
} else {
this.lastRotor = this.rotor;
@ -306,7 +306,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
}
@Callback(direct = true, limit = 4)

View File

@ -49,7 +49,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
public long power;
public FluidTank[] tanks;
protected double[] info = new double[3];
private boolean shouldTurn;
public float rotor;
public float lastRotor;
@ -57,7 +57,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
private AudioWrapper audio;
private float audioDesync;
//Configurable Values
public static long maxPower = 100000000;
public static int inputTankSize = 512_000;
@ -67,7 +67,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
public TileEntityMachineLargeTurbine() {
super(7);
tanks = new FluidTank[2];
tanks[0] = new FluidTank(Fluids.STEAM, inputTankSize);
tanks[1] = new FluidTank(Fluids.SPENTSTEAM, outputTankSize);
@ -107,11 +107,11 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.info = new double[3];
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
this.tryProvide(worldObj, xCoord + dir.offsetX * -4, yCoord, zCoord + dir.offsetZ * -4, dir.getOpposite());
for(DirPos pos : getConPos()) this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
@ -144,7 +144,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
}
if(!valid) tanks[1].setTankType(Fluids.NONE);
if(power > maxPower) power = maxPower;
tanks[1].unloadTank(5, 6, slots);
this.networkPackNT(50);
@ -152,12 +152,12 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
} else {
this.lastRotor = this.rotor;
this.rotor += this.fanAcceleration;
if(this.rotor >= 360) {
this.rotor -= 360;
this.lastRotor -= 360;
}
if(shouldTurn) {
// Fan accelerates with a random offset to ensure the audio doesn't perfectly align, makes for a more pleasant hum
this.fanAcceleration = Math.max(0F, Math.min(15F, this.fanAcceleration += 0.075F + audioDesync));
@ -172,7 +172,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
audio.updatePitch(0.25F + 0.75F * turbineSpeed);
} else {
this.fanAcceleration = Math.max(0F, Math.min(15F, this.fanAcceleration -= 0.1F));
if(audio != null) {
if(this.fanAcceleration > 0) {
float turbineSpeed = this.fanAcceleration / 15F;
@ -186,7 +186,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
}
}
}
protected DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
@ -214,11 +214,11 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
tanks[0].deserialize(buf);
tanks[1].deserialize(buf);
}
public long getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
@ -226,7 +226,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
tanks[1].readFromNBT(nbt, "steam");
power = nbt.getLong("power");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
@ -249,12 +249,12 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
public long getMaxPower() {
return this.maxPower;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
@ -281,11 +281,11 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
public String getComponentName() {
return "ntm_turbine";
}
@Override
public void onChunkUnload() {
super.onChunkUnload();
if(audio != null) {
audio.stopSound();
audio = null;
@ -311,7 +311,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
}
@Callback(direct = true, limit = 4)

View File

@ -364,7 +364,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
}
@Callback(direct = true, limit = 4)