Skip to content

Commit

Permalink
fixes for addons
Browse files Browse the repository at this point in the history
  • Loading branch information
pWn3d1337 committed Jan 25, 2019
1 parent 94ab11e commit a3742d5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 74 deletions.
19 changes: 6 additions & 13 deletions src/main/java/techguns/items/armors/GenericArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,17 @@ public class GenericArmor extends ItemArmor implements ISpecialArmor , IItemTGRe
protected String modid=Techguns.MODID;

public GenericArmor(String unlocalizedName, TGArmorMaterial material, String textureName, EntityEquipmentSlot type) {
this(Techguns.MODID, unlocalizedName, material, textureName, type);
}

public GenericArmor(String modid, String unlocalizedName, TGArmorMaterial material, String textureName, EntityEquipmentSlot type) {
super(material.createVanillaMaterial(), 0, type);
this.material=material;
this.textureName = textureName; //Armor Texture
setCreativeTab(Techguns.tabTechgun);
this.modid=modid;
this.setUnlocalizedName(unlocalizedName);
this.setRegistryName(new ResourceLocation(Techguns.MODID, unlocalizedName));
this.setRegistryName(new ResourceLocation(modid, unlocalizedName));
// this.setTextureName(Techguns.MODID + ":" + unlocalizedName); //Item Texture
//for tooltip
this.armorValue=Math.round(material.getArmorValueSlot(type, DamageType.PHYSICAL));
Expand All @@ -127,18 +132,6 @@ public GenericArmor(String unlocalizedName, TGArmorMaterial material, String tex
//techgunArmors.add(this);
}

/**
* allow other mods to use techguns armor classes
* this also sets the registry name, only call this method in preInit
* @param modid
* @return
*/
public GenericArmor setModid(String modid) {
this.modid=modid;
this.setRegistryName(new ResourceLocation(modid, getUnlocalizedName()));
return this;
}

/**
* SteamArmor (0,1)
* PowerArmor (2,3)
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/techguns/items/armors/GenericArmorMultiCamo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ public class GenericArmorMultiCamo extends GenericArmor implements ICamoChangeab
protected String[] textureNames;
protected String camoNameSuffix="";


public GenericArmorMultiCamo(String unlocalizedName, TGArmorMaterial material, String[] textureNames, EntityEquipmentSlot type) {
super(unlocalizedName,material, textureNames[0],type);
this(Techguns.MODID, unlocalizedName, material, textureNames, type);
}

public GenericArmorMultiCamo(String modid, String unlocalizedName, TGArmorMaterial material, String[] textureNames, EntityEquipmentSlot type) {
super(modid,unlocalizedName,material, textureNames[0],type);
this.textureNames=textureNames;
}

Expand Down Expand Up @@ -107,7 +112,7 @@ public String getCurrentCamoName(ItemStack item) {
camoID=tags.getByte("camo");
}
if(camoID>=0){
return TextUtil.trans(Techguns.MODID+".item."+textureNames[0]+"."+camoNameSuffix+"camoname."+camoID);
return TextUtil.trans(this.modid+".item."+textureNames[0]+"."+camoNameSuffix+"camoname."+camoID);
} else {
return TextUtil.trans(Techguns.MODID+".item.invalidcamo");
}
Expand Down Expand Up @@ -155,7 +160,7 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo

int i = armor.getCurrentCamoIndex(stack);
if (i>=0 && i<this.textureNames.length){
return Techguns.MODID+":textures/models/armor/"+this.textureNames[i]+(this.hasDoubleTexture()?("_layer_"+getArmorLayer(slot)):"")+".png";
return this.modid+":textures/models/armor/"+this.textureNames[i]+(this.hasDoubleTexture()?("_layer_"+getArmorLayer(slot)):"")+".png";
} else {
return null;
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/techguns/items/armors/PoweredArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ public class PoweredArmor extends GenericArmorMultiCamo {

public PoweredArmor(String unlocalizedName, TGArmorMaterial material,
String[] textureNames, EntityEquipmentSlot type, ArmorPowerType powerType, int maxpower) {
super(unlocalizedName, material, textureNames, type);
this(Techguns.MODID, unlocalizedName, material, textureNames, type, powerType, maxpower);
}

public PoweredArmor(String modid, String unlocalizedName, TGArmorMaterial material,
String[] textureNames, EntityEquipmentSlot type, ArmorPowerType powerType, int maxpower) {
super(modid, unlocalizedName, material, textureNames, type);
this.powerType = powerType;
this.maxpower=maxpower;
}
Expand Down
69 changes: 12 additions & 57 deletions src/main/java/techguns/items/armors/TGArmorMaterial.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,73 +52,27 @@ public class TGArmorMaterial {
protected int enchantability;

protected String texture;
/**
* Specify all type values individually
* @param name
* @param phys
* @param proj
* @param fire
* @param exp
* @param energy
* @param poison
* @param ice
* @param light
* @param rad
*/
/*public TGArmorMaterial(String name,
int baseDurability, int enchantability, float toughness, SoundEvent equipSound, float phys, float proj, float fire, float exp, float energy, float poison, float ice, float light, float rad, float dark){
this.name=name;
this.baseDur=baseDurability;
this.enchantability=enchantability;
this.armorPhys=phys;
this.armorProjectile=proj;
this.armorFire=fire;
this.armorExplosion=exp;
this.armorEnergy=energy;
this.armorPoison = poison;
this.armorIce=ice;
this.armorLightning=light;
this.armorRadiation=rad;
this.armorDark=dark;
this.toughness=toughness;
this.equipSound=equipSound;
this.texture=name.toLowerCase();
}*/

protected String modid;


/**
* Common values
* sets melee and projectile, all other to elemental (except poison and radiation, which are 0)
* @param phys
* @param proj
* @param elemental
* Don't use this constructor outside of techguns, use the one with modid as 1st parameter
*
* Set the armor values with standard factors, phys and proj are equal to armor, rad/poison are 0, all others are 0.75*armor;
* @param armor
* @return
*/
/*public TGArmorMaterial(String name,int baseDurability, int enchantability, float phys, SoundEvent equipSound, float toughness, float proj, float elemental){
this.name=name;
this.baseDur=baseDurability;
this.enchantability=enchantability;
this.armorPhys=phys;
this.armorProjectile=proj;
this.armorFire=elemental;
this.armorExplosion=elemental;
this.armorEnergy=elemental;
this.armorIce=elemental;
this.armorLightning=elemental;
this.armorDark=elemental;
this.armorPoison=elemental;
this.toughness=toughness;
this.equipSound=equipSound;
this.texture=name.toLowerCase();
}*/

public TGArmorMaterial(String name, int baseDurability, int enchantability, float armor, SoundEvent equipSound, float toughness){
this(Techguns.MODID,name,baseDurability,enchantability,armor,equipSound,toughness);
}

/**
* Set the armor values with standard factors, phys and proj are equal to armor, rad/poison are 0, all others are 0.75*armor;
* @param armor
* @return
*/
public TGArmorMaterial(String name, int baseDurability, int enchantability, float armor, SoundEvent equipSound, float toughness){
public TGArmorMaterial(String modid, String name, int baseDurability, int enchantability, float armor, SoundEvent equipSound, float toughness){
this.name=name;
this.baseDur=baseDurability;
this.enchantability=enchantability;
Expand All @@ -136,6 +90,7 @@ public TGArmorMaterial(String name, int baseDurability, int enchantability, floa
this.toughness=toughness;
this.equipSound=equipSound;
this.texture=name.toLowerCase();
this.modid=modid;

MATERIALS.add(this);
}
Expand Down Expand Up @@ -236,7 +191,7 @@ public ArmorMaterial createVanillaMaterial(){
av[1]=Math.round(this.getArmorValueSlot(EntityEquipmentSlot.LEGS, DamageType.PHYSICAL));
av[0]=Math.round(this.getArmorValueSlot(EntityEquipmentSlot.FEET, DamageType.PHYSICAL));*/

return EnumHelper.addArmorMaterial(name,Techguns.MODID+":"+this.texture, baseDur,new int[]{0,0,0,0}, enchantability, equipSound, toughness);
return EnumHelper.addArmorMaterial(name,this.modid+":"+this.texture, baseDur,new int[]{0,0,0,0}, enchantability, equipSound, toughness);
}

public TGArmorMaterial setArmorProjectile(float armorProjectile) {
Expand Down

0 comments on commit a3742d5

Please sign in to comment.