fixed pipes connecting too late

This commit is contained in:
Ellpeck 2020-04-16 20:03:18 +02:00
parent 046637a1b5
commit 23462bbe00

View file

@ -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) {