Search in sources :

Example 26 with Vec3f

use of net.minecraft.util.math.Vec3f in project FabricSecretRooms by Spaceman.

the class RedstoneChainBlock method randomDisplayTick.

@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
    if (random.nextInt(state.get(POWER) + 1) > 0) {
        double xPos = (double) pos.getX() + 0.5D;
        double yPos = (double) pos.getY() + random.nextDouble();
        double zPos = (double) pos.getZ() + 0.5D;
        world.addParticle(new DustParticleEffect(new Vec3f(1.0F, 0.0F, 0.0F), 0.5F), xPos, yPos, zPos, 0.0D, 0.0D, 0.0D);
    }
}
Also used : DustParticleEffect(net.minecraft.particle.DustParticleEffect) Vec3f(net.minecraft.util.math.Vec3f) Environment(net.fabricmc.api.Environment)

Example 27 with Vec3f

use of net.minecraft.util.math.Vec3f in project Hypnotic-Client by Hypnotic-Development.

the class Vertexer method vertexTri.

public static void vertexTri(MatrixStack matrices, VertexConsumer vertexConsumer, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, Color c) {
    Matrix4f model = matrices.peek().getPositionMatrix();
    Matrix3f normal = matrices.peek().getNormalMatrix();
    Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2);
    float r = c.getRed() / 255f;
    float g = c.getGreen() / 255f;
    float b = c.getBlue() / 255f;
    float a = c.getAlpha() / 255f;
    vertexConsumer.vertex(model, x1, y1, z1).color(r, g, b, a).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
    vertexConsumer.vertex(model, x2, y2, z2).color(r, g, b, a).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
    vertexConsumer.vertex(model, x3, y3, z3).color(r, g, b, a).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Matrix3f(net.minecraft.util.math.Matrix3f) Vec3f(net.minecraft.util.math.Vec3f)

Example 28 with Vec3f

use of net.minecraft.util.math.Vec3f in project JexClient by DustinRepo.

the class WatermarkElement method render.

@Override
public void render(MatrixStack matrixStack) {
    if (!isVisible())
        return;
    if (Wrapper.INSTANCE.getMinecraft().currentScreen instanceof ChatScreen) {
        if (isHovered())
            FontHelper.INSTANCE.drawCenteredString(matrixStack, this.getName(), getX() + (getWidth() / 2.f), getY() - 10, -1);
        Render2DHelper.INSTANCE.fillAndBorder(matrixStack, getX(), getY(), getX() + getWidth(), getY() + getHeight(), isHovered() ? ColorHelper.INSTANCE.getClientColor() : 0xff696969, 0x00000000, 1);
    }
    handleElement();
    int x = (int) this.getX() + 17;
    int y = (int) this.getY() + 17;
    matrixStack.push();
    matrixStack.translate(x, y, 0);
    switch(getHud().watermarkMode) {
        case "Static":
            break;
        case "Spin Only":
            matrixStack.multiply(new Quaternion(new Vec3f(0.0F, 0.0F, 1.0F), rot, true));
            break;
        case "Flip Only":
            matrixStack.multiply(new Quaternion(new Vec3f(0.0F, 1F, 0F), rot, true));
            break;
        case "SpinFlip":
            matrixStack.multiply(new Quaternion(new Vec3f(0.0F, 0.5f, 1F), rot, true));
            break;
    }
    matrixStack.translate(-x, -y, 0);
    float newX = x - (FontHelper.INSTANCE.getStringWidth("Jex") / 2);
    Render2DHelper.INSTANCE.drawFullCircle(x, y, 15, 0x80252525, matrixStack);
    Render2DHelper.INSTANCE.drawArc(x, y, 15, ColorHelper.INSTANCE.getClientColor(), 0, 360, 1, matrixStack);
    FontHelper.INSTANCE.draw(matrixStack, "Jex", newX, y - 9, ColorHelper.INSTANCE.getClientColor());
    matrixStack.scale(0.75f, 0.75f, 1);
    float newX1 = x - (FontHelper.INSTANCE.getStringWidth(JexClient.INSTANCE.getVersion().version()) / (2 / 0.75f));
    FontHelper.INSTANCE.draw(matrixStack, JexClient.INSTANCE.getVersion().version(), newX1 / 0.75f, y / 0.75f + 1, ColorHelper.INSTANCE.getClientColor());
    matrixStack.scale(1 / 0.75f, 1 / 0.75f, 1);
    matrixStack.translate(x, y, 0);
    switch(getHud().watermarkMode) {
        case "Static":
            break;
        case "Spin Only":
            matrixStack.multiply(new Quaternion(new Vec3f(0.0F, 0.0F, -1.0F), rot, true));
            break;
        case "Flip Only":
            matrixStack.multiply(new Quaternion(new Vec3f(0.0F, -1F, 0F), rot, true));
            break;
        case "SpinFlip":
            matrixStack.multiply(new Quaternion(new Vec3f(0.0F, -0.5f, -1F), rot, true));
            break;
    }
    matrixStack.pop();
}
Also used : ChatScreen(net.minecraft.client.gui.screen.ChatScreen) Quaternion(net.minecraft.util.math.Quaternion) Vec3f(net.minecraft.util.math.Vec3f)

Aggregations

Vec3f (net.minecraft.util.math.Vec3f)28 Quaternion (net.minecraft.util.math.Quaternion)16 Vec3d (net.minecraft.util.math.Vec3d)10 Matrix4f (net.minecraft.util.math.Matrix4f)5 Matrix3f (net.minecraft.util.math.Matrix3f)4 MatrixStack (net.minecraft.client.util.math.MatrixStack)3 Identifier (net.minecraft.util.Identifier)3 Color (java.awt.Color)2 Camera (net.minecraft.client.render.Camera)2 VertexConsumer (net.minecraft.client.render.VertexConsumer)2 ClientWorld (net.minecraft.client.world.ClientWorld)2 ItemEntity (net.minecraft.entity.ItemEntity)2 PersistentProjectileEntity (net.minecraft.entity.projectile.PersistentProjectileEntity)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 Pair (com.mojang.datafixers.util.Pair)1 CustomFont (dev.hypnotic.module.render.CustomFont)1 MonoColorSkybox (io.github.amerebagatelle.fabricskyboxes.skyboxes.MonoColorSkybox)1 AnimatedSquareTexturedSkybox (io.github.amerebagatelle.fabricskyboxes.skyboxes.textured.AnimatedSquareTexturedSkybox)1 SquareTexturedSkybox (io.github.amerebagatelle.fabricskyboxes.skyboxes.textured.SquareTexturedSkybox)1