Skip to content

Commit c9220ea

Browse files
committed
Fix electric pump not draining heavy water source blocks from the world
1 parent 943d9d7 commit c9220ea

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/main/java/mekanism/common/tile/machine/TileEntityElectricPump.java

+9-15
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,9 @@ private boolean suck(BlockPos pos, boolean hasFilter, boolean addRecurring) {
194194
if (!fluidState.isEmpty() && fluidState.isSource()) {
195195
//Just in case someone does weird things and has a fluid state that is empty and a source
196196
// only allow collecting from non empty sources
197-
Fluid fluid = fluidState.getFluid();
198-
FluidStack fluidStack = new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME);
199-
if (hasFilter && fluid == Fluids.WATER) {
200-
fluid = MekanismFluids.HEAVY_WATER.getStillFluid();
197+
Fluid sourceFluid = fluidState.getFluid();
198+
FluidStack fluidStack = new FluidStack(sourceFluid, FluidAttributes.BUCKET_VOLUME);
199+
if (hasFilter && sourceFluid == Fluids.WATER) {
201200
fluidStack = MekanismFluids.HEAVY_WATER.getFluidStack(10);
202201
}
203202
//Note: we get the block state from the world and not the fluid state
@@ -214,21 +213,20 @@ private boolean suck(BlockPos pos, boolean hasFilter, boolean addRecurring) {
214213
}
215214
} else if (block instanceof IBucketPickupHandler && validFluid(fluidStack, false)) {
216215
//If it can be picked up by a bucket and we actually want to pick it up, do so to update the fluid type we are doing
217-
if (shouldTake(fluid)) {
218-
//Note we only attempt taking if we should take the fluid type
216+
if (sourceFluid != Fluids.WATER || MekanismConfig.general.pumpWaterSources.get()) {
217+
//Note we only attempt taking if it is not water, or we want to pump water sources
219218
// otherwise we assume the type from the fluid state is correct
220-
fluid = ((IBucketPickupHandler) block).pickupFluid(world, pos, blockState);
219+
sourceFluid = ((IBucketPickupHandler) block).pickupFluid(world, pos, blockState);
221220
//Update the fluid stack in case something somehow changed about the type
222221
// making sure that we replace to heavy water if we got heavy water
223-
if (hasFilter && fluid == Fluids.WATER) {
224-
fluid = MekanismFluids.HEAVY_WATER.getStillFluid();
222+
if (hasFilter && sourceFluid == Fluids.WATER) {
225223
fluidStack = MekanismFluids.HEAVY_WATER.getFluidStack(10);
226224
} else {
227-
fluidStack = new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME);
225+
fluidStack = new FluidStack(sourceFluid, FluidAttributes.BUCKET_VOLUME);
228226
}
229227
if (!validFluid(fluidStack, false)) {
230228
Mekanism.logger.warn("Fluid removed without successfully picking up. Fluid {} at {} in {} was valid, but after picking up was {}.",
231-
fluidState.getFluid(), pos, world, fluid);
229+
fluidState.getFluid(), pos, world, sourceFluid);
232230
return false;
233231
}
234232
}
@@ -266,10 +264,6 @@ public void reset() {
266264
recurringNodes.clear();
267265
}
268266

269-
private boolean shouldTake(@Nonnull Fluid fluid) {
270-
return fluid != Fluids.WATER && fluid != MekanismFluids.HEAVY_WATER.getStillFluid() || MekanismConfig.general.pumpWaterSources.get();
271-
}
272-
273267
@Nonnull
274268
@Override
275269
public CompoundNBT write(@Nonnull CompoundNBT nbtTags) {

0 commit comments

Comments
 (0)