окно в европу

This commit is contained in:
YuRaNnNzZZ 2023-04-10 16:58:51 +03:00
parent 0bbe07f921
commit 3870428f5d
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
2 changed files with 26 additions and 0 deletions

View File

@ -649,4 +649,12 @@ public class BlockShapes {
new SimpleCuboid(0.36875d, 0.65625d, 0.5875d, 0.44375d, 0.78125d, 0.9d),
new SimpleCuboid(0.4375d, 0.5d, 0.1875d, 0.5625d, 0.625d, 0.3125d)
);
public static final BlockShape FLUID_TANK = new BlockShape(
new SimpleCuboid(0d, 0d, 0d, 1d, 0.125d, 1d),
new SimpleCuboid(0d, 0.875d, 0d, 1d, 1d, 1d),
new SimpleCuboid(0.03125d, 0.125d, 0.03125d, 0.96875d, 0.1875d, 0.96875d),
new SimpleCuboid(0.03125d, 0.8125d, 0.03125d, 0.96875d, 0.875d, 0.96875d),
new SimpleCuboid(0d, 0.1875d, 0d, 1d, 0.8125d, 1d)
);
}

View File

@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.EntityBlock
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.state.BlockState
import net.minecraft.world.phys.BlockHitResult
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape
import net.minecraftforge.fluids.FluidUtil
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
import ru.dbotthepony.mc.otm.block.entity.decorative.FluidTankBlockEntity
import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes
class FluidTankBlock : RotatableMatteryBlock(), EntityBlock {
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
@ -35,4 +41,16 @@ class FluidTankBlock : RotatableMatteryBlock(), EntityBlock {
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
}
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.FLUID_TANK.rotateFromNorth(it[rotationProperty]).computeShape() }
@Suppress("override_deprecation")
override fun getShape(
state: BlockState,
blockGetter: BlockGetter,
pos: BlockPos,
context: CollisionContext
): VoxelShape {
return shapes[state]!!
}
}