本文整理匯總了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();
}
}
示例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()));
}
}
示例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()));
}
}
示例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;
}
示例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));
}
}
示例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());
}
}
示例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;
}