From 79339be79a0f62351a0a2a861f9b7f0ceeb8aad4 Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Fri, 24 Sep 2021 16:50:28 -0400 Subject: [PATCH 1/4] Bow Change Attempting to Fix Custom Bows --- .../npcs/client/renderer/RenderNPCHumanMale.java | 10 ++++------ .../noppes/npcs/client/renderer/RenderNPCPony.java | 8 +++----- .../java/noppes/npcs/entity/EntityNPCInterface.java | 6 ++++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java index d88b5e488..b7410dc66 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java @@ -12,10 +12,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; +import net.minecraft.item.*; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.ForgeHooksClient; @@ -272,7 +269,8 @@ public class RenderNPCHumanMale extends RenderNPCInterface GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-var6, -var6, var6); } - else if (itemstack2.getItem() == Items.bow) + // CHANGE HERE + else if (itemstack2.getItem() instanceof ItemBow) { var6 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); @@ -364,7 +362,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(var6, -var6, var6); } - else if (itemstack2.getItem() == Items.bow) + else if (itemstack2.getItem() instanceof ItemBow) { var6 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java index 17e236858..013a77b8c 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java @@ -17,11 +17,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; +import net.minecraft.item.*; import net.minecraft.item.ItemArmor.ArmorMaterial; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import noppes.npcs.client.model.ModelPony; import noppes.npcs.client.model.ModelPonyArmor; @@ -222,7 +219,8 @@ public class RenderNPCPony extends RenderNPCInterface float f4 = 0.375F * f; GL11.glScalef(f4, -f4, f4); } else - if(itemstack.getItem() == Items.bow) + // CHANGE HERE + if(itemstack.getItem() instanceof ItemBow) { GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20F, 0.0F, 1.0F, 0.0F); diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java index c8e4731d2..c33e0f52c 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -26,6 +26,7 @@ import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.pathfinding.PathNavigate; @@ -1260,8 +1261,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti @Override public IIcon getItemIcon(ItemStack par1ItemStack, int par2){ - if (par1ItemStack.getItem() == Items.bow){ - return Items.bow.getIcon(par1ItemStack, par2); + // Change Here + if (par1ItemStack.getItem() instanceof ItemBow){ + return par1ItemStack.getItem().getIcon(par1ItemStack, par2); } EntityPlayer player = CustomNpcs.proxy.getPlayer(); if(player == null) From 69877e8edf0c6dceccb4002b4585bc55ad6070d5 Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Fri, 24 Sep 2021 17:00:41 -0400 Subject: [PATCH 2/4] 1.2.2 Bow Fix --- build.gradle | 2 +- src/main/java/noppes/npcs/CustomNpcs.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5695c93b2..7f1b19627 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.2.1" +version = "1.2.2" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "CustomNPC-Plus" diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index 742c15966..f142e5026 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -60,7 +60,7 @@ import noppes.npcs.entity.old.EntityNpcNagaFemale; import noppes.npcs.entity.old.EntityNpcNagaMale; import noppes.npcs.entity.old.EntityNpcSkeleton; -@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2.1") +@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2.2") public class CustomNpcs { @ConfigProp(info = "Disable Chat Bubbles") From 2d70b0091b48c5e7b9cdcd5d59e237bba3fa6754 Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Thu, 14 Oct 2021 00:08:05 -0400 Subject: [PATCH 3/4] Fix Custom Shields and Daggers --- build.gradle | 2 +- src/main/java/noppes/npcs/CustomNpcs.java | 2 +- .../noppes/npcs/client/renderer/RenderNPCHumanMale.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7f1b19627..739238588 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.2.2" +version = "1.2.3" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "CustomNPC-Plus" diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index f142e5026..d001670dd 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -60,7 +60,7 @@ import noppes.npcs.entity.old.EntityNpcNagaFemale; import noppes.npcs.entity.old.EntityNpcNagaMale; import noppes.npcs.entity.old.EntityNpcSkeleton; -@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2.2") +@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2.3") public class CustomNpcs { @ConfigProp(info = "Disable Chat Bubbles") diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java index b7410dc66..37c1817d3 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java @@ -348,11 +348,11 @@ public class RenderNPCHumanMale extends RenderNPCInterface IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED); boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D)); - - if(itemstack2.getItem() instanceof ItemShield || itemstack2.getItem() instanceof ItemClaw) + + Class clazz = itemstack2.getItem().getClass(); + if(clazz.getSimpleName().equals("ItemShield") || clazz.getSimpleName().equals("ItemRotatedShield") || clazz.getSimpleName().equals("ItemClaw")) GL11.glTranslatef(0.30f, 0, 0f); - if (itemstack2.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack2.getItem()).getRenderType()))) { var6 = 0.5F; From 24790b795238d34ab4f00c282323c18a64c9fe3c Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Fri, 26 Nov 2021 04:34:47 -0500 Subject: [PATCH 4/4] Add Disabling All Damage Cleaned Up some Lang Code Added Disabling All Damage to Stats Moved Disable Damage from Resistances to Stats Added Disable Damage Message --- build.gradle | 2 +- src/main/java/noppes/npcs/CustomNpcs.java | 2 +- src/main/java/noppes/npcs/Resistances.java | 8 ++++++++ .../gui/SubGuiNpcResistanceProperties.java | 6 +++++- .../npcs/client/gui/mainmenu/GuiNpcStats.java | 16 ++++++++++------ .../resources/assets/customnpcs/lang/en_US.lang | 7 ++----- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 739238588..924955fb8 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.2.3" +version = "1.24" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "CustomNPC-Plus" diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index d001670dd..bdd44417d 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -60,7 +60,7 @@ import noppes.npcs.entity.old.EntityNpcNagaFemale; import noppes.npcs.entity.old.EntityNpcNagaMale; import noppes.npcs.entity.old.EntityNpcSkeleton; -@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2.3") +@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.24") public class CustomNpcs { @ConfigProp(info = "Disable Chat Bubbles") diff --git a/src/main/java/noppes/npcs/Resistances.java b/src/main/java/noppes/npcs/Resistances.java index ff0cde972..7598e0f4e 100644 --- a/src/main/java/noppes/npcs/Resistances.java +++ b/src/main/java/noppes/npcs/Resistances.java @@ -9,6 +9,8 @@ public class Resistances { public float arrow = 1f; public float playermelee = 1f; public float explosion = 1f; + + public boolean disableDamage = false; public NBTTagCompound writeToNBT() { NBTTagCompound compound = new NBTTagCompound(); @@ -16,6 +18,7 @@ public class Resistances { compound.setFloat("Arrow", arrow); compound.setFloat("Melee", playermelee); compound.setFloat("Explosion", explosion); + compound.setBoolean("disableDamage", disableDamage); return compound; } @@ -24,9 +27,14 @@ public class Resistances { arrow = compound.getFloat("Arrow"); playermelee = compound.getFloat("Melee"); explosion = compound.getFloat("Explosion"); + disableDamage = compound.getBoolean("disableDamage"); } public float applyResistance(DamageSource source, float damage) { + if(disableDamage){ + return 0; + } + if(source.damageType.equals("arrow") || source.damageType.equals("thrown")){ damage *= (2 - arrow); } diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java index 08cd8519e..63427aa77 100644 --- a/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java @@ -35,7 +35,11 @@ public class SubGuiNpcResistanceProperties extends SubGuiInterface implements IS addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, guiTop + 81)); addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, guiTop + 76, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2)); - addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done")); + if(resistances.disableDamage){ + addLabel(new GuiNpcLabel(4,"stats.disabletrue", guiLeft + 4, guiTop + 103)); + } + + addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done")); } protected void actionPerformed(GuiButton guibutton) diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java index dd4cb0f3e..0da4b3c6d 100644 --- a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java @@ -45,7 +45,6 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener, addButton(new GuiNpcButton(0,guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); addLabel(new GuiNpcLabel(2,"stats.respawn", guiLeft + 5, y + 5)); - this.addButton(new GuiNpcButton(2, guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); addLabel(new GuiNpcLabel(5,"stats.meleeproperties", guiLeft + 5, y + 5)); @@ -53,12 +52,14 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener, addLabel(new GuiNpcLabel(6,"stats.rangedproperties", guiLeft + 5, y + 5)); this.addButton(new GuiNpcButton(9, guiLeft + 217, y, 56, 20, "selectServer.edit")); addLabel(new GuiNpcLabel(7,"stats.projectileproperties", guiLeft + 140, y + 5)); - - this.addButton(new GuiNpcButton(15, guiLeft + 82, y+=34, 56, 20, "selectServer.edit")); - addLabel(new GuiNpcLabel(15,"potion.resistance", guiLeft + 5, y + 5)); - - addButton(new GuiNpcButton(4,guiLeft + 82, y+=34, 56, 20, new String[]{"gui.no","gui.yes"} ,npc.isImmuneToFire()? 1:0)); + this.addButton(new GuiNpcButton(15, guiLeft + 82, y+=34, 56, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(15,"potion.resistance", guiLeft + 5, y + 5)); + + this.addButton(new GuiNpcButton(21, guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"}, this.stats.resistances.disableDamage? 1:0)); + addLabel(new GuiNpcLabel(21,"stats.disabledamage", guiLeft + 140, y + 5)); + + addButton(new GuiNpcButton(4,guiLeft + 82, y+=34, 56, 20, new String[]{"gui.no","gui.yes"} ,npc.isImmuneToFire()? 1:0)); addLabel(new GuiNpcLabel(10,"stats.fireimmune", guiLeft + 5, y + 5)); addButton(new GuiNpcButton(5,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.canDrown? 1:0)); addLabel(new GuiNpcLabel(11,"stats.candrown", guiLeft + 140, y + 5)); @@ -134,6 +135,9 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener, else if (button.id == 18) { stats.potionImmune = ((GuiNpcButtonYesNo)guibutton).getBoolean(); } + else if(button.id == 21){ + stats.resistances.disableDamage = ((GuiNpcButton)guibutton).getValue() == 1; + } } @Override public void save() { diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index 85193e066..dc15adec6 100644 --- a/src/main/resources/assets/customnpcs/lang/en_US.lang +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -100,7 +100,6 @@ gui.selectSound=Select Sound gui.selectnpc=Select NPC gui.select=Select gui.range=Range -gui.name=Name gui.partly=Partially gui.copy=Copy gui.clear=Clear @@ -114,7 +113,6 @@ gui.detailed=Detailed gui.server=Server gui.showmore=Show More gui.update=Update -gui.disabled=Disabled gui.editor=Editor gui.playernearby=Player nearby @@ -238,8 +236,6 @@ job.puppet=Puppet stats.health=Health stats.aggro=AggroRange -stats.meleeproperties=MeleeProperties -stats.rangedproperties=RangeProperties stats.projectileproperties=ProjectileType stats.meleestrength=MeleeStrength stats.meleerange=MeleeRange @@ -268,6 +264,8 @@ stats.rangedproperties=RangedOptions stats.burninsun=BurnsInSun stats.amplify=Amplified stats.melee=Melee +stats.disabledamage=DisableDamage +stats.disabletrue=Damage is currently disabled in Stats stats.regenhealth=Health Regen stats.combatregen=Combat Regen stats.naturallydespawns=Naturally Despawn @@ -885,7 +883,6 @@ movement.rotation=Rotation movement.body=Body movement.manual=Manual movement.stalking=Stalking -movement.stalking=Stalking movement.head=Head movement.pauses=Pauses movement.stopinteract=Stop on interact