use of net.minecraft.util.math.Quaternion in project meteor-client by MeteorDevelopment.
the class EntityTooltipComponent method renderEntity.
protected void renderEntity(MatrixStack matrices, int x, int y) {
if (mc.player == null)
return;
float size = 24;
if (Math.max(entity.getWidth(), entity.getHeight()) > 1.0) {
size /= Math.max(entity.getWidth(), entity.getHeight());
}
DiffuseLighting.disableGuiDepthLighting();
matrices.push();
int yOffset = 16;
if (entity instanceof SquidEntity) {
size = 16;
yOffset = 2;
}
matrices.translate(x + 10, y + yOffset, 1050);
matrices.scale(1f, 1f, -1);
matrices.translate(0, 0, 1000);
matrices.scale(size, size, size);
Quaternion quaternion = Vec3f.POSITIVE_Z.getDegreesQuaternion(180.f);
Quaternion quaternion2 = Vec3f.POSITIVE_X.getDegreesQuaternion(-10.f);
quaternion.hamiltonProduct(quaternion2);
matrices.multiply(quaternion);
setupAngles();
EntityRenderDispatcher entityRenderDispatcher = mc.getEntityRenderDispatcher();
quaternion2.conjugate();
entityRenderDispatcher.setRotation(quaternion2);
entityRenderDispatcher.setRenderShadows(false);
VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
entity.age = mc.player.age;
entity.setCustomNameVisible(false);
entityRenderDispatcher.render(entity, 0, 0, 0, 0.f, 1.f, matrices, immediate, 15728880);
immediate.draw();
entityRenderDispatcher.setRenderShadows(true);
matrices.pop();
DiffuseLighting.enableGuiDepthLighting();
}
use of net.minecraft.util.math.Quaternion in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method drawEntityBox.
public static void drawEntityBox(MatrixStack matrixstack, Entity entity, double x, double y, double z, Color color) {
setup3DRender(true);
matrixstack.translate(x, y, z);
matrixstack.multiply(new Quaternion(new Vec3f(0, -1, 0), 0, true));
matrixstack.translate(-x, -y, -z);
Box bb = new Box(x - entity.getWidth() + 0.25, y, z - entity.getWidth() + 0.25, x + entity.getWidth() - 0.25, y + entity.getHeight() + 0.1, z + entity.getWidth() - 0.25);
if (entity instanceof ItemEntity)
bb = new Box(x - 0.15, y + 0.1f, z - 0.15, x + 0.15, y + 0.5, z + 0.15);
drawFilledBox(matrixstack, bb, new Color(color.getRed(), color.getGreen(), color.getBlue(), 130), true);
RenderSystem.lineWidth(1.5f);
drawOutlineBox(matrixstack, bb, color, true);
end3DRender();
matrixstack.translate(x, y, z);
matrixstack.multiply(new Quaternion(new Vec3f(0, 1, 0), 0, true));
matrixstack.translate(-x, -y, -z);
}
use of net.minecraft.util.math.Quaternion in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method drawNametag.
public static void drawNametag(MatrixStack matrixstack, Entity entity, double x, double y, double z, Color color) {
setup3DRender(true);
matrixstack.translate(x, y, z);
matrixstack.multiply(new Quaternion(new Vec3f(0, -1, 0), 0, true));
matrixstack.translate(-x, -y, -z);
DrawableHelper.fill(matrixstack, 10, 10, 100, 100, -1);
RenderSystem.lineWidth(1.5f);
end3DRender();
matrixstack.translate(x, y, z);
matrixstack.multiply(new Quaternion(new Vec3f(0, 1, 0), 0, true));
matrixstack.translate(-x, -y, -z);
}
use of net.minecraft.util.math.Quaternion in project Hypnotic-Client by Hypnotic-Development.
the class ItemRendererMixin method preRenderItem.
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At("HEAD"), cancellable = true)
public void preRenderItem(ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) {
EventRenderItem event = new EventRenderItem(matrices, stack, renderMode, EventRenderItem.RenderTime.PRE, leftHanded);
event.call();
if (ModuleManager.INSTANCE.getModule(OldBlock.class).isEnabled()) {
if ((ModuleManager.INSTANCE.getModule(Killaura.class).autoBlockMode.is("Visual") && Killaura.target != null ? Killaura.target == null : !mc.player.isUsingItem()) || renderMode != ModelTransformation.Mode.FIRST_PERSON_RIGHT_HAND)
return;
MatrixStack matrixStack = event.getMatrixStack();
boolean offHand = event.isLeftHanded() ? event.getType() == ModelTransformation.Mode.FIRST_PERSON_RIGHT_HAND : event.getType() == ModelTransformation.Mode.FIRST_PERSON_LEFT_HAND;
if (!offHand) {
if ((event.getItemStack().getItem() instanceof AxeItem || event.getItemStack().getItem() instanceof SwordItem) && event.getItemStack() == mc.player.getMainHandStack()) {
matrixStack.multiply(new Quaternion(-270f, 0f, 270f, true));
matrixStack.multiply(new Quaternion(-120f, 270f, -150f, true));
matrixStack.multiply(new Quaternion(-70f, -108f, 90f, true));
// Only plays with killaura
if (Killaura.target != null && !Killaura.target.isDead()) {
switch(ModuleManager.INSTANCE.getModule(OldBlock.class).animation.getSelected()) {
case "1.7(ish)":
matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, 0, 0, true));
break;
case "Slide":
matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks / 2, true));
break;
case "Sigma":
matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks * 0.15f, 0, 0, true));
matrixStack.multiply(new Quaternion(0, 0, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks * 0.5f, true));
break;
case "Swing":
mc.player.swingHand(Hand.MAIN_HAND);
break;
}
}
ArmCustomize arm = ModuleManager.INSTANCE.getModule(ArmCustomize.class);
if (arm.isEnabled())
matrixStack.translate(arm.mainX.getValue(), arm.mainY.getValue(), arm.mainZ.getValue());
}
}
}
if (event.isCancelled())
ci.cancel();
}
use of net.minecraft.util.math.Quaternion in project Hypnotic-Client by Hypnotic-Development.
the class Waypoints method render.
@EventTarget
public void render(EventRender3D event) {
MatrixStack matrices = event.getMatrices();
for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
if (waypoint.isEnabled()) {
Camera c = mc.gameRenderer.getCamera();
Vec3d vv = new Vec3d(waypoint.getX() + .5, c.getPos().y, waypoint.getZ() + .5);
double distance = vv.distanceTo(mc.player.getPos());
int a = 255;
float scale = 3f;
scale /= 50f;
scale *= 0.55f;
if (distance < 100) {
a = (int) ((distance / 100) * 255);
} else
scale *= distance / 100d;
RenderUtils.drawBoxOutline(new Box(new BlockPos(waypoint.getX(), 0, waypoint.getZ())).stretch(0, 500, 0), QuadColor.single(ColorUtils.defaultClientColor), 1);
RenderUtils.drawBoxFill(new Box(new BlockPos(waypoint.getX(), 0, waypoint.getZ())).stretch(0, 500, 0), QuadColor.single(new Color(ColorUtils.defaultClientColor().getRed(), ColorUtils.defaultClientColor().getGreen(), ColorUtils.defaultClientColor().getBlue(), a).getRGB()));
Vec3d textPos = new Vec3d(waypoint.getX() + 0.5, c.getPos().y, waypoint.getZ() + 0.25);
matrices.push();
matrices.translate(textPos.x - c.getPos().x - 1, textPos.y - c.getPos().y + 2, textPos.z - c.getPos().z - 0.5);
matrices.translate(0, scale * 6, 0);
matrices.scale(-scale, -scale, scale);
Quaternion qu = mc.getEntityRenderDispatcher().getRotation();
qu = new Quaternion(-qu.getX(), -qu.getY(), qu.getZ(), qu.getW());
matrices.multiply(qu);
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
RenderSystem.disableDepthTest();
RenderSystem.polygonOffset(1, -15000000);
RenderSystem.enablePolygonOffset();
FontManager.robotoBig.drawCenteredString(matrices, waypoint.getName() + " " + Math.round(PlayerUtils.distanceTo(new BlockPos(waypoint.getX(), mc.player.getY(), waypoint.getZ()))) + "m", 0, 0, -1, true);
RenderSystem.polygonOffset(1, 15000000);
RenderSystem.disablePolygonOffset();
RenderSystem.enableDepthTest();
immediate.draw();
matrices.pop();
}
}
}
Aggregations