use of net.minecraft.client.util.math.Vector3f in project canvas by vram-guild.
the class QuadViewImpl method copyNormal.
@Override
public Vector3f copyNormal(int vertexIndex, Vector3f target) {
if (hasNormal(vertexIndex)) {
if (target == null) {
target = new Vector3f();
}
final int normal = data[vertexStart() + VANILLA_STRIDE + vertexIndex];
target.set(NormalHelper.getPackedNormalComponent(normal, 0), NormalHelper.getPackedNormalComponent(normal, 1), NormalHelper.getPackedNormalComponent(normal, 2));
return target;
} else {
return null;
}
}
use of net.minecraft.client.util.math.Vector3f in project canvas by vram-guild.
the class QuadViewImpl method copyPos.
@Override
public Vector3f copyPos(int vertexIndex, Vector3f target) {
if (target == null) {
target = new Vector3f();
}
final int index = vertexStart() + vertexIndex * 7;
target.set(Float.intBitsToFloat(data[index]), Float.intBitsToFloat(data[index + 1]), Float.intBitsToFloat(data[index + 2]));
return target;
}
use of net.minecraft.client.util.math.Vector3f in project Indium by comp500.
the class AbstractQuadRenderer method bufferQuad.
public static void bufferQuad(VertexConsumer buff, MutableQuadViewImpl quad, Matrix4f matrix, int overlay, Matrix3f normalMatrix, Vector3f normalVec) {
final boolean useNormals = quad.hasVertexNormals();
if (useNormals) {
quad.populateMissingNormals();
} else {
final Vector3f faceNormal = quad.faceNormal();
normalVec.set(faceNormal.getX(), faceNormal.getY(), faceNormal.getZ());
normalVec.transform(normalMatrix);
}
for (int i = 0; i < 4; i++) {
buff.vertex(matrix, quad.x(i), quad.y(i), quad.z(i));
final int color = quad.spriteColor(i, 0);
buff.color(color & 0xFF, (color >> 8) & 0xFF, (color >> 16) & 0xFF, (color >> 24) & 0xFF);
buff.texture(quad.spriteU(i, 0), quad.spriteV(i, 0));
buff.overlay(overlay);
buff.light(quad.lightmap(i));
if (useNormals) {
normalVec.set(quad.normalX(i), quad.normalY(i), quad.normalZ(i));
normalVec.transform(normalMatrix);
}
buff.normal(normalVec.getX(), normalVec.getY(), normalVec.getZ());
buff.next();
}
}
use of net.minecraft.client.util.math.Vector3f in project BedrockIfy by juancarloscp52.
the class ReachAroundPlacement method checkReachAroundAndExecute.
public void checkReachAroundAndExecute(Hand hand, ItemStack itemStack) {
ClientPlayerEntity player = client.player;
if (player == null || client.interactionManager == null)
return;
int count = itemStack.getCount();
Vector3f facing = player.getHorizontalFacing().getUnitVector();
if (canReachAround()) {
BlockHitResult blockHitResult;
if (isNonFullBlock()) {
blockHitResult = new BlockHitResult(player.getPos().add(facing.getX(), facing.getY() - 1, facing.getZ()), Direction.fromVector((int) -facing.getX(), 0, (int) -facing.getZ()), player.getBlockPos().offset(player.getHorizontalFacing()), false);
} else {
blockHitResult = new BlockHitResult(player.getPos().add(facing.getX(), facing.getY(), facing.getZ()), Direction.fromVector((int) -facing.getX(), 0, (int) -facing.getZ()), player.getBlockPos().down().offset(player.getHorizontalFacing()), false);
}
ActionResult result = client.interactionManager.interactBlock(player, client.world, hand, blockHitResult);
if (result.isAccepted()) {
if (result.shouldSwingHand()) {
player.swingHand(hand);
if (!itemStack.isEmpty() && (itemStack.getCount() != count || client.interactionManager.hasCreativeInventory())) {
client.gameRenderer.firstPersonRenderer.resetEquipProgress(hand);
}
}
}
}
}
use of net.minecraft.client.util.math.Vector3f in project Biome-Makeover by Lemonszz.
the class LightningBugInnerFeatureRenderer method render.
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, LightningBugEntity entity, float f, float g, float delta, float j, float k, float l) {
if (!entity.isInvisible()) {
this.getContextModel().copyStateTo(this.model);
this.model.animateModel(entity, f, g, delta);
this.model.setAngles(entity, f, g, j, k, l);
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(this.getTexture(entity)));
Vector3f color = getColor(entity, delta);
this.model.render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(entity, 0.0F), color.getX(), color.getY(), color.getZ(), 1.0F);
}
}
Aggregations