essence storage block shape

оно компилится и похуй
This commit is contained in:
YuRaNnNzZZ 2023-03-19 19:05:20 +03:00
parent 8c3eabb3bd
commit 198c9b4aa3
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
3 changed files with 32 additions and 21 deletions

View File

@ -622,4 +622,15 @@ public class BlockShapes {
new SimpleCuboid(0.0625d, 0.375d, 0.0625d, 0.25d, 0.9375d, 0.9375d), new SimpleCuboid(0.0625d, 0.375d, 0.0625d, 0.25d, 0.9375d, 0.9375d),
new SimpleCuboid(0.75d, 0.375d, 0.0625d, 0.9375d, 0.9375d, 0.9375d) new SimpleCuboid(0.75d, 0.375d, 0.0625d, 0.9375d, 0.9375d, 0.9375d)
); );
public static final BlockShape ESSENCE_STORAGE = new BlockShape(
new SimpleCuboid(0d, 0d, 0d, 1d, 0.125d, 1d),
new SimpleCuboid(0d, 0.1875d, 0d, 1d, 0.3125d, 1d),
new SimpleCuboid(0.5625d, 0.3125d, 0d, 1d, 1d, 0.875d),
new SimpleCuboid(0d, 0.625d, 0.875d, 1d, 1d, 1d),
new SimpleCuboid(0d, 0.3125d, 0.5625d, 0.5625d, 1d, 0.875d),
new SimpleCuboid(0.0625d, 0.125d, 0.0625d, 0.9375d, 0.1875d, 0.9375d),
new SimpleCuboid(0.0625d, 0.3125d, 0.875d, 0.9375d, 0.625d, 0.9375d),
new SimpleCuboid(0.0625d, 0.3125d, 0.0625d, 0.5625d, 0.9375d, 0.5625d)
);
} }

View File

@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.InteractionHand import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level import net.minecraft.world.level.Level
import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.EntityBlock
import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.block.entity.BlockEntity
@ -11,9 +12,14 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.BlockHitResult import net.minecraft.world.phys.BlockHitResult
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.shapes.BlockShapes
class EssenceStorageBlock : RotatableMatteryBlock(), EntityBlock { class EssenceStorageBlock : RotatableMatteryBlock(), EntityBlock {
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
@ -36,4 +42,16 @@ class EssenceStorageBlock : RotatableMatteryBlock(), EntityBlock {
return super.use(blockState, level, blockPos, ply, hand, blockHitResult) return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
} }
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ESSENCE_STORAGE.rotateFromNorth(it[rotationProperty]).computeShape() }
@Suppress("override_deprecation")
override fun getShape(
state: BlockState,
blockGetter: BlockGetter,
pos: BlockPos,
context: CollisionContext
): VoxelShape {
return shapes[state]!!
}
} }

View File

@ -83,7 +83,6 @@
"from": [1, 5, 14], "from": [1, 5, 14],
"to": [15, 10, 15], "to": [15, 10, 15],
"faces": { "faces": {
"north": {"uv": [0, 0, 7, 1.25], "texture": "#missing"},
"east": {"uv": [15.5, 10.5, 16, 11.75], "texture": "#0"}, "east": {"uv": [15.5, 10.5, 16, 11.75], "texture": "#0"},
"south": {"uv": [8.5, 10.5, 15.5, 11.75], "texture": "#0"}, "south": {"uv": [8.5, 10.5, 15.5, 11.75], "texture": "#0"},
"west": {"uv": [8, 10.5, 8.5, 11.75], "texture": "#0"} "west": {"uv": [8, 10.5, 8.5, 11.75], "texture": "#0"}
@ -91,20 +90,12 @@
}, },
{ {
"name": "container", "name": "container",
"from": [1, 15, 1], "from": [1, 5, 1],
"to": [9, 15, 9], "to": [9, 15, 9],
"faces": {
"up": {"uv": [8, 0, 12, 2], "texture": "#0"},
"down": {"uv": [8, 0, 12, 2], "texture": "#0"}
}
},
{
"name": "container",
"from": [1, 5, 1],
"to": [9, 15, 1],
"faces": { "faces": {
"north": {"uv": [8, 2, 12, 4.5], "texture": "#0"}, "north": {"uv": [8, 2, 12, 4.5], "texture": "#0"},
"south": {"uv": [8, 2, 12, 4.5], "texture": "#0"} "west": {"uv": [8, 2, 12, 4.5], "texture": "#0"},
"up": {"uv": [8, 0, 12, 2], "texture": "#0"}
} }
}, },
{ {
@ -119,15 +110,6 @@
"up": {"uv": [9.5, 12.5, 13, 14.25], "texture": "#0"} "up": {"uv": [9.5, 12.5, 13, 14.25], "texture": "#0"}
}, },
"forge_data": { "block_light": 15, "sky_light": 15 } "forge_data": { "block_light": 15, "sky_light": 15 }
},
{
"name": "container",
"from": [1, 5, 1],
"to": [1, 15, 9],
"faces": {
"east": {"uv": [8, 2, 12, 4.5], "texture": "#0"},
"west": {"uv": [8, 2, 12, 4.5], "texture": "#0"}
}
} }
], ],
"display": { "display": {