mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 11:13:41 +01:00
The less handsome Basin
- Fluid networks can now pull lava and water from filled cauldrons
This commit is contained in:
parent
8cf03e3845
commit
4708dcfca9
4 changed files with 56 additions and 10 deletions
|
@ -11,6 +11,7 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.content.contraptions.fluids.PipeConnection.Flow;
|
||||
import com.simibubi.create.content.contraptions.fluids.pipes.AxisPipeBlock;
|
||||
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
|
||||
import com.simibubi.create.content.contraptions.fluids.pipes.VanillaFluidTargets;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
|
@ -159,7 +160,7 @@ public class FluidPropagator {
|
|||
if (PumpBlock.isPump(connectedState) && connectedState.getValue(PumpBlock.FACING)
|
||||
.getAxis() == side.getAxis())
|
||||
return false;
|
||||
if (connectedState.hasProperty(BlockStateProperties.LEVEL_HONEY))
|
||||
if (VanillaFluidTargets.shouldPipesConnectTo(connectedState))
|
||||
return true;
|
||||
if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite()))
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.fluids;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.LEVEL_HONEY;
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -9,6 +8,7 @@ import java.util.List;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.content.contraptions.fluids.pipes.VanillaFluidTargets;
|
||||
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
|
@ -30,7 +30,6 @@ import net.minecraft.world.item.alchemy.PotionUtils;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
@ -132,12 +131,9 @@ public class OpenEndedPipe extends FlowSource {
|
|||
FluidState fluidState = state.getFluidState();
|
||||
boolean waterlog = state.hasProperty(WATERLOGGED);
|
||||
|
||||
if (state.hasProperty(BlockStateProperties.LEVEL_HONEY) && state.getValue(LEVEL_HONEY) >= 5) {
|
||||
if (!simulate)
|
||||
world.setBlock(outputPos, state.setValue(LEVEL_HONEY, 0), 3);
|
||||
return new FluidStack(AllFluids.HONEY.get()
|
||||
.getSource(), 250);
|
||||
}
|
||||
FluidStack drainBlock = VanillaFluidTargets.drainBlock(world, outputPos, state, simulate);
|
||||
if (!drainBlock.isEmpty())
|
||||
return drainBlock;
|
||||
|
||||
if (!waterlog && !state.getMaterial()
|
||||
.isReplaceable())
|
||||
|
|
|
@ -168,7 +168,7 @@ public class FluidPipeBlock extends PipeBlock implements SimpleWaterloggedBlock,
|
|||
Direction direction) {
|
||||
if (FluidPropagator.hasFluidCapability(world, neighbourPos, direction.getOpposite()))
|
||||
return true;
|
||||
if (neighbour.hasProperty(BlockStateProperties.LEVEL_HONEY))
|
||||
if (VanillaFluidTargets.shouldPipesConnectTo(neighbour))
|
||||
return true;
|
||||
FluidTransportBehaviour transport = TileEntityBehaviour.get(world, neighbourPos, FluidTransportBehaviour.TYPE);
|
||||
BracketedTileEntityBehaviour bracket =
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.simibubi.create.content.contraptions.fluids.pipes;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.LEVEL_HONEY;
|
||||
|
||||
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.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) {
|
||||
if (state.hasProperty(BlockStateProperties.LEVEL_HONEY))
|
||||
return true;
|
||||
if (state.is(BlockTags.CAULDRONS))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static FluidStack drainBlock(Level level, BlockPos pos, BlockState state, boolean simulate) {
|
||||
if (state.hasProperty(BlockStateProperties.LEVEL_HONEY) && state.getValue(LEVEL_HONEY) >= 5) {
|
||||
if (!simulate)
|
||||
level.setBlock(pos, state.setValue(LEVEL_HONEY, 0), 3);
|
||||
return new FluidStack(AllFluids.HONEY.get()
|
||||
.getSource(), 250);
|
||||
}
|
||||
|
||||
if (state.getBlock() == 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 (!simulate)
|
||||
level.setBlock(pos, Blocks.CAULDRON.defaultBlockState(), 3);
|
||||
return new FluidStack(Fluids.WATER, 1000);
|
||||
}
|
||||
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue