mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Bell Voxelshapes
This commit is contained in:
parent
0b40a57227
commit
b87e707b49
2 changed files with 36 additions and 22 deletions
|
@ -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)
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -76,15 +82,15 @@ public abstract class AbstractBellBlock<TE extends AbstractBellTileEntity> exten
|
|||
|
||||
Direction direction = state.get(field_220133_a);
|
||||
BellAttachment bellAttachment = state.get(field_220134_b);
|
||||
switch(bellAttachment) {
|
||||
case FLOOR:
|
||||
case CEILING:
|
||||
return direction.getAxis() == hitDir.getAxis();
|
||||
case SINGLE_WALL:
|
||||
case DOUBLE_WALL:
|
||||
return direction.getAxis() != hitDir.getAxis();
|
||||
default:
|
||||
return false;
|
||||
switch (bellAttachment) {
|
||||
case FLOOR:
|
||||
case CEILING:
|
||||
return direction.getAxis() == hitDir.getAxis();
|
||||
case SINGLE_WALL:
|
||||
case DOUBLE_WALL:
|
||||
return direction.getAxis() != hitDir.getAxis();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue