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


Java NonNullList.addAll方法代碼示例

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


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

示例1: onInputChanged

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public void onInputChanged() {
    ItemStack input = this.input.getStackInSlot(0);
    if (!input.isEmpty()) {
        List<CraftiniumConvert> recipes = CraftiniumConvertRegistry.findMatching(input, this.world, this.converter, this.player);
        NonNullList<ItemStack> allResults = NonNullList.create();
        for (CraftiniumConvert convert : recipes) {
            allResults.addAll(convert.conversions(input, this.world, this.converter, this.player));
        }

        NonNullList<ItemStack> toDisplay = NonNullList.withSize(Math.max(9, allResults.size()), ItemStack.EMPTY);
        for (int i = 0; i < allResults.size(); i++) {
            toDisplay.set(i, allResults.get(i));
        }

        PagedItemStackHandler handler = new PagedItemStackHandler(toDisplay, this.handler.getIndex());
        this.handler = handler;
        this.delegate.setHandler(handler);

        this.detectAndSendChanges();
    }
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:22,代碼來源:CraftiniumConverterContainer.java

示例2: getDrops

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
    if (content.snowball != null)
    {
        ItemStack stack = content.snowball.getItemStack().copy();
        stack.setCount((state.getValue(LAYERS) + 1) * stack.getCount());

        drops.add(stack);
    }

    Optional<BlockDrop[]> blockDrops = getContent().drop.get(getSubtype(state));
    if (blockDrops.isPresent())
    {
        drops.addAll(ItemHelper.getDroppedStacks(blockDrops.get()));
    }
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:18,代碼來源:BlockSnow.java

示例3: removeMelting

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@ZenMethod
public static void removeMelting(IItemStack input) {
	List<MelteryRecipe> recipes = new LinkedList<>();

	for (MelteryRecipe meta : MelteryHandler.meltingRecipes) {
		NonNullList<ItemStack> items = NonNullList.create();
		items.addAll(input.getItems().stream().map(InputHelper::toStack).collect(Collectors.toList()));
		if (meta.input.matches(items) != null) {
			recipes.add(meta);
		}
	}

	if (!recipes.isEmpty()) {
		MineTweakerAPI.apply(new RemoveMelting(recipes));
	} else {
		LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", nameMelting, input.toString()));
	}
}
 
開發者ID:primetoxinz,項目名稱:Meltery,代碼行數:19,代碼來源:Minetweaker.java

示例4: chop

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public List<ItemStack> chop(Queue<BlockPos> cache, boolean shear) {
    BlockPos p = cache.peek();
    NonNullList<ItemStack> stacks = NonNullList.create();
    if (BlockUtils.isLeaves(world, p) || BlockUtils.isLog(world, p)) {
        IBlockState s = world.getBlockState(p);
        if (s.getBlock() instanceof IShearable && shear) {
            stacks.addAll(((IShearable) s.getBlock()).onSheared(new ItemStack(Items.SHEARS), world, p, 0));
        } else {
            s.getBlock().getDrops(stacks, world, p, s, 0);
        }
        world.setBlockToAir(p);
    }
    cache.poll();
    return stacks;
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:16,代碼來源:TreeCache.java

示例5: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems)
{
    if (isInCreativeTab(creativeTab))
    {
        subItems.addAll(ItemHelper.createSubItems(this, creativeTab, getContent().creativeTab, getContent().subtypes));
    }
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:9,代碼來源:ItemWithSubtypesMixin.java

示例6: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
	if (this.isInCreativeTab(tab)) {
		for (int i = 1; i < 2; i++) {
			ItemStack stack = new ItemStack(this, 1, 0);
			stack.setTagCompound(new NBTTagCompound());
			stack.getTagCompound().setInteger("type", i);
			items.add(stack);
		}

		items.addAll(PonySocks.getSocksOrdered());
	}
}
 
開發者ID:asiekierka,項目名稱:PonySocks2,代碼行數:14,代碼來源:ItemSock.java

示例7: getOreNames

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public static NonNullList<ItemStack> getOreNames(String prefix) {
    NonNullList<ItemStack> list = NonNullList.create();
    list.addAll(Arrays.stream(OreDictionary.getOreNames()).filter(n -> n.startsWith(prefix)).flatMap(n -> OreDictionary.getOres(n).stream()).collect(Collectors.toList()));
    return list;
}
 
開發者ID:primetoxinz,項目名稱:Meltery,代碼行數:6,代碼來源:MelteryHandler.java


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