From 85ddd02e741233840ba155e45192dbdab822d6b1 Mon Sep 17 00:00:00 2001 From: Reece Mackie <20544390+Rover656@users.noreply.github.com> Date: Sat, 29 Jul 2023 00:22:38 +0100 Subject: [PATCH 1/2] Convert to our own XP fluid always. Could also convert to whatever xp fluid is already in the tank, but it makes very little difference tbh. --- .../common/blockentity/SoulBinderBlockEntity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java b/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java index 193ab81e51..412f15447b 100644 --- a/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java +++ b/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java @@ -131,10 +131,13 @@ protected void onContentsChanged() { @Override public int fill(FluidStack resource, FluidAction action) { - if (!this.getFluid().getFluid().isSame(EIOFluids.XP_JUICE.getSource()) && this.isFluidValid(resource)) { // Auto convert to own fluid (source) type - resource = new FluidStack(EIOFluids.XP_JUICE.getSource(), resource.getAmount()); + // Convert into XP Juice + if (this.isFluidValid(resource)) { + return super.fill(new FluidStack(EIOFluids.XP_JUICE.getSource(), resource.getAmount()), action); } - return super.fill(resource, action); + + // Non-XP is not allowed. + return 0; } }; } From dffa9ecfea30c802c631e7fe5aa725f3bbacc357 Mon Sep 17 00:00:00 2001 From: Reece Mackie <20544390+Rover656@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:07:13 +0100 Subject: [PATCH 2/2] Convert to existing fluid rather than force to juice --- .../common/blockentity/SoulBinderBlockEntity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java b/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java index 412f15447b..d185ab7da3 100644 --- a/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java +++ b/src/machines/java/com/enderio/machines/common/blockentity/SoulBinderBlockEntity.java @@ -29,6 +29,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.templates.FluidTank; @@ -133,7 +134,12 @@ protected void onContentsChanged() { public int fill(FluidStack resource, FluidAction action) { // Convert into XP Juice if (this.isFluidValid(resource)) { - return super.fill(new FluidStack(EIOFluids.XP_JUICE.getSource(), resource.getAmount()), action); + var currentFluid = this.getFluid().getFluid(); + if (currentFluid == Fluids.EMPTY || resource.getFluid().isSame(currentFluid)) { + return super.fill(resource, action); + } else { + return super.fill(new FluidStack(currentFluid, resource.getAmount()), action); + } } // Non-XP is not allowed.