當前位置: 首頁>>代碼示例>>Java>>正文


Java GameData.getItemRegistry方法代碼示例

本文整理匯總了Java中cpw.mods.fml.common.registry.GameData.getItemRegistry方法的典型用法代碼示例。如果您正苦於以下問題:Java GameData.getItemRegistry方法的具體用法?Java GameData.getItemRegistry怎麽用?Java GameData.getItemRegistry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cpw.mods.fml.common.registry.GameData的用法示例。


在下文中一共展示了GameData.getItemRegistry方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: nerfStandardRecipes

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
@Override
protected void nerfStandardRecipes ()
{
    for (Item item : (Iterable<Item>) GameData.getItemRegistry())
    {
        if ((item instanceof ItemTool || item instanceof ItemSword) && !isBBTool(item))
        {
            String repairMaterial = BetterBeginningsHandler.getToolRepairMaterial(item);

            if (!Strings.isNullOrEmpty(repairMaterial) && !OreDictionary.getOres(repairMaterial).isEmpty())
            {
                nerfToolRecipe(new ItemStack(item), repairMaterial);
            }
        }
    }
}
 
開發者ID:UndeadZeratul,項目名稱:TWBB-Tweaks,代碼行數:17,代碼來源:ToolRecipeTweaks.java

示例2: getItemName

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
public static String getItemName(String s)
{
	// If this name is a number we parse the number then check the item registry for an item with that ID.
	// If the ID is valid we'll get the name, if not we'll get a null.
	// If the name isn't a number just return the name again.
	
	try
	{
		RegistryNamespaced rn = GameData.getItemRegistry();
		int id = Integer.parseInt(s);
		
		if(rn.containsId(id))
			return rn.getNameForObject(rn.getObjectById(id));
		else
			return null;
	}
	catch (NumberFormatException e) {}
	return s;
}
 
開發者ID:Rotatceps,項目名稱:EE3Helper,代碼行數:20,代碼來源:Helper.java

示例3: postInit

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
@Override public void postInit() {
	for (Object o : GameData.getItemRegistry()) {
		if (o instanceof Item) { // should always be true, but just to be sure
			Item i = (Item) o;
			try {
				Masses.calculateMass(i, 0, 32767);
			} catch (StackOverflowError error) {
				continue;
			} catch (Exception e) {
				e.printStackTrace();
				System.err.println("Dazed and confused, but trying to continue");
				continue;
			}
		}
	}
	Masses.bake();
}
 
開發者ID:unascribed,項目名稱:Farrago,代碼行數:18,代碼來源:ServerProxy.java

示例4: nerfStandardRecipes

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
@Override
protected void nerfStandardRecipes ()
{
    for (Item item : (Iterable<Item>) GameData.getItemRegistry())
    {
        if (item instanceof ItemArmor)
        {
            ItemArmor armor = (ItemArmor) item;
            ItemStack outputStack = new ItemStack(armor);
            String repairMaterial = BetterBeginningsHandler.getArmorRepairMaterial(armor);

            if (!Strings.isNullOrEmpty(repairMaterial))
            {
                String ingot = repairMaterial.startsWith("ingot")
                        ? repairMaterial
                        : "ingot" + repairMaterial;
                String nugget = repairMaterial.startsWith("nugget")
                        ? repairMaterial
                        : "nugget" + repairMaterial;

                if (!OreDictionary.getOres(ingot).isEmpty() && !OreDictionary.getOres(nugget).isEmpty() && outputStack.getItem() instanceof ItemArmor)
                {
                    nerfArmorRecipe(outputStack, ingot, nugget);
                }
            }
        }
    }
}
 
開發者ID:UndeadZeratul,項目名稱:TWBB-Tweaks,代碼行數:29,代碼來源:ArmorRecipeTweaks.java

示例5: registerModule

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
@Override
public void registerModule() {
    final FMLControlledNamespacedRegistry<Item> itemRegistry = GameData.getItemRegistry();
    Iterator<Item> itemIterator = itemRegistry.iterator();
    while (itemIterator.hasNext()) {
        Item item = itemIterator.next();
        if (item != null) {
            String itemName = itemRegistry.getNameForObject(item);
            if (item instanceof IAncientWillContainer)
                ArmorAAPI.charmRegistry.blackListCharmFromItem(itemName, CharmIDs.SIGHT);
            if (item instanceof IPhantomInkable)
                ArmorAAPI.charmRegistry.blackListCharmFromItem(itemName, CharmIDs.GLASS);
        }
    }
}
 
