Fixed Crucible bug where pending solids could be converted to another fluid while tank was empty
Closes #180
This commit is contained in:
parent
3a532ff569
commit
fecf69353e
|
|
@ -1,5 +1,7 @@
|
|||
## Ex Deorum 3.11
|
||||
- Fixed End Cakes crashing fake players (#178)
|
||||
- Fixed Compressed Sieves not allowing simultaneous insertion of material even when Simultaneous Compressed Sieve Usage was enabled
|
||||
- Fixed Crucible bug where pending solids could be converted to another fluid while tank was empty (#180)
|
||||
|
||||
## Ex Deorum 3.10
|
||||
- Now requires KubeJS 7.2 to fix incompatibility (#158)
|
||||
|
|
|
|||
|
|
@ -208,10 +208,11 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
var result = recipe.getResult();
|
||||
var contained = this.tank.getFluid();
|
||||
var hadPendingSolids = this.solids > 0;
|
||||
shrinkAction.accept(item);
|
||||
this.solids = (short) Math.min(this.solids + result.getAmount(), MAX_SOLIDS);
|
||||
|
||||
if (contained.isEmpty()) {
|
||||
if (contained.isEmpty() && !hadPendingSolids) {
|
||||
this.fluid = result.getFluid();
|
||||
updateLight(this.level, this.worldPosition, this.fluid);
|
||||
}
|
||||
|
|
@ -242,7 +243,7 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
var result = recipe.getResult();
|
||||
var contained = this.tank.getFluid();
|
||||
|
||||
if (FluidStack.isSameFluidSameComponents(result, contained) || contained.isEmpty()) {
|
||||
if (FluidStack.isSameFluidSameComponents(result, contained) || (contained.isEmpty() && canAddToPendingFluid(result))) {
|
||||
return result.getAmount() + this.solids <= MAX_SOLIDS ? InsertionResult.YES : InsertionResult.FULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -250,6 +251,10 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
return InsertionResult.NO;
|
||||
}
|
||||
|
||||
private boolean canAddToPendingFluid(FluidStack result) {
|
||||
return this.solids == 0 || this.fluid == null || result.getFluid() == this.fluid;
|
||||
}
|
||||
|
||||
public abstract int getMeltingRate();
|
||||
|
||||
public int getSolids() {
|
||||
|
|
@ -304,7 +309,7 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
}
|
||||
|
||||
private static class FluidHandler extends FluidHelper {
|
||||
private class FluidHandler extends FluidHelper {
|
||||
public FluidHandler() {
|
||||
super(MAX_FLUID_CAPACITY);
|
||||
}
|
||||
|
|
@ -313,6 +318,16 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
public boolean isFluidValid(FluidStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onContentsChanged() {
|
||||
if (this.fluid.isEmpty() && AbstractCrucibleBlockEntity.this.solids == 0) {
|
||||
AbstractCrucibleBlockEntity.this.fluid = null;
|
||||
}
|
||||
|
||||
updateLight(AbstractCrucibleBlockEntity.this.level, AbstractCrucibleBlockEntity.this.worldPosition, this.fluid.getFluid());
|
||||
AbstractCrucibleBlockEntity.this.markUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
// inner class
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user