Merge branch 'dev'

This commit is contained in:
KAMKEEL committed 2021-11-26 04:35:09 -05:00
commit 3069488c54
9 files changed
+41 -30

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ import noppes.npcs.entity.old.EntityNpcNagaMale;
import noppes.npcs.entity.old.EntityNpcSkeleton;
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2.1")
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.24")
public class CustomNpcs {
@ConfigProp(info = "Disable Chat Bubbles")
@@ -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);
}
@@ -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)
@@ -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() {
@@ -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);
@@ -350,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;
@@ -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);
@@ -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);
@@ -22,6 +22,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.potion.Potion;
@@ -1264,8 +1265,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)