Reformated
This commit is contained in:
parent
079b51e3f6
commit
852e5a6abc
385 changed files with 6924 additions and 5656 deletions
|
@ -1,5 +1,13 @@
|
|||
package org.betterx.bclib.recipes;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.v2.tag.CommonItemTags;
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
import org.betterx.bclib.interfaces.UnknownReceipBookCategory;
|
||||
import org.betterx.bclib.util.ItemUtil;
|
||||
import org.betterx.bclib.util.RecipeHelper;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -25,13 +33,6 @@ import net.fabricmc.api.EnvType;
|
|||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.v2.tag.CommonItemTags;
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
import org.betterx.bclib.interfaces.UnknownReceipBookCategory;
|
||||
import org.betterx.bclib.util.ItemUtil;
|
||||
import org.betterx.bclib.util.RecipeHelper;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -43,7 +44,7 @@ public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory
|
|||
BCLib.MOD_ID,
|
||||
GROUP,
|
||||
new Serializer()
|
||||
);
|
||||
);
|
||||
public final static ResourceLocation ID = BCLib.makeID(GROUP);
|
||||
|
||||
public static void register() {
|
||||
|
@ -58,13 +59,15 @@ public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory
|
|||
private final int anvilLevel;
|
||||
private final int inputCount;
|
||||
|
||||
public AnvilRecipe(ResourceLocation identifier,
|
||||
Ingredient input,
|
||||
ItemStack output,
|
||||
int inputCount,
|
||||
int toolLevel,
|
||||
int anvilLevel,
|
||||
int damage) {
|
||||
public AnvilRecipe(
|
||||
ResourceLocation identifier,
|
||||
Ingredient input,
|
||||
ItemStack output,
|
||||
int inputCount,
|
||||
int toolLevel,
|
||||
int anvilLevel,
|
||||
int damage
|
||||
) {
|
||||
this.id = identifier;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
|
@ -180,7 +183,7 @@ public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory
|
|||
.filter(hammer -> ((TieredItem) hammer).getTier()
|
||||
.getLevel() >= toolLevel)
|
||||
.map(ItemStack::new))
|
||||
);
|
||||
);
|
||||
defaultedList.add(input);
|
||||
return defaultedList;
|
||||
}
|
||||
|
@ -313,8 +316,10 @@ public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory
|
|||
BCLib.LOGGER.debug("Can't add Anvil recipe {}! Ingeredient or output not exists.", id);
|
||||
return;
|
||||
}
|
||||
BCLRecipeManager.addRecipe(TYPE,
|
||||
new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage));
|
||||
BCLRecipeManager.addRecipe(
|
||||
TYPE,
|
||||
new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.betterx.bclib.recipes;
|
||||
|
||||
import org.betterx.bclib.util.CollectionsUtil;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.Container;
|
||||
|
@ -12,7 +14,6 @@ import net.minecraft.world.level.block.Block;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.betterx.bclib.util.CollectionsUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -23,10 +24,12 @@ public class BCLRecipeManager {
|
|||
private static final Map<RecipeType<?>, Object> SORTED = Maps.newHashMap();
|
||||
private static final String MINECRAFT = "minecraft";
|
||||
|
||||
public static <C extends Container, T extends Recipe<C>> Optional<T> getSortedRecipe(RecipeType<T> type,
|
||||
C inventory,
|
||||
Level level,
|
||||
Function<RecipeType<T>, Map<ResourceLocation, Recipe<C>>> getter) {
|
||||
public static <C extends Container, T extends Recipe<C>> Optional<T> getSortedRecipe(
|
||||
RecipeType<T> type,
|
||||
C inventory,
|
||||
Level level,
|
||||
Function<RecipeType<T>, Map<ResourceLocation, Recipe<C>>> getter
|
||||
) {
|
||||
List<Recipe<C>> recipes = (List<Recipe<C>>) SORTED.computeIfAbsent(type, t -> {
|
||||
Collection<Recipe<C>> values = getter.apply(type).values();
|
||||
List<Recipe<C>> list = new ArrayList<>(values);
|
||||
|
@ -80,9 +83,11 @@ public class BCLRecipeManager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static <S extends RecipeSerializer<T>, T extends Recipe<?>> S registerSerializer(String modID,
|
||||
String id,
|
||||
S serializer) {
|
||||
public static <S extends RecipeSerializer<T>, T extends Recipe<?>> S registerSerializer(
|
||||
String modID,
|
||||
String id,
|
||||
S serializer
|
||||
) {
|
||||
return Registry.register(Registry.RECIPE_SERIALIZER, modID + ":" + id, serializer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package org.betterx.bclib.recipes;
|
||||
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.v2.tag.CommonItemTags;
|
||||
import org.betterx.bclib.config.Configs;
|
||||
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class CraftingRecipes {
|
||||
public static void init() {
|
||||
GridRecipe.make(BCLib.MOD_ID, "tag_smith_table", Blocks.SMITHING_TABLE)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package org.betterx.bclib.recipes;
|
||||
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.*;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
|
||||
public class FurnaceRecipe {
|
||||
private static final FurnaceRecipe INSTANCE = new FurnaceRecipe();
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.betterx.bclib.recipes;
|
||||
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
@ -9,7 +11,6 @@ import net.minecraft.world.item.crafting.*;
|
|||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.betterx.bclib.recipes;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -9,9 +12,6 @@ import net.minecraft.world.item.crafting.RecipeType;
|
|||
import net.minecraft.world.item.crafting.UpgradeRecipe;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.config.PathConfig;
|
||||
|
||||
public class SmithingTableRecipe {
|
||||
|
||||
private final static SmithingTableRecipe BUILDER = new SmithingTableRecipe();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue