i want to combust

This commit is contained in:
Adam 2022-06-21 18:02:52 +02:00 committed by GitHub
parent 879741a17c
commit c8c9d4af7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,8 +27,9 @@ public class TileEntityMachineElectricFurnace extends TileEntityLoadedBase imple
public int dualCookTime; public int dualCookTime;
public long power; public long power;
public static final long maxPower = 100000; public static final long maxPower = 100000;
public int processingSpeed = 100; public int MaxProgress = 100;
int consumption = 50; int consumption = 50;
int progress = 100;
private static final int[] slots_top = new int[] {1}; private static final int[] slots_top = new int[] {1};
private static final int[] slots_bottom = new int[] {2, 0}; private static final int[] slots_bottom = new int[] {2, 0};
@ -202,6 +203,10 @@ public class TileEntityMachineElectricFurnace extends TileEntityLoadedBase imple
return false; return false;
} }
public int getDiFurnaceProgressScaled(int i) {
return (dualCookTime * i) / MaxProgress;
}
public long getPowerRemainingScaled(long i) { public long getPowerRemainingScaled(long i) {
return (power * i) / maxPower; return (power * i) / maxPower;
} }
@ -279,25 +284,35 @@ public class TileEntityMachineElectricFurnace extends TileEntityLoadedBase imple
this.updateConnections(); this.updateConnections();
this.consumption = 50; this.consumption = 50;
this.processingSpeed = 100; this.progress = 100;
UpgradeManager.eval(slots, 3, 3); UpgradeManager.eval(slots, 3, 3);
int speedLevel = UpgradeManager.getLevel(UpgradeType.SPEED); int speedLevel = UpgradeManager.getLevel(UpgradeType.SPEED);
int powerLevel = UpgradeManager.getLevel(UpgradeType.POWER); int powerLevel = UpgradeManager.getLevel(UpgradeType.POWER);
processingSpeed -= speedLevel * 25; progress -= speedLevel * 25;
consumption += speedLevel * 50; consumption += speedLevel * 50;
processingSpeed += powerLevel * 10; progress += powerLevel * 10;
consumption -= powerLevel * 20; consumption -= powerLevel * 20;
this.MaxProgress = progress;
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("powerTime", this.power);
data.setInteger("progress", this.progress);
data.setInteger("cookTime", dualCookTime);
this.networkPack(data, 50);
{
if(hasPower() && canProcess()) if(hasPower() && canProcess())
{ {
dualCookTime++; dualCookTime++;
power -= consumption; power -= consumption;
if(this.dualCookTime == processingSpeed) if(this.dualCookTime == MaxProgress)
{ {
this.dualCookTime = 0; this.dualCookTime = 0;
this.processItem(); this.processItem();
@ -322,8 +337,6 @@ public class TileEntityMachineElectricFurnace extends TileEntityLoadedBase imple
power = Library.chargeTEFromItems(slots, 0, power, maxPower); power = Library.chargeTEFromItems(slots, 0, power, maxPower);
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, dualCookTime, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
} }
@ -333,14 +346,21 @@ public class TileEntityMachineElectricFurnace extends TileEntityLoadedBase imple
} }
} }
private void networkPack(NBTTagCompound data, int i) {
// TODO Auto-generated method stub
}
private void updateConnections() { private void updateConnections() {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
} }
public int getDiFurnaceProgressScaled(int i) { public void networkUnpack(NBTTagCompound nbt) {
return (dualCookTime * i) / processingSpeed; this.power = nbt.getLong("power");
this.MaxProgress = nbt.getInteger("MaxProgress");
this.progress = nbt.getInteger("progress");
} }
@Override @Override