use of net.minecraft.client.render.Camera in project Skyblocker by LifeIsAParadox.
the class RenderUtilsLiving method matrixFrom.
public static MatrixStack matrixFrom(double x, double y, double z) {
MatrixStack matrices = new MatrixStack();
Camera camera = mc.gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F));
matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z);
return matrices;
}
use of net.minecraft.client.render.Camera in project Skyblocker by SkyblockerMod.
the class RenderUtils method matrixFrom.
// -------------------- Utils --------------------
public static MatrixStack matrixFrom(double x, double y, double z) {
MatrixStack matrices = new MatrixStack();
Camera camera = MinecraftClient.getInstance().gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F));
matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z);
return matrices;
}
use of net.minecraft.client.render.Camera in project Skyblocker by SkyblockerMod.
the class RenderUtilsLiving method drawText.
/**
* Draws text in the world. *
*/
public static void drawText(Text text, double x, double y, double z, double offX, double offY, double scale, boolean fill) {
MatrixStack matrices = matrixFrom(x, y, z);
Camera camera = mc.gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw()));
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
matrices.translate(offX, offY, 0);
matrices.scale(-0.025f * (float) scale, -0.025f * (float) scale, 1);
int halfWidth = mc.textRenderer.getWidth(text) / 2;
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
if (fill) {
int opacity = (int) (MinecraftClient.getInstance().options.getTextBackgroundOpacity(0.25F) * 255.0F) << 24;
mc.textRenderer.draw(text, -halfWidth, 0f, 553648127, false, matrices.peek().getPositionMatrix(), immediate, true, opacity, 0xf000f0);
immediate.draw();
} else {
matrices.push();
matrices.translate(1, 1, 0);
mc.textRenderer.draw(text.copy(), -halfWidth, 0f, 0x202020, false, matrices.peek().getPositionMatrix(), immediate, true, 0, 0xf000f0);
immediate.draw();
matrices.pop();
}
mc.textRenderer.draw(text, -halfWidth, 0f, -1, false, matrices.peek().getPositionMatrix(), immediate, true, 0, 0xf000f0);
immediate.draw();
RenderSystem.disableBlend();
}
use of net.minecraft.client.render.Camera in project BleachHack by BleachDrinker420.
the class Renderer method matrixFrom.
// -------------------- Utils --------------------
public static MatrixStack matrixFrom(double x, double y, double z) {
MatrixStack matrices = new MatrixStack();
Camera camera = MinecraftClient.getInstance().gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F));
matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z);
return matrices;
}
use of net.minecraft.client.render.Camera in project Client by MatHax.
the class ModelPredicateProviderRegistryMixin method onGetAngleToPos.
@Inject(method = "getAngleToPos(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/entity/Entity;)D", at = @At("HEAD"), cancellable = true)
private void onGetAngleToPos(Vec3d pos, Entity entity, CallbackInfoReturnable<Double> info) {
if (Modules.get().isActive(Freecam.class)) {
Camera camera = mc.gameRenderer.getCamera();
info.setReturnValue(Math.atan2(pos.getZ() - camera.getPos().z, pos.getX() - camera.getPos().x));
}
}
Aggregations