@@ -13,6 +13,7 @@ import net.minecraft.block.ShapeContext
1313import net.minecraft.entity.ItemEntity
1414import net.minecraft.item.ItemStack
1515import net.minecraft.nbt.NbtCompound
16+ import net.minecraft.network.packet.s2c.play.EntityS2CPacket.Rotate
1617import net.minecraft.sound.SoundCategory
1718import net.minecraft.util.math.Direction
1819import net.minecraft.util.math.MathHelper
@@ -28,7 +29,19 @@ class CrossingGateAttachment(container: AttachmentContainerBlockEntity) : Activa
2829 private var inMotion = false
2930
3031 companion object {
31- val shape = VoxelShapes .cuboid(7.0 / 16.0 , 7.0 / 16.0 , 7.0 / 16.0 , 9.0 / 16.0 , 9.0 / 16.0 , 9.0 / 16.0 )
32+ // val shape =
33+ }
34+
35+ fun getShape (open : Boolean ): VoxelShape {
36+ val shape = VoxelShapes .union(
37+ VoxelShapes .cuboid(7.0 / 16.0 , 5.0 / 16.0 , 6.5 / 16.0 , 9.0 / 16.0 , 7.5 / 16.0 , 9.0 / 16.0 ),
38+ VoxelShapes .cuboid(6.0 / 16.0 , 0.0 , 5.5 / 16.0 , 10.0 / 16.0 , 5 / 16.0 , 10.0 / 16.0 ),
39+ VoxelShapes .cuboid(7.0 / 16.0 , 7.5 / 16.0 , 6.5 / 16.0 , 12.75 / 16.0 , 12 / 16.0 , 8.5 / 16.0 ),
40+ VoxelShapes .cuboid(10.75 / 16.0 , 12 / 16.0 , 6.5 / 16.0 , 12.75 / 16.0 , 15 / 16.0 , 8.5 / 16.0 ),
41+ VoxelShapes .cuboid(10.75 / 16.0 , 15 / 16.0 , 7 / 16.0 , 12.75 / 16.0 , 16 / 16.0 , 8 / 16.0 ),
42+ )
43+
44+ return if (open) RotateVoxelShape .rotateVoxelShape(RotateVoxelShape .rotateVoxelShape(shape, Direction .DOWN , Direction .NORTH ), Direction .WEST , Direction .UP ) else shape
3245 }
3346
3447 override fun writeNBT (nbt : NbtCompound ) {
@@ -58,7 +71,7 @@ class CrossingGateAttachment(container: AttachmentContainerBlockEntity) : Activa
5871 val depthOffset = this .container.getDepthOffset()
5972
6073 return RotateVoxelShape .offsetFromDirectionXZ(
61- RotateVoxelShape .rotateVoxelShape(shape , Direction .NORTH , this .facing),
74+ RotateVoxelShape .rotateVoxelShape(getShape( this .isActive()) , Direction .NORTH , if ( this .isActive()) this .facing.opposite else this .facing),
6275 facing,
6376 Vector3d (0.0 , 0.0 , - depthOffset - BeaconAttachment .HALF ),
6477 Vector3d (depthOffset + BeaconAttachment .HALF , 0.0 , 0.0 ),
0 commit comments