本文整理汇总了Java中net.minecraft.item.Item.REGISTRY属性的典型用法代码示例。如果您正苦于以下问题:Java Item.REGISTRY属性的具体用法?Java Item.REGISTRY怎么用?Java Item.REGISTRY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.item.Item
的用法示例。
在下文中一共展示了Item.REGISTRY属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearchEntries
/**
* Lazy cache.
* @return
*/
private Stream<SearchEntry> getSearchEntries(){
if(cachedSearchEntries == null){
NonNullList<ItemStack> itemList = NonNullList.create();
for(Item item : Item.REGISTRY){
if (item != null && item.getCreativeTab() != null) {
item.getSubItems(item.getCreativeTab(), itemList);
}
}
for (Enchantment enchantment : Enchantment.REGISTRY) {
if (enchantment != null && enchantment.type != null) {
getAllEnchantedBooks(enchantment, itemList);
}
}
cachedSearchEntries = itemList.stream().map(SearchEntry::new).collect(Collectors.toList());
}
return cachedSearchEntries.stream();
}
示例2: initStats
private static void initStats()
{
for (Item item : Item.REGISTRY)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = getItemName(item);
if (s != null)
{
OBJECT_USE_STATS[i] = (new StatCrafting("stat.useItem.", s, new TextComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
if (!(item instanceof ItemBlock))
{
USE_ITEM_STATS.add((StatCrafting)OBJECT_USE_STATS[i]);
}
}
}
}
replaceAllSimilarBlocks(OBJECT_USE_STATS);
}
示例3: initItemDepleteStats
private static void initItemDepleteStats()
{
for (Item item : Item.REGISTRY)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = getItemName(item);
if (s != null && item.isDamageable())
{
OBJECT_BREAK_STATS[i] = (new StatCrafting("stat.breakItem.", s, new TextComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
}
}
}
replaceAllSimilarBlocks(OBJECT_BREAK_STATS);
}
示例4: initPickedUpAndDroppedStats
private static void initPickedUpAndDroppedStats()
{
for (Item item : Item.REGISTRY)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = getItemName(item);
if (s != null)
{
OBJECTS_PICKED_UP_STATS[i] = (new StatCrafting("stat.pickup.", s, new TextComponentTranslation("stat.pickup", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
OBJECTS_DROPPED_STATS[i] = (new StatCrafting("stat.drop.", s, new TextComponentTranslation("stat.drop", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
}
}
}
replaceAllSimilarBlocks(OBJECT_BREAK_STATS);
}
示例5: displayAllRelevantItems
/**
* only shows items which have tabToDisplayOn == this
*/
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_)
{
for (Item item : Item.REGISTRY)
{
if (item != null && item.getCreativeTab() == this)
{
item.getSubItems(item, this, p_78018_1_);
}
}
if (this.getRelevantEnchantmentTypes() != null)
{
this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
}
}
示例6: updateCreativeSearch
private void updateCreativeSearch()
{
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
guicontainercreative$containercreative.itemList.clear();
CreativeTabs tab = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];
if (tab.hasSearchBar() && tab != CreativeTabs.SEARCH)
{
tab.displayAllRelevantItems(guicontainercreative$containercreative.itemList);
updateFilteredItems(guicontainercreative$containercreative);
return;
}
for (Item item : Item.REGISTRY)
{
if (item != null && item.getCreativeTab() != null)
{
item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
}
}
updateFilteredItems(guicontainercreative$containercreative);
}
示例7: displayAllRelevantItems
/**
* only shows items which have tabToDisplayOn == this
*/
@SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> p_78018_1_)
{
for (Item item : Item.REGISTRY)
{
if (item == null)
{
continue;
}
for (CreativeTabs tab : item.getCreativeTabs())
{
if (tab == this)
{
item.getSubItems(item, this, p_78018_1_);
}
}
}
if (this.getRelevantEnchantmentTypes() != null)
{
this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
}
}
示例8: generateDawnstoneAnvilRecipes
private List<RecipeDawnstoneAnvil> generateDawnstoneAnvilRecipes()
{
//I'm basicly sorry for all of this. Please forgive me.
ArrayList<RecipeDawnstoneAnvil> repairRecipes = new ArrayList<>();
ArrayList<RecipeDawnstoneAnvil> destroyRecipes = new ArrayList<>();
for (Item item : Item.REGISTRY) {
ItemStack stack = item.getDefaultInstance();
ItemStack repairItem = ItemStack.EMPTY;
try {
repairItem = Misc.getRepairItem(stack);
}
catch (Exception e) { //Gotta catch em all
e.printStackTrace();
}
boolean isRepairable = item.getIsRepairable(stack, repairItem);
boolean materiaAllowed = item.isRepairable();
if(isRepairable || materiaAllowed)
{
ArrayList<ItemStack> repairMaterials = new ArrayList<>();
repairMaterials.add(repairItem.copy());
if(materiaAllowed)
repairMaterials.add(new ItemStack(RegistryManager.isolated_materia));
ItemStack[] repairMaterialsArray = repairMaterials.toArray(new ItemStack[repairMaterials.size()]);
repairRecipes.add(new RecipeDawnstoneAnvil(new ItemStack[]{stack.copy()}, Ingredient.fromStacks(makeDamaged(stack)),Ingredient.fromStacks(repairMaterialsArray)));
if(Misc.getResourceCount(stack) != -1) {
ItemStack material = repairItem.copy();
material.setCount(Misc.getResourceCount(stack));
destroyRecipes.add(new RecipeDawnstoneAnvil(new ItemStack[]{material}, Ingredient.fromStacks(makeDamaged(stack)), Ingredient.EMPTY));
}
}
}
return Stream.concat(repairRecipes.stream(),destroyRecipes.stream()).collect(Collectors.toList());
}
示例9: registerModels
/**
* Register all Item and Block models from the registry.
*/
public static void registerModels() {
for (Block block : Block.REGISTRY) {
if (block instanceof IModelRegister)
((IModelRegister) block).registerModel();
}
for (Item item : Item.REGISTRY) {
if (item instanceof IModelRegister)
((IModelRegister) item).registerModel();
}
}
示例10: registerModels
public static void registerModels() {
for(Block block : Block.REGISTRY) {
if(block instanceof IModel)
((IModel) block).registerModel();
}
for(Item item : Item.REGISTRY) {
if(item instanceof IModel)
((IModel) item).registerModel();
}
Solar.LOG.info("[BAKING CHOCOLATE COOKIES!]");
}
示例11: postInit
public static void postInit()
{
for(Item item : Item.REGISTRY)
{
if(item instanceof ItemAnimaShield)
{
shieldItems.add((ItemAnimaShield) item);
}
}
}
示例12: loadItemModels
private void loadItemModels()
{
this.registerVariantNames();
for (Item item : Item.REGISTRY)
{
for (String s : this.getVariantNames(item))
{
ResourceLocation resourcelocation = this.getItemLocation(s);
ResourceLocation resourcelocation1 = (ResourceLocation)Item.REGISTRY.getNameForObject(item);
this.loadItemModel(s, resourcelocation, resourcelocation1);
if (item.hasCustomProperties())
{
ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);
if (modelblock != null)
{
for (ResourceLocation resourcelocation2 : modelblock.getOverrideLocations())
{
this.loadItemModel(resourcelocation2.toString(), resourcelocation2, resourcelocation1);
}
}
}
}
}
}
示例13: loadItemModels
protected void loadItemModels()
{
this.registerVariantNames();
for (Item item : Item.REGISTRY)
{
for (String s : this.getVariantNames(item))
{
ResourceLocation resourcelocation = this.getItemLocation(s);
ResourceLocation resourcelocation1 = (ResourceLocation)Item.REGISTRY.getNameForObject(item);
this.loadItemModel(s, resourcelocation, resourcelocation1);
if (item.hasCustomProperties())
{
ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);
if (modelblock != null)
{
for (ResourceLocation resourcelocation2 : modelblock.getOverrideLocations())
{
this.loadItemModel(resourcelocation2.toString(), resourcelocation2, resourcelocation1);
}
}
}
}
}
}
示例14: updateCreativeSearch
private void updateCreativeSearch()
{
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
guicontainercreative$containercreative.itemList.clear();
for (Item item : Item.REGISTRY)
{
if (item != null && item.getCreativeTab() != null)
{
item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
}
}
for (Enchantment enchantment : Enchantment.REGISTRY)
{
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(Locale.ROOT);
while (iterator.hasNext())
{
ItemStack itemstack = (ItemStack)iterator.next();
boolean flag = false;
for (String s : itemstack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips))
{
if (TextFormatting.getTextWithoutFormattingCodes(s).toLowerCase(Locale.ROOT).contains(s1))
{
flag = true;
break;
}
}
if (!flag)
{
iterator.remove();
}
}
this.currentScroll = 0.0F;
guicontainercreative$containercreative.scrollTo(0.0F);
}