mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-14 16:26:35 +01:00
Added rotate method to Fluid Pipes
This commit is contained in:
parent
98952f9e48
commit
ffbc75abee
1 changed files with 20 additions and 0 deletions
|
@ -36,7 +36,9 @@ import net.minecraft.world.level.BlockGetter;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.PipeBlock;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -337,4 +339,22 @@ public class FluidPipeBlock extends PipeBlock
|
|||
public VoxelShape getOcclusionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
|
||||
return OCCLUSION_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
BlockState rotated = state;
|
||||
for (Direction direction : Iterate.horizontalDirections) {
|
||||
rotated = rotated.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(direction)), state.getValue(PROPERTY_BY_DIRECTION.get(direction)));
|
||||
}
|
||||
return rotated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState mirror(BlockState state, Mirror mirror) {
|
||||
BlockState mirrored = state;
|
||||
for (Direction direction : Iterate.horizontalDirections) {
|
||||
mirrored = mirrored.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(direction)), state.getValue(PROPERTY_BY_DIRECTION.get(direction)));
|
||||
}
|
||||
return mirrored;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue