Add biome name to biome finder tooltip

This commit is contained in:
Cheeserolls 2015-05-04 00:17:32 +01:00
parent c32a624f92
commit faa60f0e37
2 changed files with 15 additions and 9 deletions

View File

@ -38,15 +38,7 @@ public class ItemBiomeEssence extends Item
{
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("biomeID"))
{
int biomeId = itemStack.getTagCompound().getInteger("biomeID");
try
{
return BiomeGenBase.getBiomeGenArray()[biomeId];
}
catch (Exception e)
{
return null;
}
return BiomeGenBase.getBiome(itemStack.getTagCompound().getInteger("biomeID"));
}
return null;
}

View File

@ -8,6 +8,8 @@
package biomesoplenty.common.item;
import java.util.List;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -151,6 +153,18 @@ public class ItemBiomeFinder extends Item
nbt.removeTag("posX");
nbt.removeTag("posZ");
}
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List infoList, boolean advancedItemTooltips)
{
if (!itemStack.hasTagCompound()) {return;}
NBTTagCompound nbt = itemStack.getTagCompound();
if (nbt.hasKey("biomeIDToFind"))
{
BiomeGenBase biomeToFind = BiomeGenBase.getBiome(nbt.getInteger("biomeIDToFind")); // returns ocean if biomeIDToFind is out of bounds
infoList.add(biomeToFind.biomeName);
}
}
}