use of net.minecraft.core.Direction in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method ringBell.
@Override
public void ringBell(Bell block) {
org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
Direction face = Direction.byName(bellData.getFacing().name());
Direction dir = Direction.NORTH;
switch(bellData.getAttachment()) {
case DOUBLE_WALL:
case SINGLE_WALL:
switch(face) {
case NORTH:
case SOUTH:
dir = Direction.EAST;
break;
}
break;
case FLOOR:
dir = face;
break;
}
CraftBlock craftBlock = (CraftBlock) block.getBlock();
((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
use of net.minecraft.core.Direction in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method ringBell.
@Override
public void ringBell(Bell block) {
org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
Direction face = Direction.byName(bellData.getFacing().name());
Direction dir = Direction.NORTH;
switch(bellData.getAttachment()) {
case DOUBLE_WALL:
case SINGLE_WALL:
switch(face) {
case NORTH:
case SOUTH:
dir = Direction.EAST;
break;
}
break;
case FLOOR:
dir = face;
break;
}
CraftBlock craftBlock = (CraftBlock) block.getBlock();
((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
use of net.minecraft.core.Direction in project MinecraftForge by MinecraftForge.
the class BlockStateProvider method stairsBlock.
public void stairsBlock(StairBlock block, ModelFile stairs, ModelFile stairsInner, ModelFile stairsOuter) {
getVariantBuilder(block).forAllStatesExcept(state -> {
Direction facing = state.getValue(StairBlock.FACING);
Half half = state.getValue(StairBlock.HALF);
StairsShape shape = state.getValue(StairBlock.SHAPE);
// Stairs model is rotated 90 degrees clockwise for some reason
int yRot = (int) facing.getClockWise().toYRot();
if (shape == StairsShape.INNER_LEFT || shape == StairsShape.OUTER_LEFT) {
// Left facing stairs are rotated 90 degrees clockwise
yRot += 270;
}
if (shape != StairsShape.STRAIGHT && half == Half.TOP) {
// Top stairs are rotated 90 degrees clockwise
yRot += 90;
}
yRot %= 360;
// Don't set uvlock for states that have no rotation
boolean uvlock = yRot != 0 || half == Half.TOP;
return ConfiguredModel.builder().modelFile(shape == StairsShape.STRAIGHT ? stairs : shape == StairsShape.INNER_LEFT || shape == StairsShape.INNER_RIGHT ? stairsInner : stairsOuter).rotationX(half == Half.BOTTOM ? 0 : 180).rotationY(yRot).uvLock(uvlock).build();
}, StairBlock.WATERLOGGED);
}
use of net.minecraft.core.Direction in project MinecraftForge by MinecraftForge.
the class BlockStateProvider method buttonBlock.
public void buttonBlock(ButtonBlock block, ModelFile button, ModelFile buttonPressed) {
getVariantBuilder(block).forAllStates(state -> {
Direction facing = state.getValue(ButtonBlock.FACING);
AttachFace face = state.getValue(ButtonBlock.FACE);
boolean powered = state.getValue(ButtonBlock.POWERED);
return ConfiguredModel.builder().modelFile(powered ? buttonPressed : button).rotationX(face == AttachFace.FLOOR ? 0 : (face == AttachFace.WALL ? 90 : 180)).rotationY((int) (face == AttachFace.CEILING ? facing : facing.getOpposite()).toYRot()).uvLock(face == AttachFace.WALL).build();
});
}
use of net.minecraft.core.Direction in project MinecraftForge by MinecraftForge.
the class VertexLighterFlat method updateLightmap.
protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) {
final float e1 = 1f - 1e-2f;
final float e2 = 0.95f;
boolean full = blockInfo.isFullCube();
Direction side = null;
if ((full || y < -e1) && normal[1] < -e2)
side = Direction.DOWN;
else if ((full || y > e1) && normal[1] > e2)
side = Direction.UP;
else if ((full || z < -e1) && normal[2] < -e2)
side = Direction.NORTH;
else if ((full || z > e1) && normal[2] > e2)
side = Direction.SOUTH;
else if ((full || x < -e1) && normal[0] < -e2)
side = Direction.WEST;
else if ((full || x > e1) && normal[0] > e2)
side = Direction.EAST;
int i = side == null ? 0 : side.ordinal() + 1;
int brightness = blockInfo.getPackedLight()[i];
lightmap[0] = LightTexture.block(brightness) / (float) 0xF;
lightmap[1] = LightTexture.sky(brightness) / (float) 0xF;
}
Aggregations