diff options
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/utils')
5 files changed, 49 insertions, 25 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java index 00f400ec..a4d1ee7b 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java @@ -15,7 +15,8 @@ public class ItemUtils { public static List<Text> getTooltip(ItemStack item) { MinecraftClient client = MinecraftClient.getInstance(); if (client.player != null && item != null) - return item.getTooltip(client.player, TooltipContext.Default.NORMAL); + // return item.getTooltip(client.player, TooltipContext.Default.NORMAL); + return item.getTooltip(client.player, TooltipContext.Default.BASIC); return Collections.emptyList(); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java index 3c96e1f4..0f2f3aef 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java @@ -17,7 +17,8 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3f; +// import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; public class RenderUtils { @@ -41,7 +42,7 @@ public class RenderUtils { // Outline RenderSystem.disableCull(); - RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader); + RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram); RenderSystem.lineWidth(lineWidth); buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES); @@ -59,8 +60,10 @@ public class RenderUtils { 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.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F)); matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z); diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java index c1111b36..651ef2bd 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java @@ -35,7 +35,9 @@ import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.util.math.Vec3f; +//import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; +import org.joml.Vector3f; public class RenderUtilsLiving { @@ -52,8 +54,10 @@ public class RenderUtilsLiving { 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())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw())); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); + // matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); @@ -92,20 +96,24 @@ public class RenderUtilsLiving { 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())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw())); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); + // matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); matrices.translate(offX, offY, 0); matrices.scale((float) scale, (float) scale, 0.001f); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f)); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180f)); //mc.getBufferBuilders().getEntityVertexConsumers().draw(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - Vec3f[] currentLight = getCurrentLight(); + // Vec3f[] currentLight = getCurrentLight(); + Vector3f[] currentLight = getCurrentLight(); DiffuseLighting.disableGuiDepthLighting(); mc.getBufferBuilders().getEntityVertexConsumers().draw(); @@ -123,21 +131,25 @@ public class RenderUtilsLiving { 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.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F)); matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z); return matrices; } - public static Vec3f[] getCurrentLight() { + // public static Vec3f[] getCurrentLight() { + public static Vector3f[] getCurrentLight() { if (shaderLightField == null) { shaderLightField = FieldUtils.getField(RenderSystem.class, "shaderLightDirections", true); } try { - return (Vec3f[]) shaderLightField.get(null); + // return (Vec3f[]) shaderLightField.get(null); + return (Vector3f[]) shaderLightField.get(null); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java b/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java index 910c8a6c..ae490649 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java @@ -22,7 +22,7 @@ public class ToastBuilder implements Toast { @Override public Toast.Visibility draw(MatrixStack matrices, ToastManager manager, long startTime) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java index 12f4b0fd..cf6d90b6 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java @@ -7,9 +7,12 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Matrix3f; -import net.minecraft.util.math.Matrix4f; -import net.minecraft.util.math.Vec3f; +// import net.minecraft.util.math.Matrix3f; +// import net.minecraft.util.math.Matrix4f; +// import net.minecraft.util.math.Vec3f; +import org.joml.Matrix3f; +import org.joml.Matrix4f; +import org.joml.Vector3f; import org.apache.commons.lang3.ArrayUtils; public class Vertexer { @@ -135,22 +138,27 @@ public class Vertexer { Matrix4f model = matrices.peek().getPositionMatrix(); Matrix3f normal = matrices.peek().getNormalMatrix(); - Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); + // Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); + Vector3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); int[] color1 = lineColor.getColor(x1, y1, z1, 0); int[] color2 = lineColor.getColor(x2, y2, z2, 1); - vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); - vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); + // vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); + vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.x(), normalVec.y(), normalVec.z()).next(); + // vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); + vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.x(), normalVec.y(), normalVec.z()).next(); } - public static Vec3f getNormal(Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2) { + // public static Vec3f getNormal(Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2) { + public static Vector3f getNormal(Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2) { float xNormal = x2 - x1; float yNormal = y2 - y1; float zNormal = z2 - z1; float normalSqrt = MathHelper.sqrt(xNormal * xNormal + yNormal * yNormal + zNormal * zNormal); - return new Vec3f(xNormal / normalSqrt, yNormal / normalSqrt, zNormal / normalSqrt); + // return new Vec3f(xNormal / normalSqrt, yNormal / normalSqrt, zNormal / normalSqrt); + return new Vector3f(xNormal / normalSqrt, yNormal / normalSqrt, zNormal / normalSqrt); } }
\ No newline at end of file |