Recipe config
This commit is contained in:
parent
fe282bddc6
commit
4b55bf30a8
6 changed files with 78 additions and 59 deletions
|
@ -10,6 +10,7 @@ public class Configs {
|
||||||
public static final PathConfig ITEM_CONFIG = new PathConfig("items");
|
public static final PathConfig ITEM_CONFIG = new PathConfig("items");
|
||||||
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
|
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
|
||||||
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
|
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
|
||||||
|
public static final PathConfig RECIPE_CONFIG = new PathConfig("recipes");
|
||||||
|
|
||||||
@Environment(value = EnvType.CLIENT)
|
@Environment(value = EnvType.CLIENT)
|
||||||
public static final PathConfig CLENT_CONFIG = new PathConfig("client");
|
public static final PathConfig CLENT_CONFIG = new PathConfig("client");
|
||||||
|
@ -20,6 +21,7 @@ public class Configs {
|
||||||
BIOME_CONFIG.saveChanges();
|
BIOME_CONFIG.saveChanges();
|
||||||
ITEM_CONFIG.saveChanges();
|
ITEM_CONFIG.saveChanges();
|
||||||
GENERATOR_CONFIG.saveChanges();
|
GENERATOR_CONFIG.saveChanges();
|
||||||
|
RECIPE_CONFIG.saveChanges();
|
||||||
|
|
||||||
if (BetterEnd.isClient()) {
|
if (BetterEnd.isClient()) {
|
||||||
CLENT_CONFIG.saveChanges();
|
CLENT_CONFIG.saveChanges();
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.config.Configs;
|
||||||
import ru.betterend.recipe.EndRecipeManager;
|
import ru.betterend.recipe.EndRecipeManager;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.util.ItemUtil;
|
import ru.betterend.util.ItemUtil;
|
||||||
|
@ -118,6 +119,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final static Builder INSTANCE = new Builder();
|
private final static Builder INSTANCE = new Builder();
|
||||||
|
private static boolean exist;
|
||||||
|
|
||||||
public static Builder create(Identifier id) {
|
public static Builder create(Identifier id) {
|
||||||
INSTANCE.id = id;
|
INSTANCE.id = id;
|
||||||
|
@ -127,6 +129,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
|
||||||
INSTANCE.output = null;
|
INSTANCE.output = null;
|
||||||
INSTANCE.experience = 0.0F;
|
INSTANCE.experience = 0.0F;
|
||||||
INSTANCE.smeltTime = 350;
|
INSTANCE.smeltTime = 350;
|
||||||
|
exist = Configs.RECIPE_CONFIG.getBoolean("alloying", id.getPath(), true);
|
||||||
|
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
@ -206,6 +209,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build() {
|
public void build() {
|
||||||
|
if (exist) {
|
||||||
if (primaryInput == null) {
|
if (primaryInput == null) {
|
||||||
BetterEnd.LOGGER.warning("Primary input for Alloying recipe can't be 'null', recipe {} will be ignored!", id);
|
BetterEnd.LOGGER.warning("Primary input for Alloying recipe can't be 'null', recipe {} will be ignored!", id);
|
||||||
return;
|
return;
|
||||||
|
@ -229,6 +233,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
|
||||||
EndRecipeManager.addRecipe(TYPE, new AlloyingRecipe(id, group, primaryInput, secondaryInput, output, experience, smeltTime));
|
EndRecipeManager.addRecipe(TYPE, new AlloyingRecipe(id, group, primaryInput, secondaryInput, output, experience, smeltTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<AlloyingRecipe> {
|
public static class Serializer implements RecipeSerializer<AlloyingRecipe> {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.config.Configs;
|
||||||
import ru.betterend.recipe.EndRecipeManager;
|
import ru.betterend.recipe.EndRecipeManager;
|
||||||
import ru.betterend.registry.EndTags;
|
import ru.betterend.registry.EndTags;
|
||||||
import ru.betterend.util.ItemUtil;
|
import ru.betterend.util.ItemUtil;
|
||||||
|
@ -126,6 +127,7 @@ public class AnvilSmithingRecipe implements Recipe<Inventory> {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final static Builder INSTANCE = new Builder();
|
private final static Builder INSTANCE = new Builder();
|
||||||
|
private static boolean exist;
|
||||||
|
|
||||||
public static Builder create(String id) {
|
public static Builder create(String id) {
|
||||||
return create(BetterEnd.makeID(id));
|
return create(BetterEnd.makeID(id));
|
||||||
|
@ -137,6 +139,7 @@ public class AnvilSmithingRecipe implements Recipe<Inventory> {
|
||||||
INSTANCE.output = null;
|
INSTANCE.output = null;
|
||||||
INSTANCE.level = 1;
|
INSTANCE.level = 1;
|
||||||
INSTANCE.damage = 1;
|
INSTANCE.damage = 1;
|
||||||
|
exist = Configs.RECIPE_CONFIG.getBoolean("anvil", id.getPath(), true);
|
||||||
|
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
@ -185,6 +188,7 @@ public class AnvilSmithingRecipe implements Recipe<Inventory> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build() {
|
public void build() {
|
||||||
|
if (exist) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
BetterEnd.LOGGER.warning("Input for Smithing recipe can't be 'null', recipe {} will be ignored!", id);
|
BetterEnd.LOGGER.warning("Input for Smithing recipe can't be 'null', recipe {} will be ignored!", id);
|
||||||
return;
|
return;
|
||||||
|
@ -204,6 +208,7 @@ public class AnvilSmithingRecipe implements Recipe<Inventory> {
|
||||||
EndRecipeManager.addRecipe(TYPE, new AnvilSmithingRecipe(id, input, output, level, damage));
|
EndRecipeManager.addRecipe(TYPE, new AnvilSmithingRecipe(id, input, output, level, damage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<AnvilSmithingRecipe> {
|
public static class Serializer implements RecipeSerializer<AnvilSmithingRecipe> {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.recipe.RecipeType;
|
||||||
import net.minecraft.recipe.SmeltingRecipe;
|
import net.minecraft.recipe.SmeltingRecipe;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.config.Configs;
|
||||||
import ru.betterend.recipe.EndRecipeManager;
|
import ru.betterend.recipe.EndRecipeManager;
|
||||||
import ru.betterend.util.RecipeHelper;
|
import ru.betterend.util.RecipeHelper;
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ public class FurnaceRecipe {
|
||||||
|
|
||||||
private ItemConvertible input;
|
private ItemConvertible input;
|
||||||
private ItemConvertible output;
|
private ItemConvertible output;
|
||||||
private boolean exist = true;
|
private boolean exist;
|
||||||
private String group;
|
private String group;
|
||||||
private String name;
|
private String name;
|
||||||
private int count;
|
private int count;
|
||||||
|
@ -32,7 +33,7 @@ public class FurnaceRecipe {
|
||||||
INSTANCE.count = 1;
|
INSTANCE.count = 1;
|
||||||
INSTANCE.time = 200;
|
INSTANCE.time = 200;
|
||||||
INSTANCE.xp = 0;
|
INSTANCE.xp = 0;
|
||||||
INSTANCE.exist = RecipeHelper.exists(output) && RecipeHelper.exists(input);
|
INSTANCE.exist = Configs.RECIPE_CONFIG.getBoolean("furnace", name, true) && RecipeHelper.exists(output) && RecipeHelper.exists(input);
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.tag.Tag;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.config.Configs;
|
||||||
import ru.betterend.recipe.EndRecipeManager;
|
import ru.betterend.recipe.EndRecipeManager;
|
||||||
import ru.betterend.util.RecipeHelper;
|
import ru.betterend.util.RecipeHelper;
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ public class GridRecipe {
|
||||||
INSTANCE.materialKeys.clear();
|
INSTANCE.materialKeys.clear();
|
||||||
INSTANCE.count = 1;
|
INSTANCE.count = 1;
|
||||||
|
|
||||||
INSTANCE.exist = RecipeHelper.exists(output);
|
INSTANCE.exist = Configs.RECIPE_CONFIG.getBoolean("grid", name, true) && RecipeHelper.exists(output);
|
||||||
|
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.config.Configs;
|
||||||
import ru.betterend.recipe.EndRecipeManager;
|
import ru.betterend.recipe.EndRecipeManager;
|
||||||
import ru.betterend.rituals.InfusionRitual;
|
import ru.betterend.rituals.InfusionRitual;
|
||||||
import ru.betterend.util.ItemUtil;
|
import ru.betterend.util.ItemUtil;
|
||||||
|
@ -110,6 +111,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual> {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final static Builder INSTANCE = new Builder();
|
private final static Builder INSTANCE = new Builder();
|
||||||
|
private static boolean exist;
|
||||||
|
|
||||||
public static Builder create(String id) {
|
public static Builder create(String id) {
|
||||||
return create(BetterEnd.makeID(id));
|
return create(BetterEnd.makeID(id));
|
||||||
|
@ -120,6 +122,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual> {
|
||||||
INSTANCE.input = null;
|
INSTANCE.input = null;
|
||||||
INSTANCE.output = null;
|
INSTANCE.output = null;
|
||||||
INSTANCE.time = 1;
|
INSTANCE.time = 1;
|
||||||
|
exist = Configs.RECIPE_CONFIG.getBoolean("infusion", id.getPath(), true);
|
||||||
|
|
||||||
Arrays.fill(INSTANCE.catalysts, Ingredient.EMPTY);
|
Arrays.fill(INSTANCE.catalysts, Ingredient.EMPTY);
|
||||||
|
|
||||||
|
@ -171,6 +174,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build() {
|
public void build() {
|
||||||
|
if (exist) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
BetterEnd.LOGGER.warning("Input for Infusion recipe can't be 'null', recipe {} will be ignored!", id);
|
BetterEnd.LOGGER.warning("Input for Infusion recipe can't be 'null', recipe {} will be ignored!", id);
|
||||||
return;
|
return;
|
||||||
|
@ -194,6 +198,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual> {
|
||||||
EndRecipeManager.addRecipe(TYPE, recipe);
|
EndRecipeManager.addRecipe(TYPE, recipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<InfusionRecipe> {
|
public static class Serializer implements RecipeSerializer<InfusionRecipe> {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue