From 23462bbe00381e7395a81ce45d5de7f5fa53964c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 16 Apr 2020 20:03:18 +0200 Subject: [PATCH] fixed pipes connecting too late --- src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java index fa3fc5c..2179b13 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java @@ -23,6 +23,7 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.items.CapabilityItemHandler; @@ -88,6 +89,14 @@ public class PipeBlock extends ContainerBlock { } } + @Override + public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { + ConnectionType type = getConnectionType((World) worldIn, currentPos, facing, stateIn); + if (type != stateIn.get(DIRECTIONS.get(facing))) + stateIn = stateIn.with(DIRECTIONS.get(facing), type); + return stateIn; + } + @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) {