Removed color provider
This commit is contained in:
parent
2c8862a37b
commit
4040597a6d
475 changed files with 5411 additions and 7521 deletions
|
@ -30,18 +30,18 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
public final static String GROUP = "infusion";
|
||||
public final static RecipeType<InfusionRecipe> TYPE = BCLRecipeManager.registerType(BetterEnd.MOD_ID, GROUP);
|
||||
public final static Serializer SERIALIZER = BCLRecipeManager.registerSerializer(BetterEnd.MOD_ID, GROUP, new Serializer());
|
||||
|
||||
|
||||
private final ResourceLocation id;
|
||||
private final Ingredient[] catalysts;
|
||||
private Ingredient input;
|
||||
private ItemStack output;
|
||||
private int time = 1;
|
||||
private String group;
|
||||
|
||||
|
||||
private InfusionRecipe(ResourceLocation id) {
|
||||
this(id, null, null);
|
||||
}
|
||||
|
||||
|
||||
private InfusionRecipe(ResourceLocation id, Ingredient input, ItemStack output) {
|
||||
this.id = id;
|
||||
this.input = input;
|
||||
|
@ -49,11 +49,11 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
this.catalysts = new Ingredient[8];
|
||||
Arrays.fill(catalysts, Ingredient.EMPTY);
|
||||
}
|
||||
|
||||
|
||||
public int getInfusionTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean matches(InfusionRitual inv, Level world) {
|
||||
boolean valid = this.input.test(inv.getItem(0));
|
||||
|
@ -63,17 +63,17 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(InfusionRitual ritual) {
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canCraftInDimensions(int width, int height) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
NonNullList<Ingredient> defaultedList = NonNullList.create();
|
||||
|
@ -81,97 +81,97 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
defaultedList.addAll(Arrays.asList(catalysts));
|
||||
return defaultedList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getResultItem() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public String getGroup() {
|
||||
return this.group;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return SERIALIZER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RecipeType<?> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
|
||||
public static class Builder {
|
||||
private final static Builder INSTANCE = new Builder();
|
||||
private static boolean exist;
|
||||
|
||||
|
||||
public static Builder create(String id) {
|
||||
return create(BetterEnd.makeID(id));
|
||||
}
|
||||
|
||||
|
||||
public static Builder create(ResourceLocation id) {
|
||||
INSTANCE.id = id;
|
||||
INSTANCE.input = null;
|
||||
INSTANCE.output = null;
|
||||
INSTANCE.time = 1;
|
||||
exist = Configs.RECIPE_CONFIG.getBoolean("infusion", id.getPath(), true);
|
||||
|
||||
|
||||
Arrays.fill(INSTANCE.catalysts, Ingredient.EMPTY);
|
||||
|
||||
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
private final Ingredient[] catalysts = new Ingredient[8];
|
||||
private ResourceLocation id;
|
||||
private Ingredient input;
|
||||
private ItemStack output;
|
||||
private String group;
|
||||
private int time = 1;
|
||||
|
||||
|
||||
private Builder() {
|
||||
Arrays.fill(catalysts, Ingredient.EMPTY);
|
||||
}
|
||||
|
||||
|
||||
public Builder setGroup(String group) {
|
||||
this.group = group;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setInput(ItemLike input) {
|
||||
this.input = Ingredient.of(input);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setOutput(ItemLike output) {
|
||||
this.output = new ItemStack(output);
|
||||
this.output.setCount(1);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setOutput(ItemStack output) {
|
||||
this.output = output;
|
||||
this.output.setCount(1);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setTime(int time) {
|
||||
this.time = time;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder addCatalyst(int slot, ItemLike... items) {
|
||||
if (slot > 7) return this;
|
||||
this.catalysts[slot] = Ingredient.of(items);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void build() {
|
||||
if (exist) {
|
||||
if (input == null) {
|
||||
|
@ -198,7 +198,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Serializer implements RecipeSerializer<InfusionRecipe> {
|
||||
@Override
|
||||
public InfusionRecipe fromJson(ResourceLocation id, JsonObject json) {
|
||||
|
@ -221,7 +221,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
}
|
||||
recipe.group = GsonHelper.getAsString(json, "group", GROUP);
|
||||
recipe.time = GsonHelper.getAsInt(json, "time", 1);
|
||||
|
||||
|
||||
JsonObject catalysts = GsonHelper.getAsJsonObject(json, "catalysts");
|
||||
ItemStack catalyst = ItemUtil.fromStackString(GsonHelper.getAsString(catalysts, "north", ""));
|
||||
recipe.catalysts[0] = (catalyst != null && !catalyst.isEmpty()) ? Ingredient.of(catalyst.getItem()) : Ingredient.EMPTY;
|
||||
|
@ -239,10 +239,10 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
recipe.catalysts[6] = (catalyst != null && !catalyst.isEmpty()) ? Ingredient.of(catalyst.getItem()) : Ingredient.EMPTY;
|
||||
catalyst = ItemUtil.fromStackString(GsonHelper.getAsString(catalysts, "north_west", ""));
|
||||
recipe.catalysts[7] = (catalyst != null && !catalyst.isEmpty()) ? Ingredient.of(catalyst.getItem()) : Ingredient.EMPTY;
|
||||
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InfusionRecipe fromNetwork(ResourceLocation id, FriendlyByteBuf buffer) {
|
||||
InfusionRecipe recipe = new InfusionRecipe(id);
|
||||
|
@ -255,7 +255,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
}
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void toNetwork(FriendlyByteBuf buffer, InfusionRecipe recipe) {
|
||||
recipe.input.toNetwork(buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue