From 2b15ba9197b5e8d30dd1d5508340a54381fb2a8c Mon Sep 17 00:00:00 2001 From: "Luis C.M" Date: Sat, 28 May 2022 02:12:33 -0500 Subject: [PATCH 1/6] Fixed x64 texture bug, breaking textures after switching the model type from x64 to x32 Fixed crash report handler issue with custom overlays. Removed "textureGlowLocation" field, which is unused now. --- src/main/java/noppes/npcs/DataDisplay.java | 1 - .../java/noppes/npcs/client/EntityUtil.java | 1 - .../client/gui/GuiNpcTextureOverlays.java | 2 +- .../client/gui/mainmenu/GuiNpcDisplay.java | 12 ++++---- .../client/gui/model/GuiCreationScreen.java | 3 +- .../client/gui/model/GuiEntitySelection.java | 1 - .../client/renderer/RenderCNPCPlayer.java | 9 ++++++ .../client/renderer/RenderNPCInterface.java | 29 ++++++++++++------- .../npcs/entity/EntityNPCInterface.java | 1 - 9 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/main/java/noppes/npcs/DataDisplay.java b/src/main/java/noppes/npcs/DataDisplay.java index 15dbe469a..678b06e94 100644 --- a/src/main/java/noppes/npcs/DataDisplay.java +++ b/src/main/java/noppes/npcs/DataDisplay.java @@ -184,7 +184,6 @@ public class DataDisplay { if(prevSkinType != skinType || !texture.equals(prevTexture)) npc.textureLocation = null; - npc.textureGlowLocation = null; npc.textureCloakLocation = null; npc.updateHitbox(); } diff --git a/src/main/java/noppes/npcs/client/EntityUtil.java b/src/main/java/noppes/npcs/client/EntityUtil.java index 8da93fe43..e8a9c7523 100644 --- a/src/main/java/noppes/npcs/client/EntityUtil.java +++ b/src/main/java/noppes/npcs/client/EntityUtil.java @@ -90,7 +90,6 @@ public class EntityUtil { EntityNPCInterface target = (EntityNPCInterface) entity; target.textureLocation = npc.textureLocation; - target.textureGlowLocation = npc.textureGlowLocation; target.textureCloakLocation = npc.textureCloakLocation; target.display = npc.display; target.inventory = npc.inventory; diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java b/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java index 4a67adc62..d0152dcd6 100644 --- a/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java @@ -77,7 +77,7 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{ public void elementClicked(){ if(dataTextures.contains(slot.selected) && slot.selected != null){ //npc.display.glowTexture = assets.getAsset(slot.selected); - npc.textureGlowLocation = null; + //npc.textureGlowLocation = null; npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay( assets.getAsset(slot.selected), true, 1.0F, 1.0F, 0.0F, 0.0F, diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java index f6423f312..2c1621059 100644 --- a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java @@ -129,12 +129,14 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene display.cloakTexture = textfield.getText(); } else if(textfield.id == 9){ - npc.textureGlowLocation = null; + //npc.textureGlowLocation = null; //display.glowTexture = textfield.getText(); - npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay( - textfield.getText(), true, 1.0F, 1.0F, 0.0F, 0.0F, - 1.0F, 1.0F, 0.0F, 0.0F, 0.0F - )); + if (!textfield.getText().isEmpty()) { + npc.display.skinOverlayData.overlayList.put(0, new SkinOverlay( + textfield.getText(), true, 1.0F, 1.0F, 0.0F, 0.0F, + 1.0F, 1.0F, 0.0F, 0.0F, 0.0F + )); + } } else if(textfield.id == 11){ display.title = textfield.getText(); diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java index 82c5a76ef..f7d6f2c75 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -231,7 +231,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol //npc.display.glowTexture = ""; npc.display.skinOverlayData.overlayList.remove(0); npc.textureLocation = null; - npc.textureGlowLocation = null; npc.updateHitbox(); } catch(Exception ex){ @@ -286,6 +285,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol } npc.display.modelType = 0; } + npc.textureLocation = null; } if(button.id == 8){ @@ -339,7 +339,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol //npc.display.glowTexture = ""; npc.display.skinOverlayData.overlayList.remove(0); npc.textureLocation = null; - npc.textureGlowLocation = null; npc.updateHitbox(); } catch(Exception ex){ diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java b/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java index 15704114e..0e124d88e 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java @@ -129,7 +129,6 @@ public class GuiEntitySelection extends GuiNPCInterface //npc.display.glowTexture = ""; npc.display.skinOverlayData.overlayList.remove(0); npc.textureLocation = null; - npc.textureGlowLocation = null; npc.updateHitbox(); } catch(Exception ex){ diff --git a/src/main/java/noppes/npcs/client/renderer/RenderCNPCPlayer.java b/src/main/java/noppes/npcs/client/renderer/RenderCNPCPlayer.java index c8c005025..fe913ebe1 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderCNPCPlayer.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderCNPCPlayer.java @@ -48,6 +48,9 @@ public class RenderCNPCPlayer extends RenderPlayer { private boolean preRenderOverlay(EntityPlayer player, ResourceLocation overlayLocation, boolean glow, float alpha, float size, float speedX, float speedY, float scaleX, float scaleY, float offsetX, float offsetY, float offsetZ) { + if (overlayLocation.getResourcePath().isEmpty()) + return false; + try { this.bindTexture(overlayLocation); } catch (Exception exception) { @@ -112,6 +115,9 @@ public class RenderCNPCPlayer extends RenderPlayer { { if (Client.skinOverlays.containsKey(player.getUniqueID())) { for (SkinOverlay overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) { + if (overlayData.texture.isEmpty()) + continue; + if (overlayData.location == null) { overlayData.location = new ResourceLocation(overlayData.texture); } else { @@ -312,6 +318,9 @@ public class RenderCNPCPlayer extends RenderPlayer { if (Client.skinOverlays.containsKey(player.getUniqueID())) { for (SkinOverlay overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) { + if (overlayData.texture.isEmpty()) + continue; + if (overlayData.location == null) { overlayData.location = new ResourceLocation(overlayData.texture); } else { diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java index 74f428de9..9f79fb06d 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -22,6 +22,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.BossStatus; +import net.minecraft.util.ReportedException; import net.minecraft.util.ResourceLocation; import noppes.npcs.client.ImageDownloadAlt; import noppes.npcs.client.model.ModelMPM; @@ -221,6 +222,9 @@ public class RenderNPCInterface extends RenderLiving{ if (!npc.display.skinOverlayData.overlayList.isEmpty()) { for (ISkinOverlay overlayData : npc.display.skinOverlayData.overlayList.values()) { try { + if (overlayData.getTexture().isEmpty()) + continue; + if (overlayData.getLocation() == null) { overlayData.setLocation(new ResourceLocation(overlayData.getTexture())); } else { @@ -230,7 +234,12 @@ public class RenderNPCInterface extends RenderLiving{ } } - this.bindTexture(overlayData.getLocation()); + if (overlayData.getLocation().getResourcePath().isEmpty()) + continue; + + try { + this.bindTexture(overlayData.getLocation()); + } catch (Exception e) { continue; } // Overlay & Glow GL11.glEnable(GL11.GL_BLEND); @@ -340,13 +349,12 @@ public class RenderNPCInterface extends RenderLiving{ } private ResourceLocation adjustLocalTexture(EntityNPCInterface npc, ResourceLocation location) throws IOException { - if (npc.display.modelType != 0) { - return location; - } - InputStream inputstream = null; try { + TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); + texturemanager.deleteTexture(location); + IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(location); inputstream = iresource.getInputStream(); @@ -355,15 +363,14 @@ public class RenderNPCInterface extends RenderLiving{ int totalWidth = bufferedimage.getWidth(); int totalHeight = bufferedimage.getHeight(); - if (totalHeight > 32) { + if (totalHeight > 32 && npc.display.modelType == 0) { bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32); - - TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); - ImageDownloadAlt object = new ImageDownloadAlt(null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false)); - object.setBufferedImage(bufferedimage); - texturemanager.loadTexture(location, object); } + ImageDownloadAlt object = new ImageDownloadAlt(null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false)); + object.setBufferedImage(bufferedimage); + texturemanager.loadTexture(location, object); + return location; } finally { if (inputstream != null) { diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java index 9f7719377..904b11d15 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -128,7 +128,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public List interactingEntities = new ArrayList(); public ResourceLocation textureLocation = null; - public ResourceLocation textureGlowLocation = null; public ResourceLocation textureCloakLocation = null; public EnumAnimation currentAnimation = EnumAnimation.NONE; From 4aa1799ec398cc3506e4d6bd63a5c2cbfdf5232f Mon Sep 17 00:00:00 2001 From: "Luis C.M" Date: Sat, 28 May 2022 05:53:14 -0500 Subject: [PATCH 2/6] Alex and Steve skins now switch to x64 or x32 models automatically. --- src/main/java/noppes/npcs/DataDisplay.java | 1 + .../client/gui/model/GuiCreationScreen.java | 38 ++++++++++--------- .../noppes/npcs/client/model/ModelMPM.java | 26 +++++++++---- .../npcs/client/renderer/RenderCustomNpc.java | 2 +- .../client/renderer/RenderNPCHumanMale.java | 29 ++++++++++++-- .../client/renderer/RenderNPCInterface.java | 3 +- 6 files changed, 69 insertions(+), 30 deletions(-) diff --git a/src/main/java/noppes/npcs/DataDisplay.java b/src/main/java/noppes/npcs/DataDisplay.java index 678b06e94..6a5582f2b 100644 --- a/src/main/java/noppes/npcs/DataDisplay.java +++ b/src/main/java/noppes/npcs/DataDisplay.java @@ -46,6 +46,7 @@ public class DataDisplay { public int showName = 0; public int modelType = 0; + public boolean x64texture = false; public boolean disableLivingAnimation = false; diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java index f7d6f2c75..23b39ed08 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -110,25 +110,25 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol addButton(new GuiNpcButton(7, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); addLabel(new GuiNpcLabel(4, "Legs", guiLeft, y + 5, 0xFFFFFF)); - addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Default","Steve64","Alex"}, this.npc.display.modelType)); + addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Default","Steve64","Alex","Alex32"}, this.npc.display.modelType)); addLabel(new GuiNpcLabel(250, "Model", guiLeft, y + 5, 0xFFFFFF)); - + addButton(new GuiNpcButton(44, guiLeft + 310, guiTop + 14, 80, 20, "Save Model")); addButton(new GuiNpcButton(45, guiLeft + 310, guiTop + 36, 80, 20, "Load Model")); - - + + } - + private void showPixelmonMenu(EntityLivingBase entity) { GuiCustomScroll scroll = new GuiCustomScroll(this, 0); scroll.setSize(120, 200); scroll.guiLeft = guiLeft; scroll.guiTop = guiTop + 20; addScroll(scroll); - + scroll.setList(PixelmonHelper.getPixelmonList()); scroll.setSelected(PixelmonHelper.getName(entity)); - + Minecraft.getMinecraft().thePlayer.sendChatMessage(PixelmonHelper.getName(entity)); } @@ -137,7 +137,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol if(entity instanceof EntityNPCInterface) return; int y = guiTop + 20; - + NBTTagCompound compound = getExtras(entity); Set keys = compound.func_150296_c(); int i = 0; @@ -159,7 +159,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol i++; addLabel(new GuiNpcLabel(100 + i, name, guiLeft, y + 5 + i * 22, 0xFFFFFF)); addButton(new GuiNpcButton(100 + i, guiLeft + 80, y + i * 22, 50, 20, new String[]{"gui.no","gui.yes"}, b)); - + mapped.put(i, name); } } @@ -169,7 +169,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol Method method = entity.getClass().getMethod("getBreedID"); breed = (Integer) method.invoke(entity); } catch (Exception e) { - + } i++; addLabel(new GuiNpcLabel(201, "Breed", guiLeft, y + 5 + i * 22, 0xFFFFFF)); @@ -186,18 +186,18 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol private NBTTagCompound getExtras(EntityLivingBase entity) { NBTTagCompound fake = new NBTTagCompound(); new EntityFakeLiving(entity.worldObj).writeEntityToNBT(fake); - + NBTTagCompound compound = new NBTTagCompound(); try{ entity.writeEntityToNBT(compound); } catch(Exception e){ - + } Set keys = fake.func_150296_c(); for(String name : keys) compound.removeTag(name); - + return compound; } @@ -221,7 +221,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol } else{ playerdata.setEntityClass(data.get(list.get(index))); - + EntityLivingBase entity = playerdata.getEntity(npc); if(entity != null){ RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); @@ -246,10 +246,10 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol playerdata.setEntityClass(data.get(list.get(index))); updateTexture(); - + initGui(); } - + if(button.id == 1){ this.mc.displayGuiScreen(new GuiEntitySelection(this, playerdata, npc)); } @@ -283,7 +283,11 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol if (npc.display.skinType == 3){ npc.display.skinType = 2; } - npc.display.modelType = 0; + if (npc.display.modelType == 2) { + npc.display.modelType = 3; + } else { + npc.display.modelType = 0; + } } npc.textureLocation = null; } diff --git a/src/main/java/noppes/npcs/client/model/ModelMPM.java b/src/main/java/noppes/npcs/client/model/ModelMPM.java index a4d158aa0..01f251ac4 100644 --- a/src/main/java/noppes/npcs/client/model/ModelMPM.java +++ b/src/main/java/noppes/npcs/client/model/ModelMPM.java @@ -194,7 +194,7 @@ public class ModelMPM extends ModelNPCMale{ } // Steve 64x32 - public ModelMPM(float par1) { + public ModelMPM(float par1, int alexArms) { super(par1); isArmor = par1 > 0; @@ -219,14 +219,24 @@ public class ModelMPM extends ModelNPCMale{ this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1); this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F); - this.bipedRightArm = new ModelScaleRenderer(this, 40, 16); - this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1); - this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F); + if (alexArms == 0) { + this.bipedRightArm = new ModelScaleRenderer(this, 40, 16); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F); - this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16); - this.bipedLeftArm.mirror = true; - this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1); - this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F); + this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F); + } else { + this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16)); + this.bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1); + + this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.5F + par2, 0.0F); + } this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16); this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); diff --git a/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java b/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java index 51a0ff9aa..22c619b99 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java @@ -29,7 +29,7 @@ public class RenderCustomNpc extends RenderNPCHumanMale{ // Default Renderer public RenderCustomNpc() { - super(new ModelMPM(0), new ModelMPM(1), new ModelMPM(0.5f)); + super(new ModelMPM(0,0), new ModelMPM(1,0), new ModelMPM(0.5f,0)); } @Override diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java index b2ef80bab..0a10dc8a6 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java @@ -37,6 +37,10 @@ public class RenderNPCHumanMale extends RenderNPCInterface protected final static ModelMPM steve64 = new ModelMPM(0, false); protected final static ModelMPM alex = new ModelMPM(0, true); + protected final static ModelMPM alex32mainmodel = new ModelMPM(0,1); + protected final static ModelMPM alex32armorChest = new ModelMPM(1,1); + protected final static ModelMPM alex32armor = new ModelMPM(0.5F,1); + public RenderNPCHumanMale(ModelNPCMale mainmodel, ModelNPCMale armorChest, ModelNPCMale armor) { super(mainmodel, 0.5F); @@ -115,13 +119,32 @@ public class RenderNPCHumanMale extends RenderNPCInterface EntityCustomNpc test = (EntityCustomNpc) npc; if(test.modelData.entityClass == null){ int modelVal = npc.display.modelType; - if(modelVal == 1){ + if(modelVal == 1 && npc.display.x64texture){ this.mainModel = steve64; this.modelBipedMain = steve64; } else if(modelVal == 2){ - this.mainModel = alex; - this.modelBipedMain = alex; + if (npc.display.x64texture) { + this.mainModel = alex; + this.modelBipedMain = alex; + } else { + ((EntityCustomNpc) npc).modelData.bodywear = 0; + ((EntityCustomNpc) npc).modelData.armwear = 0; + ((EntityCustomNpc) npc).modelData.legwear = 0; + this.mainModel = alex32mainmodel; + this.modelBipedMain = alex32mainmodel; + this.modelArmorChestplate = alex32armorChest; + this.modelArmor = alex32armor; + } + } + else if(modelVal == 3){ + ((EntityCustomNpc) npc).modelData.bodywear = 0; + ((EntityCustomNpc) npc).modelData.armwear = 0; + ((EntityCustomNpc) npc).modelData.legwear = 0; + this.mainModel = alex32mainmodel; + this.modelBipedMain = alex32mainmodel; + this.modelArmorChestplate = alex32armorChest; + this.modelArmor = alex32armor; } else{ ((EntityCustomNpc) npc).modelData.bodywear = 0; diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java index 9f79fb06d..9291bbd37 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -363,7 +363,8 @@ public class RenderNPCInterface extends RenderLiving{ int totalWidth = bufferedimage.getWidth(); int totalHeight = bufferedimage.getHeight(); - if (totalHeight > 32 && npc.display.modelType == 0) { + npc.display.x64texture = totalHeight > 32; + if (npc.display.x64texture && (npc.display.modelType == 0 || npc.display.modelType == 3)) { bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32); } From 379ad697069eae1a169d88477e94f4cb1e921691 Mon Sep 17 00:00:00 2001 From: "Luis C.M" Date: Sat, 28 May 2022 06:22:39 -0500 Subject: [PATCH 3/6] Options for modelType are now only Steve and Alex. --- .../npcs/client/gui/model/GuiCreationScreen.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java index 23b39ed08..7af974f86 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -110,7 +110,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol addButton(new GuiNpcButton(7, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); addLabel(new GuiNpcLabel(4, "Legs", guiLeft, y + 5, 0xFFFFFF)); - addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Default","Steve64","Alex","Alex32"}, this.npc.display.modelType)); + addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Steve","Alex"}, this.npc.display.modelType/2)); addLabel(new GuiNpcLabel(250, "Model", guiLeft, y + 5, 0xFFFFFF)); addButton(new GuiNpcButton(44, guiLeft + 310, guiTop + 14, 80, 20, "Save Model")); @@ -270,24 +270,16 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol // New Button for Changing Models // URL Swapper if(button.id == 250){ + npc.display.modelType = button.getValue() * 2; + if(npc.display.modelType == 0){ if (npc.display.skinType == 2){ npc.display.skinType = 3; } - npc.display.modelType = 1; - } - else if(npc.display.modelType == 1){ - npc.display.modelType = 2; - } - else { + } else if(npc.display.modelType == 2) { if (npc.display.skinType == 3){ npc.display.skinType = 2; } - if (npc.display.modelType == 2) { - npc.display.modelType = 3; - } else { - npc.display.modelType = 0; - } } npc.textureLocation = null; } From c083412723d0b3611297a15905581280d61aeec0 Mon Sep 17 00:00:00 2001 From: "Luis C.M" Date: Sat, 28 May 2022 06:30:10 -0500 Subject: [PATCH 4/6] Fixed armor error on alex models. --- .../java/noppes/npcs/client/renderer/RenderNPCHumanMale.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java index 0a10dc8a6..e0615c6c7 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java @@ -133,8 +133,6 @@ public class RenderNPCHumanMale extends RenderNPCInterface ((EntityCustomNpc) npc).modelData.legwear = 0; this.mainModel = alex32mainmodel; this.modelBipedMain = alex32mainmodel; - this.modelArmorChestplate = alex32armorChest; - this.modelArmor = alex32armor; } } else if(modelVal == 3){ @@ -143,8 +141,6 @@ public class RenderNPCHumanMale extends RenderNPCInterface ((EntityCustomNpc) npc).modelData.legwear = 0; this.mainModel = alex32mainmodel; this.modelBipedMain = alex32mainmodel; - this.modelArmorChestplate = alex32armorChest; - this.modelArmor = alex32armor; } else{ ((EntityCustomNpc) npc).modelData.bodywear = 0; From 968b43a3213d895a288422cda75390d3f5f125a4 Mon Sep 17 00:00:00 2001 From: "Luis C.M" Date: Sat, 28 May 2022 06:31:52 -0500 Subject: [PATCH 5/6] setModelType() only takes 0 for Steve, or 1 for Alex as values. --- src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java index 29074db9d..323a522e3 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java @@ -73,14 +73,14 @@ public class ScriptNpc extends ScriptLiving imp } /** - * @param modelType The modelType of the NPC. 0: Steve, 1: Steve64, 2: Alex + * @param modelType The modelType of the NPC. 0: Steve, 1: Alex */ public void setModelType(int modelType){ - if(modelType > 2) - modelType = 2; + if(modelType > 1) + modelType = 1; else if(modelType < 0) modelType = 0; - npc.display.modelType = modelType; + npc.display.modelType = modelType * 2; npc.script.clientNeedsUpdate = true; } From 0028328db4397341958b9b2d649be1f06607efe0 Mon Sep 17 00:00:00 2001 From: "Luis C.M" Date: Sat, 28 May 2022 07:06:38 -0500 Subject: [PATCH 6/6] More fixes to setting NPC model types. --- .../noppes/npcs/client/gui/model/GuiCreationScreen.java | 6 +++--- .../noppes/npcs/client/renderer/RenderNPCInterface.java | 6 ++++-- src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java index 7af974f86..9c8f5c36d 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -270,13 +270,13 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol // New Button for Changing Models // URL Swapper if(button.id == 250){ - npc.display.modelType = button.getValue() * 2; + npc.display.modelType = button.displayString.equals("Alex") ? 2 : 1; - if(npc.display.modelType == 0){ + if(npc.display.modelType == 1){ if (npc.display.skinType == 2){ npc.display.skinType = 3; } - } else if(npc.display.modelType == 2) { + } else { if (npc.display.skinType == 3){ npc.display.skinType = 2; } diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java index 9291bbd37..254c3ef16 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -364,8 +364,10 @@ public class RenderNPCInterface extends RenderLiving{ int totalHeight = bufferedimage.getHeight(); npc.display.x64texture = totalHeight > 32; - if (npc.display.x64texture && (npc.display.modelType == 0 || npc.display.modelType == 3)) { - bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32); + if (npc.display.x64texture) { + if (npc.display.modelType == 0 || npc.display.modelType == 3) { + bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32); + } } ImageDownloadAlt object = new ImageDownloadAlt(null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false)); diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java index 323a522e3..ef258ed41 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java @@ -80,7 +80,7 @@ public class ScriptNpc extends ScriptLiving imp modelType = 1; else if(modelType < 0) modelType = 0; - npc.display.modelType = modelType * 2; + npc.display.modelType = modelType + 1; npc.script.clientNeedsUpdate = true; }