Various minor fixes

* Fix Lexicon crashing with invalid version format

Closes #192

* Fix crashing on damage taken

Closes #196

* Fix attributes being too present/wrong values

Closes #194
This commit is contained in:
Wire Segal authored and Vincent Lee committed 2016-04-03 17:01:24 -05:00
1 parent 5f3172bd5d
commit 5ceceec6bb
5 files changed
+10 -6

No files matched your search

@@ -58,7 +58,7 @@ public class PixieHandler {
}
float getChance(ItemStack stack) {
if(stack == null)
if(stack == null || !(stack.getItem() instanceof IPixieSpawner))
return 0F;
else return ((IPixieSpawner) stack.getItem()).getPixieChance(stack);
}
@@ -125,7 +125,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
public static String getEdition() {
String version = LibMisc.BUILD;
int build = version.contains("GRADLE") ? 0 : Integer.parseInt(version);
int build = version.contains("GRADLE") ? 0 : Integer.parseInt(version.replace("[^\\d]", ""));
return build == 0 ? I18n.translateToLocal("botaniamisc.devEdition") : MathHelper.numberToOrdinal(build);
}
@@ -57,9 +57,11 @@ public class ItemTerrasteelArmor extends ItemManasteelArmor {
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> multimap = HashMultimap.create();
UUID uuid = new UUID(getUnlocalizedName().hashCode(), 0);
multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getAttributeUnlocalizedName(), new AttributeModifier(uuid, "Terrasteel modifier " + type, (double) getArmorDisplay(null, new ItemStack(this), type.getIndex()) / 20, 0));
Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);
UUID uuid = new UUID((getUnlocalizedName() + slot.toString()).hashCode(), 0);
if (slot == this.armorType) {
multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getAttributeUnlocalizedName(), new AttributeModifier(uuid, "Terrasteel modifier " + type, (double) getArmorDisplay(null, new ItemStack(this), type.getIndex()) / 20, 0));
}
return multimap;
}
@@ -53,9 +53,10 @@ public class ItemManasteelAxe extends ItemTool implements IManaUsingItem, ISorta
public ItemManasteelAxe(ToolMaterial mat, String name) {
super(mat, ImmutableSet.of());
// todo attack speed and set
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setUnlocalizedName(name);
this.damageVsEntity = 8f;
this.attackSpeed = -3.1f;
}
@Override
@@ -76,6 +76,7 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
public ItemTerraAxe() {
super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_AXE);
MinecraftForge.EVENT_BUS.register(this);
this.attackSpeed = -3f;
}
public boolean shouldBreak(EntityPlayer player) {