開發者ID:Lomeli12,項目名稱:ArmorA,代碼行數:16,代碼來源:BotaniaModule.java

示例6: getForgeName

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
public static String getForgeName(Item item){
    FMLControlledNamespacedRegistry<Item> items = GameData.getItemRegistry();
    return items.getNameForObject(item);
}
 
開發者ID:Avaja,項目名稱:OpenTechnology,代碼行數:5,代碼來源:Utils.java

示例7: processCommand

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
@Override
public void processCommand(ICommandSender cs, String[] args) 
{
	RegistryNamespaced rn = GameData.getItemRegistry();
	if(cs instanceof EntityPlayer)
	{	
		EntityPlayer player = (EntityPlayer) cs;
		
		try
		{
			Item i = null;
			ItemStack iStack = null;
			
			switch(args.length)
			{
				case 0:
					i = (player.getHeldItem() != null) ? player.getHeldItem().getItem() : null; break;
				case 1:
					i = (Item) rn.getObjectById(Integer.parseInt(args[0])); break;
				case 2: 
					i = (Item) rn.getObjectById(Integer.parseInt(args[0])); break;
			}
			
			if(i == null)
			{
				Helper.toChatErr(cs, "No held item, or no such item.");
				return;
			}

			iStack = new ItemStack(i);
			int dmg = 0;
			
			switch(args.length)
			{
				case 0:
					iStack.setItemDamage(player.getHeldItem().getItemDamage()); 
					dmg = iStack.getItemDamage();
					break;
				case 1:
					iStack.setItemDamage(dmg); 
					break;
				case 2: 
					dmg = Integer.parseInt(args[1]);
					iStack.setItemDamage(dmg); 
					break;
			}

			if(iStack != null)
			{
				Helper.toChat(cs, EnumChatFormatting.GRAY + "--");
				Helper.toChat(cs, EnumChatFormatting.AQUA + "NNAME: "+ rn.getIDForObject(i) + ":" + dmg);
				Helper.toChat(cs, EnumChatFormatting.AQUA + "UNAME: "+ rn.getNameForObject(i));
				
				int [] oIDs = OreDictionary.getOreIDs(iStack);
				
				for(int j = 0; j < oIDs.length; j++)
				{
					Helper.toChat(cs, EnumChatFormatting.AQUA + "ONAME: "+OreDictionary.getOreName(oIDs[j]));
				}
			}
		}
		catch(NumberFormatException e)
		{
			Helper.toChatErr(cs, "Non-number in numeric field.");
		}
	}
}
 
開發者ID:Rotatceps,項目名稱:EE3Helper,代碼行數:68,代碼來源:CommandIDItem.java

示例8: onServerStart

import cpw.mods.fml.common.registry.GameData; //導入方法依賴的package包/類
@Mod.EventHandler
public void onServerStart(FMLServerStartingEvent event) {
    if (MinecraftServer.getServer().getCommandManager() instanceof ServerCommandManager) {
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new PokecheckmeCommand());
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new AddToGrassCommand());
    }

    if (DEBUGMODE) {
        //Here be dragons.
        for (Block block : (Iterable<Block>) GameData.getBlockRegistry()) {
            if (GameRegistry.findUniqueIdentifierFor(block).modId.equals("minecraft"))
                continue;

            String localName = block.getLocalizedName();

            if (localName.contains("tile")) {
                System.out.println("Block " + block.getClass().getName() + " Doesn't seem to have a name set!");
                System.out.println();
            }

            if (block.getCreativeTabToDisplayOn() == null) {
                System.out.println("Block " + block.getClass().getName() + " Doesn't seem to have a creative tab set!");
                System.out.println();
            }

        }

        for (Item item : (Iterable<Item>) GameData.getItemRegistry()) {
            ItemStack itemStack = new ItemStack(item, 0, 1);

            String itemName = item.getItemStackDisplayName(itemStack);

            if (!itemName.getClass().getName().contains(MODID))
                return;

            if (itemName.contains("item.")) {
                System.out.println("Item " + itemName + " doesn't seem to have a name set");
            }

        }

    }

    //////////////////////////////////////////////////////


}
 
開發者ID:AnDwHaT5,項目名稱:PixelUtilities,代碼行數:48,代碼來源:Basemod.java


注:本文中的cpw.mods.fml.common.registry.GameData.getItemRegistry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。