change hitboces from iron_shelf
This commit is contained in:
+1
-1
@@ -27,7 +27,7 @@ mod_name=Ornamentum
|
||||
## The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.2.1
|
||||
mod_version=1.2.2
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ovh.glitchlabs.ornamentum.blocks.custom;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
@@ -9,20 +10,36 @@ import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ShelfBlock extends HorizontalDirectionalBlock {
|
||||
public static final MapCodec<ShelfBlock> CODEC = simpleCodec(ShelfBlock::new);
|
||||
private static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 16.0, 16.0);
|
||||
private final ImmutableMap<BlockState, VoxelShape> shapes = this.makeShapes();
|
||||
|
||||
public ShelfBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
private ImmutableMap<BlockState, VoxelShape> makeShapes() {
|
||||
return this.getShapeForEachState(state -> {
|
||||
return switch (state.getValue(FACING)) {
|
||||
case NORTH -> Shapes.or(box(0, 0, 0, 1, 16, 1), box(0, 0, 15, 1, 16, 16), box(15, 0, 15, 16, 16, 16), box(15, 0, 0, 16, 16, 1), box(14, 0, 0, 16, 16, 2), box(0, 0, 0, 2, 16, 2), box(0, 0, 14, 2, 16, 16), box(14, 0, 14, 16, 16, 16),
|
||||
box(0.5, 10, 0.5, 15.5, 12, 15.5), box(0.5, 2, 0.5, 15.5, 4, 15.5));
|
||||
case EAST -> Shapes.or(box(15, 0, 0, 16, 16, 1), box(0, 0, 0, 1, 16, 1), box(0, 0, 15, 1, 16, 16), box(15, 0, 15, 16, 16, 16), box(14, 0, 14, 16, 16, 16), box(14, 0, 0, 16, 16, 2), box(0, 0, 0, 2, 16, 2), box(0, 0, 14, 2, 16, 16),
|
||||
box(0.5, 10, 0.5, 15.5, 12, 15.5), box(0.5, 2, 0.5, 15.5, 4, 15.5));
|
||||
case WEST -> Shapes.or(box(0, 0, 15, 1, 16, 16), box(15, 0, 15, 16, 16, 16), box(15, 0, 0, 16, 16, 1), box(0, 0, 0, 1, 16, 1), box(0, 0, 0, 2, 16, 2), box(0, 0, 14, 2, 16, 16), box(14, 0, 14, 16, 16, 16), box(14, 0, 0, 16, 16, 2),
|
||||
box(0.5, 10, 0.5, 15.5, 12, 15.5), box(0.5, 2, 0.5, 15.5, 4, 15.5));
|
||||
default -> Shapes.or(box(15, 0, 15, 16, 16, 16), box(15, 0, 0, 16, 16, 1), box(0, 0, 0, 1, 16, 1), box(0, 0, 15, 1, 16, 16), box(0, 0, 14, 2, 16, 16), box(14, 0, 14, 16, 16, 16), box(14, 0, 0, 16, 16, 2), box(0, 0, 0, 2, 16, 2),
|
||||
box(0.5, 10, 0.5, 15.5, 12, 15.5), box(0.5, 2, 0.5, 15.5, 4, 15.5));
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
|
||||
return SHAPE;
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
return shapes.get(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user