From 7c89d3a9b8692dca4169367a98ac280eadb0a297 Mon Sep 17 00:00:00 2001 From: GiantLuigi4 <49770992+GiantLuigi4@users.noreply.github.com> Date: Tue, 6 Jun 2023 15:02:10 -0400 Subject: [PATCH] minepad rendering improvements --- build.gradle | 4 ++- .../wd/client/renderers/MinePadRenderer.java | 4 +++ .../wd/client/renderers/ModelMinePad.java | 34 ++++++++++++++++++ .../textures/models/minepad_item.png | Bin 0 -> 123 bytes 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/webdisplays/textures/models/minepad_item.png diff --git a/build.gradle b/build.gradle index 826dbd6..6dd3e93 100644 --- a/build.gradle +++ b/build.gradle @@ -69,6 +69,7 @@ repositories{ name = "cursemaven" url = "https://www.cursemaven.com" } + flatDir { dirs 'libs' } } dependencies { @@ -77,8 +78,9 @@ dependencies { implementation fg.deobf("com.github.Mysticpasta1:mcef-forge:f0c7e2e361") // implementation fg.deobf("curse.maven:cloth_config_forge-348521:3972423") - implementation fg.deobf("curse.maven:SU-370704:4485052") +// implementation fg.deobf("curse.maven:SU-370704:4485052") implementation fg.deobf("curse.maven:spark-361579:4381167") + implementation fg.deobf("flatdir.lib:smallerunits:2.1.3") compileOnly fg.deobf("curse.maven:vivecraft-667903:4409427") } diff --git a/src/main/java/net/montoyo/wd/client/renderers/MinePadRenderer.java b/src/main/java/net/montoyo/wd/client/renderers/MinePadRenderer.java index 8ee768c..bce77f4 100644 --- a/src/main/java/net/montoyo/wd/client/renderers/MinePadRenderer.java +++ b/src/main/java/net/montoyo/wd/client/renderers/MinePadRenderer.java @@ -9,6 +9,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Vector3f; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -97,6 +98,9 @@ public final class MinePadRenderer implements IItemRenderer { model.render(multiBufferSource, stack); stack.translate(-0.063f, -0.28f, -0.001f); + // force draw so the browser can be drawn ontop of the model + multiBufferSource.getBuffer(RenderType.LINES); + if (is.getTag() != null && is.getTag().contains("PadID")) { ClientProxy.PadData pd = clientProxy.getPadByID(is.getTag().getUUID("PadID")); diff --git a/src/main/java/net/montoyo/wd/client/renderers/ModelMinePad.java b/src/main/java/net/montoyo/wd/client/renderers/ModelMinePad.java index c43d213..b043653 100644 --- a/src/main/java/net/montoyo/wd/client/renderers/ModelMinePad.java +++ b/src/main/java/net/montoyo/wd/client/renderers/ModelMinePad.java @@ -8,7 +8,11 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import com.mojang.math.Matrix4f; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -35,5 +39,35 @@ public final class ModelMinePad { vb.vertex(positionMatrix, (float) x2, (float) y2, 0.0f).color(0, 0, 0, 255).endVertex(); vb.vertex(positionMatrix, (float) x1, (float) y2, 0.0f).color(0, 0, 0, 255).endVertex(); t.end(); + + int width = 32; + int height = 16; + + float padding = 1f / 23; + float padding1 = 1f / 21; + + float z = 0; + + VertexConsumer consumer = buffers.getBuffer(RenderType.entityCutout(new ResourceLocation("webdisplays:textures/models/minepad_item.png"))); + + consumer.vertex(positionMatrix, (float) x1, (float) y1 - padding, z).color(255, 255, 255, 255).uv(1f / width, 12f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + consumer.vertex(positionMatrix, (float) x2, (float) y1 - padding, z).color(255, 255, 255, 255).uv(19f / width, 12f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + consumer.vertex(positionMatrix, (float) x2, (float) y2 + padding, z).color(255, 255, 255, 255).uv(19f / width, 0).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + consumer.vertex(positionMatrix, (float) x1, (float) y2 + padding, z).color(255, 255, 255, 255).uv(1f / width, 0).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + + consumer.vertex(positionMatrix, (float) x1 - padding1, (float) y1, z).color(255, 255, 255, 255).uv(0f / width, 10f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + consumer.vertex(positionMatrix, (float) x2 + padding1, (float) y1, z).color(255, 255, 255, 255).uv(20f / width, 10f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + consumer.vertex(positionMatrix, (float) x2 + padding1, (float) y2, z).color(255, 255, 255, 255).uv(20f / width, 1f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + consumer.vertex(positionMatrix, (float) x1 - padding1, (float) y2, z).color(255, 255, 255, 255).uv(0f / width, 1f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); + +// consumer.vertex(positionMatrix, (float) x2, (float) y2 + padding, z - padding).color(255, 255, 255, 255).uv(0f / width, 1f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// consumer.vertex(positionMatrix, (float) x2, (float) y2 + padding, z).color(255, 255, 255, 255).uv(1f / width, 1f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// consumer.vertex(positionMatrix, (float) x2, (float) y1 - padding, z).color(255, 255, 255, 255).uv(1f / width, 2f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// consumer.vertex(positionMatrix, (float) x2, (float) y1 - padding, z - padding).color(255, 255, 255, 255).uv(0f / width, 2f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// +// consumer.vertex(positionMatrix, (float) x1, (float) y1 - padding, z - padding).color(255, 255, 255, 255).uv(0f / width, 2f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// consumer.vertex(positionMatrix, (float) x1, (float) y1 - padding, z).color(255, 255, 255, 255).uv(1f / width, 2f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// consumer.vertex(positionMatrix, (float) x1, (float) y2 + padding, z).color(255, 255, 255, 255).uv(1f / width, 1f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); +// consumer.vertex(positionMatrix, (float) x1, (float) y2 + padding, z - padding).color(255, 255, 255, 255).uv(0f / width, 1f / height).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT).normal(0.25f, 0.5f, 1).endVertex(); } } diff --git a/src/main/resources/assets/webdisplays/textures/models/minepad_item.png b/src/main/resources/assets/webdisplays/textures/models/minepad_item.png new file mode 100644 index 0000000000000000000000000000000000000000..5f55fc81b1ebef3896a627e674d327bc6318cf56 GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^3P3Et!3HGD8EPYel#{26V~B@$atcG!T=&mn zm6w;h1)WV`iS+Ap%MqKHd~F4@n{$E*3y^r=oN%B!Dd==w)@t>gpCn2dwmLH~WM7F8 U{9)nK0yK@m)78&qol`;+0E+n}&j0`b literal 0 HcmV?d00001