Java Code Examples for net.minecraft.item.Item#getUnlocalizedName()
The following examples show how to use
net.minecraft.item.Item#getUnlocalizedName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BookMetaProvider.java From OpenPeripheral-Integration with MIT License | 6 votes |
@Override public Object getMeta(Item target, ItemStack stack) { final String unlocalizedName = target.getUnlocalizedName(); final boolean isLinkbook = "item.myst.linkbook".equals(unlocalizedName); final boolean isAgebook = "item.myst.agebook".equals(unlocalizedName); if (isLinkbook || isAgebook) { NBTTagCompound tag = stack.getTagCompound(); if (tag != null) { Map<String, Object> result = Maps.newHashMap(); result.put("type", isLinkbook? "link" : (isAgebook? "age" : "unknown")); result.put("destination", tag.getString("agename")); result.put("dimension", tag.getInteger("Dimension")); addLinkingBookFlags(result, tag); addCoordinates(result, tag); return result; } } return null; }
Example 2
Source File: ModItems.java From Et-Futurum with The Unlicense | 5 votes |
private static void registerItem(Item item) { if (!(item instanceof IConfigurable) || ((IConfigurable) item).isEnabled()) { String name = item.getUnlocalizedName(); String[] strings = name.split("\\."); GameRegistry.registerItem(item, strings[strings.length - 1]); } }
Example 3
Source File: ItemThinLogFence.java From GardenCollection with MIT License | 5 votes |
@Override public String getItemStackDisplayName (ItemStack itemStack) { int meta = itemStack.getItemDamage(); if (meta < 16) return super.getItemStackDisplayName(itemStack); Block block = TileEntityWoodProxy.getBlockFromComposedMetadata(meta); Item item = Item.getItemFromBlock(block); if (item == null) return super.getItemStackDisplayName(itemStack); String unlocName = item.getUnlocalizedName(new ItemStack(item, 1, TileEntityWoodProxy.getMetaFromComposedMetadata(meta))); return ("" + StatCollector.translateToLocal(unlocName + ".name") + " " + StatCollector.translateToLocal(getUnlocalizedName() + ".name")).trim(); }
Example 4
Source File: ItemThinLog.java From GardenCollection with MIT License | 5 votes |
@Override public String getItemStackDisplayName (ItemStack itemStack) { int meta = itemStack.getItemDamage(); if (meta < 16) return super.getItemStackDisplayName(itemStack); Block block = TileEntityWoodProxy.getBlockFromComposedMetadata(meta); Item item = Item.getItemFromBlock(block); if (item == null) return super.getItemStackDisplayName(itemStack); String unlocName = item.getUnlocalizedName(new ItemStack(item, 1, TileEntityWoodProxy.getMetaFromComposedMetadata(meta))); return ("" + StatCollector.translateToLocal(unlocName + ".name") + " " + StatCollector.translateToLocal(getUnlocalizedName() + ".name")).trim(); }
Example 5
Source File: WeightedRandomLoot.java From minecraft-roguelike with GNU General Public License v3.0 | 5 votes |
public WeightedRandomLoot(Item item, int damage, int minStackSize, int maxStackSize, int weight, int ench){ this.name = item.getUnlocalizedName(); this.item = item; this.damage = damage; this.min = minStackSize; this.max = maxStackSize; this.weight = weight; this.enchLevel = ench; }
Example 6
Source File: RadioHatchCompat.java From bartworks with MIT License | 4 votes |
public static void run() { DebugLog.log("Starting Generation of missing GT++ rods/longrods"); try { Class rodclass = Class.forName("gtPlusPlus.core.item.base.rods.BaseItemRod"); Class longrodclass = Class.forName("gtPlusPlus.core.item.base.rods.BaseItemRodLong"); Constructor<? extends Item> c1 = rodclass.getConstructor(RadioHatchCompat.materialClass); Constructor<? extends Item> c2 = longrodclass.getConstructor(RadioHatchCompat.materialClass); Field cOwners = GameData.class.getDeclaredField("customOwners"); cOwners.setAccessible(true); Field map = RegistryNamespaced.class.getDeclaredField("field_148758_b"); map.setAccessible(true); Map<Item,String> UniqueIdentifierMap = (Map<Item, String>) map.get(GameData.getItemRegistry()); Map<GameRegistry.UniqueIdentifier, ModContainer> ownerItems = (Map<GameRegistry.UniqueIdentifier, ModContainer>) cOwners.get(null); ModContainer gtpp = null; ModContainer bartworks = null; for (ModContainer container : Loader.instance().getModList()){ if (gtpp != null && bartworks != null) break; else if (container.getModId().equalsIgnoreCase(BartWorksCrossmod.MOD_ID)) bartworks=container; else if (container.getModId().equalsIgnoreCase("miscutils")) gtpp=container; } for (Object mats : (Set) RadioHatchCompat.materialClass.getField("mMaterialMap").get(null)) { if (RadioHatchCompat.isRadioactive.getBoolean(mats)) { if (OreDictionary.getOres("stick" + RadioHatchCompat.unlocalizedName.get(mats)).isEmpty()) { Item it = c1.newInstance(mats); UniqueIdentifierMap.replace(it,"miscutils:"+it.getUnlocalizedName()); GameRegistry.UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor(it); ownerItems.replace(ui,bartworks,gtpp); String tanslate = it.getUnlocalizedName()+".name="+RadioHatchCompat.localizedName.get(mats)+" Rod"; RadioHatchCompat.TranslateSet.add(tanslate); DebugLog.log(tanslate); DebugLog.log("Generate: " + RadioHatchCompat.rod + RadioHatchCompat.unlocalizedName.get(mats)); } if (OreDictionary.getOres("stickLong" + RadioHatchCompat.unlocalizedName.get(mats)).isEmpty()) { Item it2 = c2.newInstance(mats); UniqueIdentifierMap.replace(it2,"miscutils:"+it2.getUnlocalizedName()); GameRegistry.UniqueIdentifier ui2 = GameRegistry.findUniqueIdentifierFor(it2); ownerItems.replace(ui2,bartworks,gtpp); DebugLog.log("Generate: " + RadioHatchCompat.longRod + RadioHatchCompat.unlocalizedName.get(mats)); } } } } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | InstantiationException | ClassNotFoundException e) { e.printStackTrace(); } }
Example 7
Source File: General.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
public static String getName(Item item) { String res = item.getUnlocalizedName(); return cleanTags(res); }
Example 8
Source File: General.java From Chisel with GNU General Public License v2.0 | 4 votes |
public static String getName(Item item) { String res = item.getUnlocalizedName(); return cleanTags(res); }