preference.getItem().getSubItems(CreativeTab.SEARCH, subItems); if(subItems.isEmpty()) {
if( stacks.isEmpty() )
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 ) ); } }
/** * 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(); } }
@Override public boolean isEmpty() { return itemStack.isEmpty(); } }
@Override public boolean isEmpty() { return inventory.isEmpty(); } }
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; }
private boolean isListEmpty(NonNullList<ItemStack> cocoonDrops) { if (cocoonDrops.isEmpty()) { return true; } for (ItemStack stack : cocoonDrops) { if (!stack.isEmpty()) { return false; } } return true; }
@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(); }
public static boolean isRegistered(String name) { if (!OreDictionary.getOres(name).isEmpty()) { return true; } return false; }
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; } }
@Override protected ItemStack getStack() { if (items.isEmpty()) { return ItemStack.EMPTY; } int perm = (int) (System.currentTimeMillis() / 1000 % items.size()); return items.get(perm); } }
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; }
@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}; }
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; } }
@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; }
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); }
@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; }
@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(); }
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; }