diff --git a/src/main/java/noppes/npcs/DataDisplay.java b/src/main/java/noppes/npcs/DataDisplay.java index 043caa3c3..9fc3c878a 100644 --- a/src/main/java/noppes/npcs/DataDisplay.java +++ b/src/main/java/noppes/npcs/DataDisplay.java @@ -31,13 +31,13 @@ public class DataDisplay { public int modelSize = 5; public int showName = 0; - + + public int modelType = 0; + public boolean disableLivingAnimation = false; public byte showBossBar = 0; - public byte squareTexture = 0; - public DataDisplay(EntityNPCInterface npc){ this.npc = npc; String[] names = { "Noppes", "Noppes", "Noppes", "Noppes", "Atesson", @@ -73,7 +73,7 @@ public class DataDisplay { nbttagcompound.setString("CloakTexture", cloakTexture); nbttagcompound.setString("GlowTexture", glowTexture); nbttagcompound.setByte("UsingSkinUrl", skinType); - + if (this.playerProfile != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); @@ -82,13 +82,14 @@ public class DataDisplay { } nbttagcompound.setInteger("Size", modelSize); + nbttagcompound.setInteger("modelType", modelType); nbttagcompound.setInteger("ShowName", showName); nbttagcompound.setInteger("NpcVisible", visible); nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation); nbttagcompound.setByte("BossBar", showBossBar); - nbttagcompound.setByte("SquareTexture", squareTexture); + // nbttagcompound.setByte("SquareTexture", squareTexture); return nbttagcompound; } @@ -117,14 +118,15 @@ public class DataDisplay { cloakTexture = nbttagcompound.getString("CloakTexture"); glowTexture = nbttagcompound.getString("GlowTexture"); - modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 30); + modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 40); + modelType = nbttagcompound.getInteger("modelType"); showName = nbttagcompound.getInteger("ShowName"); visible = nbttagcompound.getInteger("NpcVisible"); disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation"); showBossBar = nbttagcompound.getByte("BossBar"); - squareTexture = nbttagcompound.getByte("SquareTexture"); + // squareTexture = nbttagcompound.getByte("SquareTexture"); if(prevSkinType != skinType || !texture.equals(prevTexture)) npc.textureLocation = null; 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 375cc341b..8d13ed31b 100644 --- a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java @@ -76,8 +76,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0)); // Square Texture Button - addLabel(new GuiNpcLabel(300,"display.squareTexture", guiLeft + 230, y + 5)); - this.addButton(new GuiNpcButton(300, guiLeft + 313, y, 50, 20, new String[]{"gui.no","gui.yes"}, display.squareTexture)); + // addLabel(new GuiNpcLabel(300,"display.squareTexture", guiLeft + 230, y + 5)); + // this.addButton(new GuiNpcButton(300, guiLeft + 313, y, 50, 20, new String[]{"gui.no","gui.yes"}, display.squareTexture)); y+=23; addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5)); @@ -150,9 +150,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene else if(button.id == 7){ display.visible = button.getValue(); } - else if(button.id == 300){ - display.squareTexture = (byte)button.getValue(); - } + // else if(button.id == 300){ + // display.squareTexture = (byte)button.getValue(); + // } else if(button.id == 8){ NoppesUtil.openGUI(player, new GuiNpcTextureCloaks(npc, this)); } 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 b3d2284ce..a99288102 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -42,7 +42,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol private final String[] ignoredTags = {"CanBreakDoors", "Bred", "PlayerCreated", "Tame", "HasReproduced"}; private GuiNpcButton prev,next; - + private GuiScreen parent; private HashMap mapped = new HashMap(); @@ -54,7 +54,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol for(Object name : mapping.keySet()){ Class c = (Class) mapping.get(name); try { - if(!EntityCustomNpc.class.isAssignableFrom(c) && !EntityCustomNpc64.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){ + if(!EntityCustomNpc.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){ if(RenderManager.instance.getEntityClassRenderObject(c) instanceof RendererLivingEntity) data.put(name.toString(),c.asSubclass(EntityLivingBase.class)); } @@ -111,6 +111,9 @@ 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)); + 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")); @@ -265,6 +268,20 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol if(button.id == 7){ this.mc.displayGuiScreen(new GuiModelLegs(this, npc)); } + + // New Button for Changing Models + if(button.id == 250){ + if(npc.display.modelType == 0){ + npc.display.modelType = 1; + } + else if(npc.display.modelType == 1){ + npc.display.modelType = 2; + } + else { + npc.display.modelType = 0; + } + } + if(button.id == 8){ this.mc.displayGuiScreen(new GuiModelScale(this, playerdata, npc)); } 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 2f10da803..d2788cc1d 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java @@ -46,8 +46,9 @@ public class GuiEntitySelection extends GuiNPCInterface list.add("CustomNPC"); Collections.sort(list,String.CASE_INSENSITIVE_ORDER); slot = new GuiNPCStringSlot(list,this,false,18); - if(playerdata.getEntityClass() != null) - slot.selected = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass()); + if(playerdata.getEntityClass() != null){ + slot.selected = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass()); + } else{ slot.selected = "CustomNPC"; } @@ -121,6 +122,7 @@ public class GuiEntitySelection extends GuiNPCInterface if(entity != null){ RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); npc.display.texture = NPCRendererHelper.getTexture(render,entity); + npc.display.modelType = 0; } else{ npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; 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 805bcb1a4..041d63f67 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java @@ -67,7 +67,6 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{ addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "Edit")); y += 24; } - } private void drawSlider(int y, ModelPartConfig config){ diff --git a/src/main/java/noppes/npcs/client/model/ModelMPM.java b/src/main/java/noppes/npcs/client/model/ModelMPM.java index 5d0505869..70b8a721f 100644 --- a/src/main/java/noppes/npcs/client/model/ModelMPM.java +++ b/src/main/java/noppes/npcs/client/model/ModelMPM.java @@ -118,6 +118,7 @@ public class ModelMPM extends ModelNPCMale{ } } + // Steve 64x64 and Alex 64x64 public ModelMPM(float par1, boolean arms) { super(par1, true); diff --git a/src/main/java/noppes/npcs/client/model/ModelMPM64.java b/src/main/java/noppes/npcs/client/model/ModelMPM64.java deleted file mode 100644 index 835cbc9d3..000000000 --- a/src/main/java/noppes/npcs/client/model/ModelMPM64.java +++ /dev/null @@ -1,73 +0,0 @@ -package noppes.npcs.client.model; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.MathHelper; -import noppes.npcs.ModelPartConfig; -import noppes.npcs.ModelPartData; -import noppes.npcs.client.ClientProxy; -import noppes.npcs.client.model.animation.AniCrawling; -import noppes.npcs.client.model.animation.AniHug; -import noppes.npcs.client.model.part.*; -import noppes.npcs.client.model.util.ModelPartInterface; -import noppes.npcs.client.model.util.ModelScaleRenderer; -import noppes.npcs.constants.EnumAnimation; -import noppes.npcs.constants.EnumJobType; -import noppes.npcs.entity.EntityCustomNpc; -import noppes.npcs.roles.JobPuppet; -import org.lwjgl.opengl.GL11; - -import java.util.Random; - -public class ModelMPM64 extends ModelMPM{ - - public EntityLivingBase entity; - public boolean isArmor; - - public ModelMPM64(float par1) { - super(par1); - this.textureHeight = 64; - this.textureWidth = 64; - - isArmor = par1 > 0; - float par2 = 0; - this.bipedCloak = new ModelRenderer(this, 0, 0); - this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1); - this.bipedEars = new ModelRenderer(this, 24, 0); - this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1); - this.bipedHead = new ModelScaleRenderer(this, 0, 0); - this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1); - this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F); - this.bipedHeadwear = new ModelScaleRenderer(this, 32, 0); - this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F); - this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F); - this.bipedBody = new ModelScaleRenderer(this, 16, 16); - 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); - - this.bipedLeftArm = new ModelScaleRenderer(this, 32, 48); - this.bipedLeftArm.mirror = false; - this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1); - this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F); - - this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16); - this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); - this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F); - - - this.bipedLeftLeg = new ModelScaleRenderer(this, 16, 48); - this.bipedLeftLeg.mirror = false; - this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); - this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F); - - } -} - diff --git a/src/main/java/noppes/npcs/client/model/ModelNPCMale.java b/src/main/java/noppes/npcs/client/model/ModelNPCMale.java index 05b80fa6b..43a5af7e3 100644 --- a/src/main/java/noppes/npcs/client/model/ModelNPCMale.java +++ b/src/main/java/noppes/npcs/client/model/ModelNPCMale.java @@ -21,15 +21,19 @@ public class ModelNPCMale extends ModelBiped public float animationTick; public float dancingTicks; + public float randomFloat; + public ModelNPCMale(float f) { init(f, 0.0F); + randomFloat = f; } public ModelNPCMale(float f, boolean newSteve) { super(f, 0.0F, 64, 64); init(f, 0.0F, true); + randomFloat = f; } @Override diff --git a/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java b/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java index a70ca8cd5..84e304aa4 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java @@ -2,6 +2,7 @@ package noppes.npcs.client.renderer; import java.lang.reflect.Method; +import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.NPCRendererHelper; import net.minecraft.client.renderer.entity.RenderManager; @@ -9,8 +10,10 @@ import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.BossStatus; import noppes.npcs.client.model.ModelMPM; import noppes.npcs.client.model.util.ModelRenderPassHelper; +import noppes.npcs.constants.EnumStandingType; import noppes.npcs.controllers.PixelmonHelper; import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityNPCInterface; @@ -114,6 +117,13 @@ public class RenderCustomNpc extends RenderNPCHumanMale{ super.preRenderCallback(entityliving, f); } + @Override + public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){ + EntityNPCInterface npc = (EntityNPCInterface) entityliving; + + super.doRender(entityliving, d, d1, d2, f, f1); + } + @Override protected float handleRotationFloat(EntityLivingBase par1EntityLivingBase, float par2){ if(renderEntity != null){ diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java index a45bde7fa..196bd722c 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -36,8 +36,11 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; public class RenderNPCInterface extends RenderLiving{ public static long LastTextureTick = 0; + private ModelBase originalModel; + public RenderNPCInterface(ModelBase model, float f){ super(model, f); + this.originalModel = model; } protected void renderName(EntityNPCInterface npc, double d, double d1, double d2) { @@ -216,6 +219,18 @@ public class RenderNPCInterface extends RenderLiving{ @Override public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){ EntityNPCInterface npc = (EntityNPCInterface) entityliving; + + int modelVal = npc.display.modelType; + if(modelVal == 0){ + this.mainModel = this.originalModel; + } + else if(modelVal == 1){ + this.mainModel = new ModelMPM(0, false); + } + else{ + this.mainModel = new ModelMPM(0, true); + } + if(npc.isKilled() && npc.stats.hideKilledBody && npc.deathTime > 20){ return; } @@ -227,7 +242,7 @@ public class RenderNPCInterface extends RenderLiving{ } super.doRender(entityliving, d, d1, d2, f, f1); } - + protected void renderModel(EntityLivingBase entityliving, float par2, float par3, float par4, float par5, float par6, float par7){ super.renderModel(entityliving, par2, par3, par4, par5, par6, par7); EntityNPCInterface npc = (EntityNPCInterface) entityliving; @@ -311,7 +326,7 @@ public class RenderNPCInterface extends RenderLiving{ } npc.textureLocation = new ResourceLocation("skins/" + sb.toString()); - if(npc.display.squareTexture == 1){ versionModel = true; } + // if(npc.display.squareTexture == 1){ versionModel = true; } loadSkin(null, npc.textureLocation, npc.display.url, versionModel); LastTextureTick = 0; diff --git a/src/main/java/noppes/npcs/entity/EntityCustomNpc.java b/src/main/java/noppes/npcs/entity/EntityCustomNpc.java index a4198484c..b6c4316ca 100644 --- a/src/main/java/noppes/npcs/entity/EntityCustomNpc.java +++ b/src/main/java/noppes/npcs/entity/EntityCustomNpc.java @@ -76,5 +76,6 @@ public class EntityCustomNpc extends EntityNPCInterface{ this.setPosition(posX, posY, posZ); } } + } \ No newline at end of file diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java index f3536f887..d3a2ddcb2 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -166,6 +166,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public long totalTicksAlive = 0; private int taskCount = 1; public int lastInteract = 0; + public Faction faction; //should only be used server side private EntityAIRangedAttack aiRange; @@ -1692,4 +1693,14 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public boolean shouldDismountInWater(Entity rider){ return false; } + + // Model Types: 0: Steve 64x32, 1: Steve 64x64, 2: Alex 64x64 + public int getModelType() + { + return this.display.modelType; + } + public void setModelType(int val) + { + this.display.modelType = val; + } }