Bell Voxelshapes

This commit is contained in:
simibubi 2021-07-06 01:16:44 +02:00
parent 0b40a57227
commit b87e707b49
2 changed files with 36 additions and 22 deletions

View file

@ -108,7 +108,15 @@ public class AllShapes {
PUMP = shape(2, 0, 2, 14, 5, 14).add(4, 0, 4, 12, 16, 12)
.add(3, 12, 3, 13, 16, 13)
.forDirectional(Direction.UP),
CRUSHING_WHEEL_CONTROLLER_COLLISION = shape(0, 0, 0, 16, 13, 16).forDirectional(Direction.DOWN)
CRUSHING_WHEEL_CONTROLLER_COLLISION = shape(0, 0, 0, 16, 13, 16).forDirectional(Direction.DOWN),
BELL_FLOOR = shape(0, 0, 2, 16, 12, 14).forHorizontal(SOUTH),
BELL_WALL = shape(4, 4, 8, 12, 12, 16).add(3, 1, 3, 13, 13, 13)
.forHorizontal(SOUTH),
BELL_DOUBLE_WALL = shape(4, 4, 0, 12, 12, 16).add(3, 1, 3, 13, 13, 13)
.forHorizontal(SOUTH),
BELL_CEILING = shape(0, 4, 2, 16, 16, 14).add(3, 1, 3, 13, 13, 13)
.forHorizontal(SOUTH)
;

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities.bell;
import javax.annotation.Nullable;
import com.simibubi.create.AllShapes;
import com.simibubi.create.foundation.block.ITE;
import net.minecraft.block.BellBlock;
@ -31,26 +32,31 @@ public abstract class AbstractBellBlock<TE extends AbstractBellTileEntity> exten
return null;
}
protected VoxelShape getShape(BlockState state) {
return VoxelShapes.fullCube();
}
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext selection) {
return this.getShape(state);
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext selection) {
return this.getShape(state);
Direction facing = state.get(field_220133_a);
switch (state.get(field_220134_b)) {
case CEILING:
return AllShapes.BELL_CEILING.get(facing);
case DOUBLE_WALL:
return AllShapes.BELL_DOUBLE_WALL.get(facing);
case FLOOR:
return AllShapes.BELL_FLOOR.get(facing);
case SINGLE_WALL:
return AllShapes.BELL_WALL.get(facing);
default:
return VoxelShapes.fullCube();
}
}
@Override
public boolean ring(World world, BlockState state, BlockRayTraceResult hit, @Nullable PlayerEntity player, boolean flag) {
public boolean ring(World world, BlockState state, BlockRayTraceResult hit, @Nullable PlayerEntity player,
boolean flag) {
BlockPos pos = hit.getPos();
Direction direction = hit.getFace();
if (direction == null)
direction = world.getBlockState(pos).get(field_220133_a);
direction = world.getBlockState(pos)
.get(field_220133_a);
if (!this.canRingFrom(state, direction, hit.getHitVec().y - pos.getY()))
return false;