net.minecraft.util.NonNullList.from()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中net.minecraft.util.NonNullList.from()方法的一些代码示例,展示了NonNullList.from()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NonNullList.from()方法的具体详情如下:
包路径:net.minecraft.util.NonNullList
类名称:NonNullList
方法名:from

NonNullList.from介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

public HelmRevealingRecipe(Item output, Item botaniaHelm) {
  super("botania:helm_revealing", new ItemStack(output),
      NonNullList.from(Ingredient.EMPTY, Ingredient.fromItem(botaniaHelm), Ingredient.fromItem(goggles)));
  this.botaniaHelm = botaniaHelm;
}

代码示例来源:origin: ForestryMC/ForestryMC

protected NonNullList<ItemStack> createList(ItemStack... stacks) {
  return NonNullList.from(ItemStack.EMPTY, stacks);
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
  protected NonNullList<ItemStack> getDrops(World world, IBlockState state, BlockPos pos, int fortune) {
    return NonNullList.from(ItemStack.EMPTY, drop.copy());
  }
}

代码示例来源:origin: TheCBProject/EnderStorage

public ReColourRecipe(@Nonnull ItemStack result, Ingredient ingredient, Ingredient dyeIngredient) {
  super(new ResourceLocation(EnderStorage.MOD_ID, "crafting_recipe"), result, NonNullList.from(Ingredient.EMPTY, ingredient));
  this.ingredient = ingredient;
  this.dyeIngredient = dyeIngredient;
}

代码示例来源:origin: ForestryMC/ForestryMC

public IngredientElement(int xPos, int yPos, Ingredient ingredient) {
  super(xPos, yPos);
  items = NonNullList.from(ItemStack.EMPTY, ingredient.getMatchingStacks());
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public static void syncConfig(Configuration config) {
  String category = Const.ConfigCategory.modpackMisc;
  String[] deflist = new String[0];
  String[] blacklist = config.getStringList("AutoUserTargetBlacklist",
    category, deflist, "Blocks in-world that cannot be targeted by the auto user.  Use block id; for example minecraft:chest");
  blacklistAll = NonNullList.from("",
    blacklist);
 }
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Ingredient... input)
{
  Preconditions.checkNotNull(output, "output cannot be null.");
  Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
  Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
  Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
  Preconditions.checkNotNull(input, "input cannot be null.");
  NonNullList<Ingredient> inputs = NonNullList.from(Ingredient.EMPTY, input);
  alchemyRecipes.add(new RecipeAlchemyTable(inputs, output, syphon, ticks, minimumTier));
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Ingredient... input)
{
  Preconditions.checkNotNull(output, "output cannot be null.");
  Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative.");
  Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative.");
  Preconditions.checkNotNull(input, "input cannot be null.");
  NonNullList<Ingredient> inputs = NonNullList.from(Ingredient.EMPTY, input);
  tartaricForgeRecipes.add(new RecipeTartaricForge(inputs, output, minimumSouls, soulDrain));
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Ingredient... input)
{
  Preconditions.checkNotNull(output, "output cannot be null.");
  Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative.");
  Preconditions.checkNotNull(input, "input cannot be null.");
  NonNullList<Ingredient> inputs = NonNullList.from(Ingredient.EMPTY, input);
  sacrificeCraftRecipes.add(new RecipeSacrificeCraft(inputs, output, healthRequired));
}

代码示例来源:origin: GregTechCE/GregTech

public static NonNullList<ItemStack> copyStackList(List<ItemStack> itemStacks) {
  ItemStack[] stacks = new ItemStack[itemStacks.size()];
  for (int i = 0; i < itemStacks.size(); i++) {
    stacks[i] = copy(itemStacks.get(i));
  }
  return NonNullList.from(ItemStack.EMPTY, stacks);
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 public void syncConfig(Configuration config) {
  String category = Const.ConfigCategory.modpackMisc;
  String[] deflist = new String[] { "extracells:fluidcrafter",
    "extracells:ecbaseblock",
    "extracells:fluidfiller",
    "refinedstorage:disk_drive" };
  String[] blacklist = config.getStringList("SackHoldingBlacklist",
    category, deflist, "Containers that cannot be lifted up with the Empty Sack of Holding.  Use block id; for example minecraft:chest");
  blacklistAll = NonNullList.from("",
    blacklist);
 }
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
  public NonNullList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
    return NonNullList.from(ItemStack.EMPTY, new ItemStack(Item.getItemFromBlock(Blocks.CHORUS_FLOWER)));
  }
}

