mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Implemented ITransformableBlock for Fluid Pipes
This commit is contained in:
parent
ffbc75abee
commit
db51dd1d3d
1 changed files with 20 additions and 1 deletions
|
@ -7,6 +7,8 @@ import javax.annotation.Nullable;
|
|||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ITransformableBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
|
||||
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.contraptions.relays.elementary.BracketedTileEntityBehaviour;
|
||||
|
@ -53,7 +55,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import net.minecraft.world.ticks.TickPriority;
|
||||
|
||||
public class FluidPipeBlock extends PipeBlock
|
||||
implements SimpleWaterloggedBlock, IWrenchableWithBracket, ITE<FluidPipeTileEntity>, EncasableBlock {
|
||||
implements SimpleWaterloggedBlock, IWrenchableWithBracket, ITE<FluidPipeTileEntity>, EncasableBlock, ITransformableBlock {
|
||||
|
||||
private static final VoxelShape OCCLUSION_BOX = Block.box(4, 4, 4, 12, 12, 12);
|
||||
|
||||
|
@ -357,4 +359,21 @@ public class FluidPipeBlock extends PipeBlock
|
|||
}
|
||||
return mirrored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState transform(BlockState state, StructureTransform transform) {
|
||||
if (transform.mirror != null) {
|
||||
state = mirror(state, transform.mirror);
|
||||
}
|
||||
|
||||
if (transform.rotationAxis == Direction.Axis.Y) {
|
||||
return rotate(state, transform.rotation);
|
||||
}
|
||||
|
||||
BlockState rotated = state;
|
||||
for (Direction direction : Iterate.directionsInAxis(transform.rotationAxis)) {
|
||||
rotated = rotated.setValue(PROPERTY_BY_DIRECTION.get(transform.rotateFacing(direction)), state.getValue(PROPERTY_BY_DIRECTION.get(direction)));
|
||||
}
|
||||
return rotated;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue