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

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

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

NonNullList.isEmpty介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/TinkersConstruct

preference.getItem().getSubItems(CreativeTab.SEARCH, subItems);
if(subItems.isEmpty()) {

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( stacks.isEmpty() )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private static ShapelessOreRecipe shapelessFactory( JsonContext context, JsonObject json )
  {
    String group = JsonUtils.getString( json, "group", "" );

    NonNullList<Ingredient> ings = NonNullList.create();
    for( JsonElement ele : JsonUtils.getJsonArray( json, "ingredients" ) )
    {
      ings.add( CraftingHelper.getIngredient( ele, context ) );
    }

    if( ings.isEmpty() )
    {
      throw new JsonParseException( "No ingredients for shapeless recipe" );
    }

    return new ShapelessOreRecipe( group.isEmpty() ? null : new ResourceLocation( group ), ings, getResult( json, context ) );
  }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

/**
 * Called to integrate the recipes based on oredictionary recipes
 */
public void integrate() {
 if(integrated) {
  return;
 }
 if(oreRequirement != null && oreRequirement.length > 0 && !Config.forceRegisterAll) {
  // loop through each ore string ensuring it is used
  for(String ore : oreRequirement) {
   // this is much more efficient then iterating through all entries and ensures we do not create entries
   if(OreDictionary.getOres(ore, false).isEmpty()) {
    return;
   }
  }
 }
 integrated = true;
 // register melting and casting
 if(fluid != null && oreSuffix != null) {
  TinkerSmeltery.registerOredictMeltingCasting(fluid, oreSuffix);
 }
 if(material != null) {
  material.setVisible();
  TinkerSmeltery.registerToolpartMeltingCasting(material);
  registerRepresentativeItem();
 }
}

代码示例来源:origin: Funwayguy/BetterQuesting

@Override
  public boolean isEmpty()
  {
    return itemStack.isEmpty();
  }
}

代码示例来源:origin: Chisel-Team/Chisel

@Override
  public boolean isEmpty() {
    return inventory.isEmpty();
  }
}

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

public SqueezerRecipe(int processingTime, NonNullList<ItemStack> resources, FluidStack fluidOutput, ItemStack remnants, float remnantsChance) {
  Preconditions.checkNotNull(resources);
  Preconditions.checkArgument(!resources.isEmpty());
  Preconditions.checkNotNull(fluidOutput);
  Preconditions.checkNotNull(remnants);
  this.processingTime = processingTime;
  this.resources = resources;
  this.fluidOutput = fluidOutput;
  this.remnants = remnants;
  this.remnantsChance = remnantsChance;
}

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

private boolean isListEmpty(NonNullList<ItemStack> cocoonDrops) {
  if (cocoonDrops.isEmpty()) {
    return true;
  }
  for (ItemStack stack : cocoonDrops) {
    if (!stack.isEmpty()) {
      return false;
    }
  }
  return true;
}

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

@Override
public boolean isActive() {
  if (this.metalString != null) {
    NonNullList<ItemStack> ingots = OreDictionary.getOres("ingot" + this.metalString);
    NonNullList<ItemStack> dust = OreDictionary.getOres("dust" + this.metalString);
    return !ingots.isEmpty() || !dust.isEmpty() || this == ExtraBeeItems.COAL_DUST;
  }
  NonNullList<ItemStack> gems = OreDictionary.getOres("gem" + this.gemString);
  return this.gemString == null || !gems.isEmpty();
}

代码示例来源:origin: SleepyTrousers/EnderCore

public static boolean isRegistered(String name) {
 if (!OreDictionary.getOres(name).isEmpty()) {
  return true;
 }
 return false;
}

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

private static boolean checkIngredientMatch(@Nullable NonNullList<ItemStack> recipeIngredient, ItemStack resource) {
    if (recipeIngredient == null || recipeIngredient.isEmpty()) {
      return resource.isEmpty();
    }
    for (ItemStack item : recipeIngredient) {
      if (ItemStackUtil.isCraftingEquivalent(item, resource)) {
        return true;
      }
    }
    return false;
  }
}

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

@Override
  protected ItemStack getStack() {
    if (items.isEmpty()) {
      return ItemStack.EMPTY;
    }
    int perm = (int) (System.currentTimeMillis() / 1000 % items.size());
    return items.get(perm);
  }
}

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

