change hitboces from duck
This commit is contained in:
@@ -9,20 +9,39 @@ 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;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
public class duckBlock extends HorizontalDirectionalBlock {
|
||||
public static final MapCodec<duckBlock> CODEC = simpleCodec(duckBlock::new);
|
||||
private static final VoxelShape SHAPE = Block.box(7.0, 0.0, 7.0, 9.0, 4.0, 9.0);
|
||||
private final ImmutableMap<BlockState, VoxelShape> shapes = this.makeShapes();
|
||||
|
||||
public duckBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
private ImmutableMap<BlockState, VoxelShape> makeShapes() {
|
||||
return this.getShapeForEachState(state -> {
|
||||
return switch (state.getValue(FACING)) {
|
||||
case NORTH -> Shapes.or(box(6.46339, 0, 7.13839, 9.46339, 2, 10.13839), box(6.96339, 2, 9.88839, 8.96339, 2.5, 10.38839), box(6.96339, 0.5, 10.13839, 8.96339, 2, 10.63839), box(9.46339, 1, 7.88839, 9.96339, 2, 9.88839),
|
||||
box(5.96339, 1, 7.88839, 6.46339, 2, 9.88839), box(6.96339, 1.5, 5.63839, 8.96339, 3.5, 7.63839), box(7.46339, 1.75, 5.13839, 8.46339, 2.25, 6.13839));
|
||||
case EAST -> Shapes.or(box(5.86161, 0, 6.46339, 8.86161, 2, 9.46339), box(5.61161, 2, 6.96339, 6.11161, 2.5, 8.96339), box(5.36161, 0.5, 6.96339, 5.86161, 2, 8.96339), box(6.11161, 1, 9.46339, 8.11161, 2, 9.96339),
|
||||
box(6.11161, 1, 5.96339, 8.11161, 2, 6.46339), box(8.36161, 1.5, 6.96339, 10.36161, 3.5, 8.96339), box(9.86161, 1.75, 7.46339, 10.86161, 2.25, 8.46339));
|
||||
case WEST -> Shapes.or(box(7.13839, 0, 6.53661, 10.13839, 2, 9.53661), box(9.88839, 2, 7.03661, 10.38839, 2.5, 9.03661), box(10.13839, 0.5, 7.03661, 10.63839, 2, 9.03661), box(7.88839, 1, 6.03661, 9.88839, 2, 6.53661),
|
||||
box(7.88839, 1, 9.53661, 9.88839, 2, 10.03661), box(5.63839, 1.5, 7.03661, 7.63839, 3.5, 9.03661), box(5.13839, 1.75, 7.53661, 6.13839, 2.25, 8.53661));
|
||||
default -> Shapes.or(box(6.53661, 0, 5.86161, 9.53661, 2, 8.86161), box(7.03661, 2, 5.61161, 9.03661, 2.5, 6.11161), box(7.03661, 0.5, 5.36161, 9.03661, 2, 5.86161), box(6.03661, 1, 6.11161, 6.53661, 2, 8.11161),
|
||||
box(9.53661, 1, 6.11161, 10.03661, 2, 8.11161), box(7.03661, 1.5, 8.36161, 9.03661, 3.5, 10.36161), box(7.53661, 1.75, 9.86161, 8.53661, 2.25, 10.86161));
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@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