diff --git a/build.gradle b/build.gradle index c153a70f..6965ef21 100644 --- a/build.gradle +++ b/build.gradle @@ -146,6 +146,8 @@ dependencies { modImplementation("curse.maven:cyclic-239286:4994392") modImplementation("curse.maven:flib-661261:4724762") modImplementation("curse.maven:thirst-was-taken-679270:6660408") + modImplementation("curse.maven:tinkers-construct-74072:7449219") + modImplementation("curse.maven:mantel-74924:7563777") // DEV ONLY compileOnly('org.jetbrains:annotations:23.0.0') diff --git a/changelog.md b/changelog.md index aceb681d..6f93ebe4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## Ex Deorum 1.50 +- Fixed Crucible bug where pending solids could be converted to another fluid while tank was empty (#180) + ## Ex Deorum 1.49 - Fixed more issues with _Thirst Was Taken_, thanks to pawjwp (#170) - Fixed Dust not having a map color (#169) diff --git a/src/main/java/thedarkcolour/exdeorum/blockentity/AbstractCrucibleBlockEntity.java b/src/main/java/thedarkcolour/exdeorum/blockentity/AbstractCrucibleBlockEntity.java index 99869e7e..e79c3de2 100644 --- a/src/main/java/thedarkcolour/exdeorum/blockentity/AbstractCrucibleBlockEntity.java +++ b/src/main/java/thedarkcolour/exdeorum/blockentity/AbstractCrucibleBlockEntity.java @@ -202,10 +202,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(); this.needsLightUpdate = true; } @@ -234,12 +235,16 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity { var result = recipe.getResult(); var contained = this.tank.getFluid(); - return (result.isFluidEqual(contained) || contained.isEmpty()) && result.getAmount() + this.solids <= MAX_SOLIDS; + return (result.isFluidEqual(contained) || (contained.isEmpty() && canAddToPendingFluid(result))) && result.getAmount() + this.solids <= MAX_SOLIDS; } return false; } + private boolean canAddToPendingFluid(FluidStack result) { + return this.solids == 0 || this.fluid == null || result.getFluid() == this.fluid; + } + public abstract int getMeltingRate(); public int getSolids() { @@ -296,7 +301,7 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity { } } - private static class FluidHandler extends FluidHelper { + private class FluidHandler extends FluidHelper { public FluidHandler() { super(MAX_FLUID_CAPACITY); } @@ -305,6 +310,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; + } + + AbstractCrucibleBlockEntity.this.needsLightUpdate = true; + AbstractCrucibleBlockEntity.this.markUpdated(); + } } // inner class