Java Code Examples for net.minecraft.util.collection.DefaultedList#add()

The following examples show how to use net.minecraft.util.collection.DefaultedList#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShapelessCompressingRecipeSerializer.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
private static DefaultedList<Ingredient> getIngredients(JsonArray jsonArray_1) {
    DefaultedList<Ingredient> defaultedList_1 = DefaultedList.of();

    for (int int_1 = 0; int_1 < jsonArray_1.size(); ++int_1) {
        Ingredient ingredient_1 = Ingredient.fromJson(jsonArray_1.get(int_1));
        if (!ingredient_1.isEmpty()) {
            defaultedList_1.add(ingredient_1);
        }
    }

    return defaultedList_1;
}
 
Example 2
Source File: OxygenTankItem.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendStacks(ItemGroup itemGroup_1, DefaultedList<ItemStack> list) {
    if (this.isIn(itemGroup_1)) {
        list.add(applyDefaultTags(new ItemStack(this), 0));
        list.add(applyDefaultTags(new ItemStack(this), maxOxygen));
    }
}
 
Example 3
Source File: BatteryItem.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> groupStacks) {
    if (this.isIn(group)) {
        ItemStack charged = new ItemStack(this);
        GalacticraftEnergy.setEnergy(charged, MAX_ENERGY);
        groupStacks.add(charged);

        ItemStack depleted = new ItemStack(this);
        GalacticraftEnergy.setEnergy(depleted, 0);
        depleted.setDamage(depleted.getMaxDamage() - 1);
        groupStacks.add(depleted);
    }
}
 
Example 4
Source File: RecipeInfo.java    From multiconnect with MIT License 5 votes vote down vote up
public static RecipeInfo<ShapelessRecipe> shapeless(String group, ItemStack output, ItemConvertible[]... inputs) {
    DefaultedList<Ingredient> ingredients = DefaultedList.of();
    for (ItemConvertible[] input : inputs) {
        ingredients.add(Ingredient.ofItems(input));
    }
    return new RecipeInfo<>(id -> new ShapelessRecipe(id, group, output, ingredients), RecipeSerializer.SHAPELESS, output);
}
 
Example 5
Source File: FabricationRecipe.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
public DefaultedList<Ingredient> getPreviewInputs() {
    DefaultedList<Ingredient> list = DefaultedList.of();
    list.add(this.input);
    return list;
}