private boolean collectWindfall() {
  NonNullList<ItemStack> collected = logic.collect(world, this);
  if (collected.isEmpty()) {
    return false;
  }
  for (ItemStack produce : collected) {
    inventory.addProduce(produce);
    pendingProduce.push(produce);
  }
  return true;
}

代码示例来源:origin: raoulvdberge/refinedstorage

@Callback(doc = "function():table -- Gets the fluid patterns of this network.")
public Object[] getFluidPatterns(final Context context, final Arguments args) {
  if (node.getNetwork() == null) {
    return new Object[]{null, "not connected"};
  }
  List<FluidStack> patterns = new LinkedList<>();
  for (ICraftingPattern pattern : node.getNetwork().getCraftingManager().getPatterns()) {
    if (!pattern.getFluidOutputs().isEmpty()) {
      patterns.addAll(pattern.getFluidOutputs());
    }
  }
  return new Object[]{patterns};
}

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

public void tryAddProduct(final String oreDict, final Float chance) {
  if (!OreDictionary.getOres(oreDict).isEmpty()) {
    this.tryAddProduct(OreDictionary.getOres(oreDict).get(0), chance);
  } else {
    this.active = false;
  }
}

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

@Override
public boolean pick(World world, IBlockState state, BlockPos pos, int fortune, IItemHandler inventory) {
  NonNullList<ItemStack> drops = getDrops(world, state, pos, fortune);
  if (drops.isEmpty() || !InventoryTools.canInventoryHold(inventory, drops)) {
    return false;
  }
  world.setBlockState(pos, newState.update(state));
  putInInventory(world, pos, inventory, drops);
  return true;
}

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

private ResearchRecipeBase parseShapeless(JsonContext context, JsonObject json) {
  NonNullList<Ingredient> ings = NonNullList.create();
  String research = JsonUtils.getString(json, "research");
  for (JsonElement ele : JsonUtils.getJsonArray(json, "ingredients"))
    ings.add(CraftingHelper.getIngredient(ele, context));
  if (ings.isEmpty())
    throw new JsonParseException("No ingredients for shapeless recipe");
  ItemStack result = CraftingHelper.getItemStack(JsonUtils.getJsonObject(json, "result"), context);
  return new ShapelessResearchRecipe(research, ings, result);
}

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

@Override
public boolean pick(World world, IBlockState state, BlockPos pos, int fortune, IItemHandler inventory) {
  NonNullList<ItemStack> drops = NonNullList.create();
  state.getBlock().getDrops(drops, world, pos, state, fortune);
  if (drops.isEmpty() || !InventoryTools.canInventoryHold(inventory, drops)) {
    return false;
  }
  BlockTools.breakBlock(world, pos, fortune, false);
  InventoryTools.insertOrDropItems(inventory, drops, world, pos);
  return true;
}

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

@Override
public ErrorState canWork() {
  final MachineUtil machineUtil = getUtil();
  if (machineUtil.getStack(Acclimatiser.SLOT_TARGET).isEmpty()) {
    return new ErrorState(GeneticsErrorCode.NO_INDIVIDUAL, Acclimatiser.SLOT_TARGET);
  }
  if (machineUtil.getNonEmptyStacks(Acclimatiser.SLOT_ACCLIMATISER).isEmpty()) {
    return new ErrorState(GeneticsErrorCode.ACCLIMATISER_NO_ITEM, Acclimatiser.SLOT_ACCLIMATISER);
  }
  return super.canWork();
}

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

public boolean tryCraftItem() {
  if (canHold()) {
    NonNullList<ItemStack> reusableStacks = AWCraftingManager.getReusableStacks(craftingRecipeMemory.getRecipe(), craftingRecipeMemory.craftMatrix);
    NonNullList<ItemStack> resources = InventoryTools.removeItems(AWCraftingManager.getRecipeInventoryMatch(craftingRecipeMemory.getRecipe(), craftingRecipeMemory.getCraftingStacks(),
        new CombinedInvWrapper(resourceInventory, new ItemStackHandler(reusableStacks))), reusableStacks);
    if (!resources.isEmpty()) {
      craftItem(resources, reusableStacks);
      return true;
    }
  }
  return false;
}

相关文章