代码示例来源:origin: CyclopsMC/IntegratedDynamics

@Override
  public NonNullList<Ingredient> getIngredients() {
    return NonNullList.from(Ingredient.EMPTY, Ingredient.fromStacks(getRecipeOutput()));
  }
}

代码示例来源:origin: WayofTime/BloodMagic

public AlchemyArrayCraftingRecipeJEI(RecipeAlchemyArray array) {
  this.inputs = NonNullList.from(ItemStack.EMPTY, array.getInput().getMatchingStacks());
  this.catalyst = NonNullList.from(ItemStack.EMPTY, array.getCatalyst().getMatchingStacks());
  this.output = array.getOutput();
}

代码示例来源:origin: lorddusk/HQM

@Nonnull
  @Override
  public NonNullList<ItemStack> getItemStacks(){
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setUniqueId("Questbook", this.getUUID());
    ItemStack stack = new ItemStack(Registry.itemQuestBook);
    stack.setTagCompound(nbt);
    return NonNullList.from(ItemStack.EMPTY, stack);
  }
}

代码示例来源:origin: CyclopsMC/EvilCraft

public DeadBushRecipe() {
  super(new ResourceLocation(Reference.MOD_ID, "deadbush"),
      NonNullList.from(Ingredient.EMPTY, Ingredient.fromItem(Items.SHEARS), new OreIngredient("treeSapling")),
      new ItemStack(Blocks.DEADBUSH));
}

代码示例来源:origin: CyclopsMC/IntegratedDynamics

@Override
  public NonNullList<Ingredient> getIngredients() {
    return NonNullList.from(Ingredient.EMPTY, Ingredient.fromStacks(getRecipeOutput()), Ingredient.fromStacks(getRecipeOutput()));
  }
}

代码示例来源:origin: GregTechCE/GregTech

public R fromRecipe(Recipe recipe) {
  this.inputs = recipe.getInputs();
  this.outputs = NonNullList.from(ItemStack.EMPTY, recipe.getOutputs().toArray(new ItemStack[0]));
  this.chancedOutputs = new TObjectIntHashMap<>(recipe.getChancedOutputs());
  this.fluidInputs = new ArrayList<>(recipe.getFluidInputs());
  this.fluidOutputs = new ArrayList<>(recipe.getFluidOutputs());
  this.duration = recipe.getDuration();
  this.EUt = recipe.getEUt();
  this.hidden = recipe.isHidden();
  this.canBeBuffered = recipe.canBeBuffered();
  this.needsEmptyOutput = recipe.needsEmptyOutput();
  return (R) this;
}

代码示例来源:origin: WayofTime/BloodMagic

public AltarRecipeJEI(RecipeBloodAltar recipe) {
  this.input = NonNullList.from(ItemStack.EMPTY, recipe.getInput().getMatchingStacks());
  this.output = recipe.getOutput();
  this.infoString = new String[]{TextHelper.localize("jei.bloodmagic.recipe.requiredTier", NumeralHelper.toRoman(recipe.getMinimumTier().toInt())), TextHelper.localize("jei.bloodmagic.recipe.requiredLP", recipe.getSyphon())};
  this.consumptionRate = recipe.getConsumeRate();
  this.drainRate = recipe.getDrainRate();
}

代码示例来源:origin: PrinceOfAmber/Cyclic

/**
  * TODO: make a unit testing module, or install a framework for now these pass so i removed call to them
  */
 public static void unitTests() {
  NonNullList<String> blacklist = NonNullList.from("",
    "terraqueous:pergola", "harvestcraft:*_sapling", "croparia:block_cane_*");
  ModCyclic.logger.logTestResult("1] expect true " + isInList(blacklist, new ResourceLocation("harvestcraft:fruit_sapling")));
  ModCyclic.logger.logTestResult("2] expect true " + isInList(blacklist, new ResourceLocation("croparia:block_cane_zzzzzz")));
  ModCyclic.logger.logTestResult("3] expect false " + isInList(blacklist, new ResourceLocation("harvestcraft:pampeach")));
  ModCyclic.logger.logTestResult("4] expect false " + isInList(blacklist, new ResourceLocation("harvestcraft:groundtrap")));
 }
}

相关文章