Less drains More

- Partially filled water cauldrons can no longer be drained by fluid pipes #6506 #6505
- Fixed forge capabilities on modded cauldron blocks getting ignored (?)
This commit is contained in:
simibubi 2024-07-16 12:37:02 +02:00
parent a5dc53ba5f
commit 08b5515068
3 changed files with 13 additions and 7 deletions

View file

@ -174,7 +174,7 @@ public class FluidPropagator {
if (PumpBlock.isPump(connectedState) && connectedState.getValue(PumpBlock.FACING) if (PumpBlock.isPump(connectedState) && connectedState.getValue(PumpBlock.FACING)
.getAxis() == side.getAxis()) .getAxis() == side.getAxis())
return false; return false;
if (VanillaFluidTargets.shouldPipesConnectTo(connectedState)) if (VanillaFluidTargets.canProvideFluidWithoutCapability(connectedState))
return true; return true;
if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite()) if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite())
&& !AllBlockTags.FAN_TRANSPARENT.matches(connectedState)) && !AllBlockTags.FAN_TRANSPARENT.matches(connectedState))

View file

@ -183,7 +183,7 @@ public class FluidPipeBlock extends PipeBlock implements SimpleWaterloggedBlock,
Direction direction) { Direction direction) {
if (FluidPropagator.hasFluidCapability(world, neighbourPos, direction.getOpposite())) if (FluidPropagator.hasFluidCapability(world, neighbourPos, direction.getOpposite()))
return true; return true;
if (VanillaFluidTargets.shouldPipesConnectTo(neighbour)) if (VanillaFluidTargets.canProvideFluidWithoutCapability(neighbour))
return true; return true;
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, neighbourPos, FluidTransportBehaviour.TYPE); FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, neighbourPos, FluidTransportBehaviour.TYPE);
BracketedBlockEntityBehaviour bracket = BracketedBlockEntityBehaviour bracket =

View file

@ -5,9 +5,9 @@ import static net.minecraft.world.level.block.state.properties.BlockStatePropert
import com.simibubi.create.AllFluids; import com.simibubi.create.AllFluids;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LayeredCauldronBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.Fluids;
@ -15,10 +15,14 @@ import net.minecraftforge.fluids.FluidStack;
public class VanillaFluidTargets { public class VanillaFluidTargets {
public static boolean shouldPipesConnectTo(BlockState state) { public static boolean canProvideFluidWithoutCapability(BlockState state) {
if (state.hasProperty(BlockStateProperties.LEVEL_HONEY)) if (state.hasProperty(BlockStateProperties.LEVEL_HONEY))
return true; return true;
if (state.is(BlockTags.CAULDRONS)) if (state.is(Blocks.CAULDRON))
return true;
if (state.is(Blocks.LAVA_CAULDRON))
return true;
if (state.is(Blocks.WATER_CAULDRON))
return true; return true;
return false; return false;
} }
@ -31,13 +35,15 @@ public class VanillaFluidTargets {
.getSource(), 250); .getSource(), 250);
} }
if (state.getBlock() == Blocks.LAVA_CAULDRON) { if (state.is(Blocks.LAVA_CAULDRON)) {
if (!simulate) if (!simulate)
level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3); level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3);
return new FluidStack(Fluids.LAVA, 1000); return new FluidStack(Fluids.LAVA, 1000);
} }
if (state.getBlock() == Blocks.WATER_CAULDRON) { if (state.is(Blocks.WATER_CAULDRON) && state.getBlock() instanceof LayeredCauldronBlock lcb) {
if (!lcb.isFull(state))
return FluidStack.EMPTY;
if (!simulate) if (!simulate)
level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3); level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3);
return new FluidStack(Fluids.WATER, 1000); return new FluidStack(Fluids.WATER, 1000);