Holo sign shape

This commit is contained in:
DBotThePony 2023-01-28 18:48:53 +07:00
parent 903cb30c8e
commit cb433871be
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 33 additions and 1 deletions

View File

@ -601,4 +601,18 @@ public class BlockShapes {
new SimpleCuboid(0.4375d, 0.8125d, 1d, 0.5625d, 0.9375d, 1d),
new SimpleCuboid(0.4375d, 0.8125d, 0d, 0.5625d, 0.9375d, 0d)
);
public static final BlockShape HOLO_SIGN = new BlockShape(
new SimpleCuboid(0d, 0d, 0.875d, 1d, 1d, 1d),
new SimpleCuboid(0.0625d, 0.0625d, 0.8125d, 0.9375d, 0.9375d, 0.875d),
new SimpleCuboid(0d, 0d, 0.625d, 1d, 1d, 0.8125d),
new SimpleCuboid(0.875d, 0.3125d, 0.5625d, 1d, 0.6875d, 0.625d),
new SimpleCuboid(0d, 0.3125d, 0.5625d, 0.125d, 0.6875d, 0.625d),
new SimpleCuboid(0.0625d, 0.875d, 0.625d, 0.125d, 0.9375d, 0.625d),
new SimpleCuboid(0.0625d, 0.0625d, 0.625d, 0.125d, 0.125d, 0.625d),
new SimpleCuboid(0.875d, 0.0625d, 0.625d, 0.9375d, 0.125d, 0.625d),
new SimpleCuboid(0.875d, 0.875d, 0.625d, 0.9375d, 0.9375d, 0.625d),
new SimpleCuboid(0.875d, 0.375d, 0.5625d, 0.875d, 0.625d, 0.625d),
new SimpleCuboid(0.125d, 0.375d, 0.5625d, 0.125d, 0.625d, 0.625d)
);
}

View File

@ -1,11 +1,16 @@
package ru.dbotthepony.mc.otm.block.decorative
import net.minecraft.core.BlockPos
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.EntityBlock
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.state.BlockState
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.entity.decorative.HoloSignBlockEntity
import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes
class HoloSignBlock : RotatableMatteryBlock(), EntityBlock {
override val hasFreeRotation: Boolean
@ -14,4 +19,17 @@ class HoloSignBlock : RotatableMatteryBlock(), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return HoloSignBlockEntity(p_153215_, p_153216_)
}
private val shapes = getShapeForEachState {
BlockShapes.HOLO_SIGN.rotateInv(it[FACING_FULL]).computeShape()
}
override fun getShape(
pState: BlockState,
pLevel: BlockGetter,
pPos: BlockPos,
pContext: CollisionContext
): VoxelShape {
return shapes[pState]!!
}
}

View File

@ -26,7 +26,7 @@ class HoloSignRenderer(private val context: BlockEntityRendererProvider.Context)
) {
poseStack.pushPose()
poseStack.rotateWithBlockFacing(tile.blockState[RotatableMatteryBlock.FACING_FULL])
poseStack.translate(0.5f, 0.5f, -0.05f)
poseStack.translate(0.5f, 0.5f, 0.6f)
poseStack.scale(0.01f, 0.01f, 0.01f)
val sorse = DynamicBufferSource.WORLD