mirror of
https://github.com/GTNewHorizons/ForbiddenMagic.git
synced 2026-11-25 22:34:42 +00:00
Array Index Guard (#29)
This commit is contained in:
1 parent
d09d78f0f0
commit
fa46f39c7e
5 files changed
+19
-25
No files matched your search
@@ -35,12 +35,13 @@ public class ItemWandCaps extends Item {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta >= icon.length) meta = 0;
|
||||
return this.icon[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs xCreativeTabs, List list) {
|
||||
public void getSubItems(Item item, CreativeTabs xCreativeTabs, List<ItemStack> list) {
|
||||
for (int x = 0; x < types.length; x++) {
|
||||
list.add(new ItemStack(this, 1, x));
|
||||
}
|
||||
@@ -48,6 +49,8 @@ public class ItemWandCaps extends Item {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + types[stack.getItemDamage()];
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta >= types.length) meta = 0;
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public class ItemWandCores extends Item {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta >= icon.length) meta = 0;
|
||||
return this.icon[meta];
|
||||
}
|
||||
|
||||
@@ -97,6 +98,8 @@ public class ItemWandCores extends Item {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + types[stack.getItemDamage()];
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta >= types.length) meta = 0;
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user