diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-06 16:29:41 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-06 16:29:41 +0800 |
commit | 6accfc8d22f8873040f347abaf45e9008686a203 (patch) | |
tree | f37fc08345f4eb162ce0e4d08c0c127d71552cbe /utils | |
parent | c6582418087392ffc81ac49db7a5ad8988815863 (diff) | |
download | SoopyV2-6accfc8d22f8873040f347abaf45e9008686a203.tar.gz SoopyV2-6accfc8d22f8873040f347abaf45e9008686a203.tar.bz2 SoopyV2-6accfc8d22f8873040f347abaf45e9008686a203.zip |
Make a utils thing at allows for human readable mappings
Diffstat (limited to 'utils')
-rw-r--r-- | utils/renderLib2d.js | 30 | ||||
-rw-r--r-- | utils/renderUtils.js | 126 |
2 files changed, 79 insertions, 77 deletions
diff --git a/utils/renderLib2d.js b/utils/renderLib2d.js index 22dbca7..913475b 100644 --- a/utils/renderLib2d.js +++ b/utils/renderLib2d.js @@ -7,6 +7,8 @@ // Edit: iv added some features to this so might keep as is //-------------------------------------------------------------------------- +import { f, m } from "../mappings/mappings"; + const GL11 = Java.type("org.lwjgl.opengl.GL11"); @@ -24,7 +26,7 @@ const ScaledResolution = net.minecraft.client.gui.ScaledResolution; const AxisAlignedBB = Java.type("net.minecraft.util.AxisAlignedBB") register('renderWorld', () => { - GlStateManager.func_179094_E(); + GlStateManager[m.pushMatrix](); let x = Player.getX(); let y = Player.getY(); @@ -35,7 +37,7 @@ register('renderWorld', () => { GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelViewMatrix); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projectionMatrix); - GlStateManager.func_179121_F(); + GlStateManager[m.popMatrix](); GL11.glGetInteger(GL11.GL_VIEWPORT, viewportDims); }); @@ -61,10 +63,10 @@ export default class RenderLib2D { const sr = new ScaledResolution(Client.getMinecraft()); - const x = coords.get(0) / sr.func_78325_e(); // getScaleFactor - let y = coords.get(1) / sr.func_78325_e(); // getScaleFactor + const x = coords.get(0) / sr[m.getScaleFactor](); // getScaleFactor + let y = coords.get(1) / sr[m.getScaleFactor](); // getScaleFactor // OpenGL starts at bottom left, mc starts at top left - y = sr.func_78328_b() - y; // getScaledHeight + y = sr[m.getScaledHeight]() - y; // getScaledHeight return { x, y, z }; } @@ -78,7 +80,7 @@ export default class RenderLib2D { let {x, y} = pos1 let {x:ox, y:oy} = pos2 - console.log(x, y, ox, oy, thickness) + // console.log(x, y, ox, oy, thickness) Renderer.drawLine(color, x, y, ox, oy, thickness); } @@ -110,14 +112,14 @@ export default class RenderLib2D { static getVertices = (box) => { let list = []; - list.push({ x: box.field_72340_a, y: box.field_72338_b, z: box.field_72339_c }); - list.push({ x: box.field_72336_d, y: box.field_72338_b, z: box.field_72339_c }); - list.push({ x: box.field_72336_d, y: box.field_72337_e, z: box.field_72339_c }); - list.push({ x: box.field_72340_a, y: box.field_72337_e, z: box.field_72339_c }); - list.push({ x: box.field_72340_a, y: box.field_72338_b, z: box.field_72334_f }); - list.push({ x: box.field_72336_d, y: box.field_72338_b, z: box.field_72334_f }); - list.push({ x: box.field_72336_d, y: box.field_72337_e, z: box.field_72334_f }); - list.push({ x: box.field_72340_a, y: box.field_72337_e, z: box.field_72334_f }); + list.push({ x: box[f.minX.AxisAlignedBB], y: box[f.minY.AxisAlignedBB], z: box[f.minZ.AxisAlignedBB] }); + list.push({ x: box[f.maxX.AxisAlignedBB], y: box[f.minY.AxisAlignedBB], z: box[f.minZ.AxisAlignedBB] }); + list.push({ x: box[f.maxX.AxisAlignedBB], y: box[f.maxY.AxisAlignedBB], z: box[f.minZ.AxisAlignedBB] }); + list.push({ x: box[f.minX.AxisAlignedBB], y: box[f.maxY.AxisAlignedBB], z: box[f.minZ.AxisAlignedBB] }); + list.push({ x: box[f.minX.AxisAlignedBB], y: box[f.minY.AxisAlignedBB], z: box[f.maxZ.AxisAlignedBB] }); + list.push({ x: box[f.maxX.AxisAlignedBB], y: box[f.minY.AxisAlignedBB], z: box[f.maxZ.AxisAlignedBB] }); + list.push({ x: box[f.maxX.AxisAlignedBB], y: box[f.maxY.AxisAlignedBB], z: box[f.maxZ.AxisAlignedBB] }); + list.push({ x: box[f.minX.AxisAlignedBB], y: box[f.maxY.AxisAlignedBB], z: box[f.maxZ.AxisAlignedBB] }); return list; } diff --git a/utils/renderUtils.js b/utils/renderUtils.js index 1c91b6a..216364e 100644 --- a/utils/renderUtils.js +++ b/utils/renderUtils.js @@ -45,8 +45,8 @@ module.exports = { Tessellator.begin(3).colorize(r, g, b); - Tessellator.pos(x, y, z).tex(0, 0); - Tessellator.pos(x2, y2, z2).tex(0, 0); + Tessellator.pos(x, y, z); + Tessellator.pos(x2, y2, z2); Tessellator.draw(); @@ -68,8 +68,8 @@ module.exports = { Tessellator.begin(3).colorize(r, g, b); - Tessellator.pos(x, y, z).tex(0, 0); - Tessellator.pos(x2, y2, z2).tex(0, 0); + Tessellator.pos(x, y, z); + Tessellator.pos(x2, y2, z2); Tessellator.draw(); @@ -83,8 +83,8 @@ module.exports = { Tessellator.begin(3).colorize(r, g, b); - Tessellator.pos(x, y, z).tex(0, 0); - Tessellator.pos(x2, y2, z2).tex(0, 0); + Tessellator.pos(x, y, z); + Tessellator.pos(x2, y2, z2); Tessellator.draw(); }, @@ -101,25 +101,25 @@ module.exports = { Tessellator.begin(3).colorize(colorR, colorG, colorB); - Tessellator.pos(x+1.01,y+1.01,z+1.01).tex(0, 0); - Tessellator.pos(x+1.01,y+1.01,z).tex(0, 0); - Tessellator.pos(x,y+1.01,z).tex(0, 0); - Tessellator.pos(x,y+1.01,z+1.01).tex(0, 0); - Tessellator.pos(x+1.01,y+1.01,z+1.01).tex(0, 0); - Tessellator.pos(x+1.01,y,z+1.01).tex(0, 0); - Tessellator.pos(x+1.01,y,z).tex(0, 0); - Tessellator.pos(x,y,z).tex(0, 0); - Tessellator.pos(x,y,z+1.01).tex(0, 0); - Tessellator.pos(x,y,z).tex(0, 0); - Tessellator.pos(x,y+1.01,z).tex(0, 0); - Tessellator.pos(x,y,z).tex(0, 0); - Tessellator.pos(x+1.01,y,z).tex(0, 0); - Tessellator.pos(x+1.01,y+1.01,z).tex(0, 0); - Tessellator.pos(x+1.01,y,z).tex(0, 0); - Tessellator.pos(x+1.01,y,z+1.01).tex(0, 0); - Tessellator.pos(x,y,z+1.01).tex(0, 0); - Tessellator.pos(x,y+1.01,z+1.01).tex(0, 0); - Tessellator.pos(x+1.01,y+1.01,z+1.01).tex(0, 0); + Tessellator.pos(x+1.01,y+1.01,z+1.01); + Tessellator.pos(x+1.01,y+1.01,z); + Tessellator.pos(x,y+1.01,z); + Tessellator.pos(x,y+1.01,z+1.01); + Tessellator.pos(x+1.01,y+1.01,z+1.01); + Tessellator.pos(x+1.01,y,z+1.01); + Tessellator.pos(x+1.01,y,z); + Tessellator.pos(x,y,z); + Tessellator.pos(x,y,z+1.01); + Tessellator.pos(x,y,z); + Tessellator.pos(x,y+1.01,z); + Tessellator.pos(x,y,z); + Tessellator.pos(x+1.01,y,z); + Tessellator.pos(x+1.01,y+1.01,z); + Tessellator.pos(x+1.01,y,z); + Tessellator.pos(x+1.01,y,z+1.01); + Tessellator.pos(x,y,z+1.01); + Tessellator.pos(x,y+1.01,z+1.01); + Tessellator.pos(x+1.01,y+1.01,z+1.01); Tessellator.draw(); @@ -140,25 +140,25 @@ module.exports = { Tessellator.begin(3).colorize(colorR, colorG, colorB); - Tessellator.pos(x+1,y+1,z+1).tex(0, 0); - Tessellator.pos(x+1,y+1,z).tex(0, 0); - Tessellator.pos(x,y+1,z).tex(0, 0); - Tessellator.pos(x,y+1,z+1).tex(0, 0); - Tessellator.pos(x+1,y+1,z+1).tex(0, 0); - Tessellator.pos(x+1,y,z+1).tex(0, 0); - Tessellator.pos(x+1,y,z).tex(0, 0); - Tessellator.pos(x,y,z).tex(0, 0); - Tessellator.pos(x,y,z+1).tex(0, 0); - Tessellator.pos(x,y,z).tex(0, 0); - Tessellator.pos(x,y+1,z).tex(0, 0); - Tessellator.pos(x,y,z).tex(0, 0); - Tessellator.pos(x+1,y,z).tex(0, 0); - Tessellator.pos(x+1,y+1,z).tex(0, 0); - Tessellator.pos(x+1,y,z).tex(0, 0); - Tessellator.pos(x+1,y,z+1).tex(0, 0); - Tessellator.pos(x,y,z+1).tex(0, 0); - Tessellator.pos(x,y+1,z+1).tex(0, 0); - Tessellator.pos(x+1,y+1,z+1).tex(0, 0); + Tessellator.pos(x+1,y+1,z+1); + Tessellator.pos(x+1,y+1,z); + Tessellator.pos(x,y+1,z); + Tessellator.pos(x,y+1,z+1); + Tessellator.pos(x+1,y+1,z+1); + Tessellator.pos(x+1,y,z+1); + Tessellator.pos(x+1,y,z); + Tessellator.pos(x,y,z); + Tessellator.pos(x,y,z+1); + Tessellator.pos(x,y,z); + Tessellator.pos(x,y+1,z); + Tessellator.pos(x,y,z); + Tessellator.pos(x+1,y,z); + Tessellator.pos(x+1,y+1,z); + Tessellator.pos(x+1,y,z); + Tessellator.pos(x+1,y,z+1); + Tessellator.pos(x,y,z+1); + Tessellator.pos(x,y+1,z+1); + Tessellator.pos(x+1,y+1,z+1); Tessellator.draw(); @@ -191,25 +191,25 @@ module.exports = { Tessellator.begin(3).colorize(colorR, colorG, colorB); - Tessellator.pos(x+width,y+height,z+width).tex(0, 0); - Tessellator.pos(x+width,y+height,z-width).tex(0, 0); - Tessellator.pos(x-width,y+height,z-width).tex(0, 0); - Tessellator.pos(x-width,y+height,z+width).tex(0, 0); - Tessellator.pos(x+width,y+height,z+width).tex(0, 0); - Tessellator.pos(x+width,y,z+width).tex(0, 0); - Tessellator.pos(x+width,y,z-width).tex(0, 0); - Tessellator.pos(x-width,y,z-width).tex(0, 0); - Tessellator.pos(x-width,y,z+width).tex(0, 0); - Tessellator.pos(x-width,y,z-width).tex(0, 0); - Tessellator.pos(x-width,y+height,z-width).tex(0, 0); - Tessellator.pos(x-width,y,z-width).tex(0, 0); - Tessellator.pos(x+width,y,z-width).tex(0, 0); - Tessellator.pos(x+width,y+height,z-width).tex(0, 0); - Tessellator.pos(x+width,y,z-width).tex(0, 0); - Tessellator.pos(x+width,y,z+width).tex(0, 0); - Tessellator.pos(x-width,y,z+width).tex(0, 0); - Tessellator.pos(x-width,y+height,z+width).tex(0, 0); - Tessellator.pos(x+width,y+height,z+width).tex(0, 0); + Tessellator.pos(x+width,y+height,z+width); + Tessellator.pos(x+width,y+height,z-width); + Tessellator.pos(x-width,y+height,z-width); + Tessellator.pos(x-width,y+height,z+width); + Tessellator.pos(x+width,y+height,z+width); + Tessellator.pos(x+width,y,z+width); + Tessellator.pos(x+width,y,z-width); + Tessellator.pos(x-width,y,z-width); + Tessellator.pos(x-width,y,z+width); + Tessellator.pos(x-width,y,z-width); + Tessellator.pos(x-width,y+height,z-width); + Tessellator.pos(x-width,y,z-width); + Tessellator.pos(x+width,y,z-width); + Tessellator.pos(x+width,y+height,z-width); + Tessellator.pos(x+width,y,z-width); + Tessellator.pos(x+width,y,z+width); + Tessellator.pos(x-width,y,z+width); + Tessellator.pos(x-width,y+height,z+width); + Tessellator.pos(x+width,y+height,z+width); Tessellator.draw(); |