本文整理匯總了Java中net.minecraft.item.Item.itemRegistry方法的典型用法代碼示例。如果您正苦於以下問題:Java Item.itemRegistry方法的具體用法?Java Item.itemRegistry怎麽用?Java Item.itemRegistry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.item.Item
的用法示例。
在下文中一共展示了Item.itemRegistry方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initStats
import net.minecraft.item.Item; //導入方法依賴的package包/類
private static void initStats()
{
for (Item item : Item.itemRegistry)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = func_180204_a(item);
if (s != null)
{
objectUseStats[i] = (new StatCrafting("stat.useItem.", s, new ChatComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();
if (!(item instanceof ItemBlock))
{
itemStats.add((StatCrafting)objectUseStats[i]);
}
}
}
}
replaceAllSimilarBlocks(objectUseStats);
}
示例2: initItemDepleteStats
import net.minecraft.item.Item; //導入方法依賴的package包/類
private static void initItemDepleteStats()
{
for (Item item : Item.itemRegistry)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = func_180204_a(item);
if (s != null && item.isDamageable())
{
objectBreakStats[i] = (new StatCrafting("stat.breakItem.", s, new ChatComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();
}
}
}
replaceAllSimilarBlocks(objectBreakStats);
}
示例3: loadItemModels
import net.minecraft.item.Item; //導入方法依賴的package包/類
private void loadItemModels()
{
this.registerVariantNames();
for (Item item : Item.itemRegistry)
{
for (String s : this.getVariantNames(item))
{
ResourceLocation resourcelocation = this.getItemLocation(s);
this.itemLocations.put(s, resourcelocation);
if (this.models.get(resourcelocation) == null)
{
try
{
ModelBlock modelblock = this.loadModel(resourcelocation);
this.models.put(resourcelocation, modelblock);
}
catch (Exception exception)
{
LOGGER.warn((String)("Unable to load item model: \'" + resourcelocation + "\' for item: \'" + Item.itemRegistry.getNameForObject(item) + "\'"), (Throwable)exception);
}
}
}
}
}
示例4: displayAllReleventItems
import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
* only shows items which have tabToDisplayOn == this
*/
public void displayAllReleventItems(List<ItemStack> p_78018_1_)
{
for (Item item : Item.itemRegistry)
{
if (item != null && item.getCreativeTab() == this)
{
item.getSubItems(item, this, p_78018_1_);
}
}
if (this.getRelevantEnchantmentTypes() != null)
{
this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
}
}
示例5: updateCreativeSearch
import net.minecraft.item.Item; //導入方法依賴的package包/類
private void updateCreativeSearch()
{
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
guicontainercreative$containercreative.itemList.clear();
for (Item item : Item.itemRegistry)
{
if (item != null && item.getCreativeTab() != null)
{
item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
}
}
for (Enchantment enchantment : Enchantment.enchantmentsBookList)
{
if (enchantment != null && enchantment.type != null)
{
Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList);
}
}
Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
String s1 = this.searchField.getText().toLowerCase();
while (iterator.hasNext())
{
ItemStack itemstack = (ItemStack)iterator.next();
boolean flag = false;
for (String s : itemstack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips))
{
if (EnumChatFormatting.getTextWithoutFormattingCodes(s).toLowerCase().contains(s1))
{
flag = true;
break;
}
}
if (!flag)
{
iterator.remove();
}
}
this.currentScroll = 0.0F;
guicontainercreative$containercreative.scrollTo(0.0F);
}