Shapes
This commit is contained in:
parent
61add16d1e
commit
8498bfdbcf
@ -2,12 +2,17 @@ package ru.dbotthepony.mc.otm.block;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
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;
|
||||
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.shapes.BooleanOp;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import ru.dbotthepony.mc.otm.Registry;
|
||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityBatteryBank;
|
||||
|
||||
@ -30,4 +35,78 @@ public class BlockBatteryBank extends BlockMatteryRotatable implements EntityBlo
|
||||
public boolean faceToPlayer(BlockPlaceContext context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final VoxelShape SHAPE;
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
static {
|
||||
VoxelShape final_shape = Shapes.box(0.125, 0.125, 0.125, 0.875, 0.875, 0.875);
|
||||
|
||||
// вертикальные балки
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0, 0,
|
||||
0.125, 1, 0.125
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0, 0.875,
|
||||
0.125, 1, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0.875, 0, 0,
|
||||
1, 1, 0.125
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0.875, 0, 0.875,
|
||||
1, 1, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
// горизонтальные балки сверху
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0.875, 0,
|
||||
0.125, 1, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0.875, 0,
|
||||
1, 1, 0.125
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0.875, 0.875, 0,
|
||||
1, 1, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0.875, 0.875,
|
||||
1, 1, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
// горизонтальные балки снизу
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0, 0,
|
||||
0.125, 0.125, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0, 0,
|
||||
1, 0.125, 0.125
|
||||
), BooleanOp.OR);
|
||||
|
||||
final_shape = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0.875, 0, 0,
|
||||
1, 0.125, 1
|
||||
), BooleanOp.OR);
|
||||
|
||||
SHAPE = Shapes.joinUnoptimized(final_shape, Shapes.box(
|
||||
0, 0, 0.875,
|
||||
1, 0.125, 1
|
||||
), BooleanOp.OR);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package ru.dbotthepony.mc.otm.block;
|
||||
|
||||
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.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterCapacitorBank;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -14,4 +18,9 @@ public class BlockMatterCapacitorBank extends BlockMatteryRotatable implements E
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new BlockEntityMatterCapacitorBank(blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||
return BlockBatteryBank.SHAPE;
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
"block.overdrive_that_matters.battery_bank": "Battery bank",
|
||||
"block.overdrive_that_matters.matter_decomposer": "Matter decomposer",
|
||||
"block.overdrive_that_matters.matter_capacitor_bank": "Matter capacitor bank",
|
||||
"block.overdrive_that_matters.matter_cable": "Matter network cable",
|
||||
|
||||
"item.overdrive_that_matters.pill_android": "Android pill",
|
||||
"item.overdrive_that_matters.pill_humane": "Humane pill",
|
||||
|
Loading…
Reference in New Issue
Block a user