use of net.minecraft.util.math.Direction in project wildmod by Osmiooo.
the class SculkPatchFeature method veins.
public static void veins(BlockPos blockpos, StructureWorldAccess world) {
if (world.isChunkLoaded(blockpos)) {
for (Direction direction : Direction.values()) {
BlockPos pos1 = blockpos.offset(direction);
if (world.isChunkLoaded(pos1)) {
BlockState state = world.getBlockState(pos1);
Block block = state.getBlock();
if (SculkTags.ALWAYS_WATER.contains(block) || state == Blocks.WATER.getDefaultState()) {
world.setBlockState(pos1, RegisterBlocks.SCULK_VEIN.getDefaultState().with(waterLogged, true).with(getOpposite(direction), true), 0);
} else if (block != waterBlock) {
if (block == veinBlock) {
world.setBlockState(pos1, state.with(getOpposite(direction), true), 0);
} else if (SculkTags.SCULK_VEIN_REPLACEABLE.contains(block) || state.isAir()) {
world.setBlockState(pos1, RegisterBlocks.SCULK_VEIN.getDefaultState().with(getOpposite(direction), true), 0);
}
}
}
}
}
}
use of net.minecraft.util.math.Direction in project SinoCate by EverlastSino.
the class CuttingBoardBlockEntityRenderer method render.
@Override
public void render(CuttingBoardBlockEntity entity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
Direction direction = entity.getCachedState().get(CampfireBlock.FACING);
ItemStack itemStack = entity.itemStack.copy();
int k = (int) entity.getPos().asLong();
if (itemStack == ItemStack.EMPTY)
return;
matrixStack.push();
matrixStack.translate(0.5, 0.1, 0.5);
Direction direction2 = Direction.fromHorizontal(direction.getHorizontal() % 4);
float g = -direction2.asRotation();
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(g));
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90.0f));
matrixStack.scale(0.5f, 0.5f, 0.5f);
MinecraftClient.getInstance().getItemRenderer().renderItem(itemStack, ModelTransformation.Mode.FIXED, i, j, matrixStack, vertexConsumerProvider, k);
matrixStack.pop();
}
use of net.minecraft.util.math.Direction in project SeedcrackerX by 19MisterX98.
the class OutpostFinder method reloadSearchPositions.
public static void reloadSearchPositions() {
SEARCH_POSITIONS = JigsawFinder.getSearchPositions(0, 0, 0, 0, size);
Map<Direction, List<BlockPos>> additional = JigsawFinder.getSearchPositions(0, 0, 1, 0, size);
for (Direction direction : Direction.Type.HORIZONTAL) {
SEARCH_POSITIONS.get(direction).addAll(additional.get(direction));
}
}
use of net.minecraft.util.math.Direction in project Indium by comp500.
the class AoCalculator method calcVanilla.
private void calcVanilla(MutableQuadViewImpl quad, float[] aoDest, int[] lightDest) {
vanillaAoControlBits.clear();
final Direction face = quad.lightFace();
quad.toVanilla(0, vertexData, 0, false);
VanillaAoHelper.updateShape(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, vertexData, face, vanillaAoData, vanillaAoControlBits);
vanillaCalc.fabric_apply(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, quad.lightFace(), vanillaAoData, vanillaAoControlBits, quad.hasShade());
System.arraycopy(vanillaCalc.fabric_colorMultiplier(), 0, aoDest, 0, 4);
System.arraycopy(vanillaCalc.fabric_brightness(), 0, lightDest, 0, 4);
}
use of net.minecraft.util.math.Direction in project Indium by comp500.
the class AoCalculator method irregularFace.
private void irregularFace(MutableQuadViewImpl quad) {
final Vector3f faceNorm = quad.faceNormal();
Vector3f normal;
final float[] w = this.w;
final float[] aoResult = this.ao;
final int[] lightResult = this.light;
for (int i = 0; i < 4; i++) {
normal = quad.hasNormal(i) ? quad.copyNormal(i, vertexNormal) : faceNorm;
float ao = 0, sky = 0, block = 0, maxAo = 0;
int maxSky = 0, maxBlock = 0;
final float x = normal.getX();
if (!MathHelper.approximatelyEquals(0f, x)) {
final Direction face = x > 0 ? Direction.EAST : Direction.WEST;
final AoFaceData fd = gatherInsetFace(quad, i, face);
AoFace.get(face).weightFunc.apply(quad, i, w);
final float n = x * x;
final float a = fd.weigtedAo(w);
final int s = fd.weigtedSkyLight(w);
final int b = fd.weigtedBlockLight(w);
ao += n * a;
sky += n * s;
block += n * b;
maxAo = a;
maxSky = s;
maxBlock = b;
}
final float y = normal.getY();
if (!MathHelper.approximatelyEquals(0f, y)) {
final Direction face = y > 0 ? Direction.UP : Direction.DOWN;
final AoFaceData fd = gatherInsetFace(quad, i, face);
AoFace.get(face).weightFunc.apply(quad, i, w);
final float n = y * y;
final float a = fd.weigtedAo(w);
final int s = fd.weigtedSkyLight(w);
final int b = fd.weigtedBlockLight(w);
ao += n * a;
sky += n * s;
block += n * b;
maxAo = Math.max(maxAo, a);
maxSky = Math.max(maxSky, s);
maxBlock = Math.max(maxBlock, b);
}
final float z = normal.getZ();
if (!MathHelper.approximatelyEquals(0f, z)) {
final Direction face = z > 0 ? Direction.SOUTH : Direction.NORTH;
final AoFaceData fd = gatherInsetFace(quad, i, face);
AoFace.get(face).weightFunc.apply(quad, i, w);
final float n = z * z;
final float a = fd.weigtedAo(w);
final int s = fd.weigtedSkyLight(w);
final int b = fd.weigtedBlockLight(w);
ao += n * a;
sky += n * s;
block += n * b;
maxAo = Math.max(maxAo, a);
maxSky = Math.max(maxSky, s);
maxBlock = Math.max(maxBlock, b);
}
aoResult[i] = (ao + maxAo) * 0.5f;
lightResult[i] = (((int) ((sky + maxSky) * 0.5f) & 0xF0) << 16) | ((int) ((block + maxBlock) * 0.5f) & 0xF0);
}
}
Aggregations