Skip to content

Commit

Permalink
Less drains More
Browse files Browse the repository at this point in the history
- Partially filled water cauldrons can no longer be drained by fluid pipes #6506 #6505
- Fixed forge capabilities on modded cauldron blocks getting ignored (?)
  • Loading branch information
simibubi committed Jul 16, 2024
1 parent a5dc53b commit 08b5515
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static boolean isOpenEnd(BlockGetter reader, BlockPos pos, Direction side
if (PumpBlock.isPump(connectedState) && connectedState.getValue(PumpBlock.FACING)
.getAxis() == side.getAxis())
return false;
if (VanillaFluidTargets.shouldPipesConnectTo(connectedState))
if (VanillaFluidTargets.canProvideFluidWithoutCapability(connectedState))
return true;
if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite())
&& !AllBlockTags.FAN_TRANSPARENT.matches(connectedState))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static boolean canConnectTo(BlockAndTintGetter world, BlockPos neighbourP
Direction direction) {
if (FluidPropagator.hasFluidCapability(world, neighbourPos, direction.getOpposite()))
return true;
if (VanillaFluidTargets.shouldPipesConnectTo(neighbour))
if (VanillaFluidTargets.canProvideFluidWithoutCapability(neighbour))
return true;
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, neighbourPos, FluidTransportBehaviour.TYPE);
BracketedBlockEntityBehaviour bracket =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
import com.simibubi.create.AllFluids;

import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.Level;
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.properties.BlockStateProperties;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.fluids.FluidStack;

public class VanillaFluidTargets {

public static boolean shouldPipesConnectTo(BlockState state) {
public static boolean canProvideFluidWithoutCapability(BlockState state) {
if (state.hasProperty(BlockStateProperties.LEVEL_HONEY))
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 false;
}
Expand All @@ -31,13 +35,15 @@ public static FluidStack drainBlock(Level level, BlockPos pos, BlockState state,
.getSource(), 250);
}

if (state.getBlock() == Blocks.LAVA_CAULDRON) {
if (state.is(Blocks.LAVA_CAULDRON)) {
if (!simulate)
level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3);
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)
level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3);
return new FluidStack(Fluids.WATER, 1000);
Expand Down

0 comments on commit 08b5515

Please sign in to comment.