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

View File

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

View File

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