From 169eba238b9f23636fefa67bfb0fe7baa4659c2b Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Sun, 9 May 2021 02:58:18 -0400 Subject: [PATCH] Fixed Missing Texture Error FIxed the Missing Texture Bug Started to work on Reset Buttons --- src/main/java/noppes/npcs/DataDisplay.java | 4 +-- .../npcs/client/gui/model/GuiModelScale.java | 27 ++++++++++++++++--- .../client/renderer/RenderNPCInterface.java | 7 +++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/main/java/noppes/npcs/DataDisplay.java b/src/main/java/noppes/npcs/DataDisplay.java index f617b5cac..3d4709d21 100644 --- a/src/main/java/noppes/npcs/DataDisplay.java +++ b/src/main/java/noppes/npcs/DataDisplay.java @@ -24,7 +24,7 @@ public class DataDisplay { public String url = ""; public GameProfile playerProfile; - public String texture = "customnpcs:textures/entity/humanmale/Steve.png";; + public String texture = "customnpcs:textures/entity/humanmale/Steve.png"; public String cloakTexture = ""; public String glowTexture = ""; @@ -120,7 +120,7 @@ public class DataDisplay { cloakTexture = nbttagcompound.getString("CloakTexture"); glowTexture = nbttagcompound.getString("GlowTexture"); - modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 40); + modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 30); modelType = nbttagcompound.getInteger("modelType"); showName = nbttagcompound.getInteger("ShowName"); diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java index 041d63f67..128b91462 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java @@ -71,24 +71,45 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{ private void drawSlider(int y, ModelPartConfig config){ y += 15; - addLabel(new GuiNpcLabel(10, "Width", guiLeft, y + 5, 0xFFFFFF)); + addLabel(new GuiNpcLabel(10, "Width", guiLeft - 25, y + 5, 0xFFFFFF)); addSlider(new GuiNpcSlider(this, 10, guiLeft + 50, y, config.scaleX - 0.5f)); + addButton(new GuiNpcButton(170, guiLeft + 8, y, 40, 20, "Reset")); y += 22; - addLabel(new GuiNpcLabel(11, "Height", guiLeft, y + 5, 0xFFFFFF)); + addLabel(new GuiNpcLabel(11, "Height", guiLeft - 25, y + 5, 0xFFFFFF)); addSlider(new GuiNpcSlider(this, 11, guiLeft + 50, y, config.scaleY - 0.5f)); + addButton(new GuiNpcButton(171, guiLeft + 8, y, 40, 20, "Reset")); y += 22; - addLabel(new GuiNpcLabel(12, "Depth", guiLeft, y + 5, 0xFFFFFF)); + addLabel(new GuiNpcLabel(12, "Depth", guiLeft - 25, y + 5, 0xFFFFFF)); addSlider(new GuiNpcSlider(this, 12, guiLeft + 50, y, config.scaleZ - 0.5f)); + addButton(new GuiNpcButton(172, guiLeft + 8, y, 40, 20, "Reset")); } @Override protected void actionPerformed(GuiButton btn) { super.actionPerformed(btn); + if(btn.id < 4){ type = btn.id; initGui(); } + + // Resetting Type + ModelPartConfig config = playerdata.head; + if(type == 1) + config = playerdata.body; + else if(type == 2) + config = playerdata.arms; + else if(type == 3) + config = playerdata.legs; + + + if(btn.id == 170){ + System.out.println(config.scaleX); + System.out.println(config.scaleY); + System.out.println(config.scaleZ); + } + } @Override diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java index 07242d2ca..1d4844e25 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -267,8 +267,11 @@ public class RenderNPCInterface extends RenderLiving{ EntityNPCInterface npc = (EntityNPCInterface) entity; if(npc.textureLocation == null){ - if(npc.display.skinType == 0) - npc.textureLocation = new ResourceLocation(npc.display.texture); + if(npc.display.skinType == 0) { + if (!(npc.display.texture).equals("")) { + npc.textureLocation = new ResourceLocation(npc.display.texture); + } + } else if(LastTextureTick < 5){ //fixes request flood somewhat return AbstractClientPlayer.locationStevePng; }