Skip to content

Commit

Permalink
Merge branch 'feature/config-overhaul'
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Mar 25, 2020
2 parents 3797d53 + 57f1b80 commit 1595239
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
import com.github.klikli_dev.occultism.config.value.CachedFloat;
import com.github.klikli_dev.occultism.config.value.CachedInt;
import com.github.klikli_dev.occultism.config.value.CachedObject;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.ForgeConfigSpec;

Expand All @@ -46,6 +41,7 @@ public class OccultismConfig extends ConfigBase {
public final StorageSettings storage;
public final WorldGenSettings worldGen;
public final RitualSettings rituals;
public final DimensionalMineshaftSettings dimensionalMineshaft;
public final ForgeConfigSpec spec;
//endregion Fields

Expand All @@ -55,10 +51,62 @@ public OccultismConfig() {
this.storage = new StorageSettings(this, builder);
this.worldGen = new WorldGenSettings(this, builder);
this.rituals = new RitualSettings(this, builder);
this.dimensionalMineshaft = new DimensionalMineshaftSettings(this, builder);
this.spec = builder.build();
}
//endregion Initialization

public class DimensionalMineshaftSettings extends ConfigCategoryBase {
//region Fields
public final MinerSpiritSettings minerFoliotUnspecialized;
public final MinerSpiritSettings minerDjinniOres;
//endregion Fields

//region Initialization
public DimensionalMineshaftSettings(IConfigCache parent, ForgeConfigSpec.Builder builder) {
super(parent, builder);
builder.comment("Dimensional Mineshaft Settings").push("dimensional_mineshaft");

this.minerFoliotUnspecialized =
new MinerSpiritSettings("miner_foliot_unspecialized", parent, builder, 400, 1, 1000);

this.minerDjinniOres =
new MinerSpiritSettings("miner_djinni_ores", parent, builder, 400, 1, 100);

builder.pop();
}

//endregion Initialization
public class MinerSpiritSettings extends ConfigCategoryBase {
//region Fields
public final CachedInt maxMiningTime;
public final CachedInt rollsPerOperation;
public final CachedInt durability;
//endregion Fields

//region Initialization
public MinerSpiritSettings(String oreName, IConfigCache parent, ForgeConfigSpec.Builder builder,
int maxMiningTime, int rollsPerOperation, int durability) {
super(parent, builder);
builder.comment("Miner Spirit Settings").push(oreName);

this.maxMiningTime = CachedInt.cache(this,
builder.comment("The amount of time it takes the spirit to perform one mining operation.")
.define("maxMiningTime", maxMiningTime));
this.rollsPerOperation = CachedInt.cache(this,
builder.comment("The amount of blocks the spirit will obtain per mining operation")
.define("rollsPerOperation", rollsPerOperation));
this.durability = CachedInt.cache(this,
builder.comment("The amount of mining operations the spirit can perform before breaking.")
.define("durability", durability));

builder.pop();
}
//endregion Initialization
}

}

public class RitualSettings extends ConfigCategoryBase {
//region Fields
public final CachedBoolean enableClearWeatherRitual;
Expand Down Expand Up @@ -153,18 +201,19 @@ public OreGenSettings(IConfigCache parent, ForgeConfigSpec.Builder builder) {
List<String> nether = Stream.of("the_nether").collect(Collectors.toList());

this.otherstoneNatural =
new OreSettings("otherstone_natural", overworld, OreFeatureConfig.FillerBlockType.NATURAL_STONE,7,
new OreSettings("otherstoneNatural", overworld, OreFeatureConfig.FillerBlockType.NATURAL_STONE,
7,
5, 10, 80, this, builder);

this.copperOre =
new OreSettings("copper_ore", overworld, OreFeatureConfig.FillerBlockType.NATURAL_STONE,9,
new OreSettings("copperOre", overworld, OreFeatureConfig.FillerBlockType.NATURAL_STONE, 9,
20, 20, 64, this, builder);
this.silverOre =
new OreSettings("silver_ore", overworld, OreFeatureConfig.FillerBlockType.NATURAL_STONE,7,
new OreSettings("silverOre", overworld, OreFeatureConfig.FillerBlockType.NATURAL_STONE, 7,
5, 0, 30, this, builder);

this.iesniumOre =
new OreSettings("iesnium_ore", nether, OreFeatureConfig.FillerBlockType.NETHERRACK,3,
new OreSettings("iesniumOre", nether, OreFeatureConfig.FillerBlockType.NETHERRACK, 3,
10, 10, 128, this, builder);
builder.pop();
}
Expand All @@ -183,7 +232,9 @@ public class OreSettings extends ConfigCategoryBase {
//endregion Fields

//region Initialization
public OreSettings(String oreName, List<String> dimensionTypes, OreFeatureConfig.FillerBlockType fillerBlockType, int size, int chance, int min, int max,
public OreSettings(String oreName, List<String> dimensionTypes,
OreFeatureConfig.FillerBlockType fillerBlockType, int size, int chance, int min,
int max,
IConfigCache parent, ForgeConfigSpec.Builder builder) {
super(parent, builder);
builder.comment("Ore Settings").push(oreName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,24 @@ public class OccultismItems {
() -> new DebugWandItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<Item> DEBUG_FOLIOT_LUMBERJACK = ITEMS.register("debug_foliot_lumberjack",
() -> new SummonFoliotLumberjackItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<Item> DEBUG_FOLIOT_TRANSPORT_ITEMS = ITEMS.register("debug_foliot_transport_items",
() -> new SummonFoliotTransportItemsItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<Item> DEBUG_FOLIOT_TRANSPORT_ITEMS =
ITEMS.register("debug_foliot_transport_items",
() -> new SummonFoliotTransportItemsItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<Item> DEBUG_FOLIOT_TRADER_ITEM = ITEMS.register("debug_foliot_trader",
() -> new SummonFoliotTraderItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<Item> DEBUG_DJINNI_MANAGE_MACHINE = ITEMS.register("debug_djinni_manage_machine",
() -> new SummonDjinniManageMachineItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<Item> DEBUG_DJINNI_TEST = ITEMS.register("debug_djinni_test",
() -> new SummonDjinniTest(defaultProperties().maxStackSize(1)));

public static final RegistryObject<BlockItem> SPIRIT_FIRE = ITEMS.register("spirit_fire", () -> new BlockItem(OccultismBlocks.SPIRIT_FIRE.get(), defaultProperties()));
public static final RegistryObject<BlockItem> SPIRIT_FIRE =
ITEMS.register("spirit_fire", () -> new BlockItem(OccultismBlocks.SPIRIT_FIRE.get(), defaultProperties()));

//Resources
public static final RegistryObject<OtherworldBlockItem> OTHERWORLD_SAPLING_NATURAL = ITEMS.register("otherworld_sapling_natural",
() -> new OtherworldBlockItem(OccultismBlocks.OTHERWORLD_SAPLING_NATURAL.get(), defaultProperties()));
public static final RegistryObject<OtherworldBlockItem> OTHERWORLD_SAPLING_NATURAL =
ITEMS.register("otherworld_sapling_natural",
() -> new OtherworldBlockItem(OccultismBlocks.OTHERWORLD_SAPLING_NATURAL.get(),
defaultProperties()));
public static final RegistryObject<Item> TALLOW = ITEMS.register("tallow",
() -> new Item(defaultProperties()));
public static final RegistryObject<Item> AFRIT_ESSENCE = ITEMS.register("afrit_essence",
Expand Down Expand Up @@ -185,26 +189,26 @@ public class OccultismItems {
"book_of_binding_afrit", () -> new BookOfBindingItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<BookOfBindingBoundItem> BOOK_OF_BINDING_BOUND_AFRIT = ITEMS.register(
"book_of_binding_bound_afrit", () -> new BookOfBindingBoundItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<BookOfBindingItem> BOOK_OF_BINDING_MARID= ITEMS.register(
public static final RegistryObject<BookOfBindingItem> BOOK_OF_BINDING_MARID = ITEMS.register(
"book_of_binding_marid", () -> new BookOfBindingItem(defaultProperties().maxStackSize(1)));
public static final RegistryObject<BookOfBindingBoundItem> BOOK_OF_BINDING_BOUND_MARID = ITEMS.register(
"book_of_binding_bound_marid", () -> new BookOfBindingBoundItem(defaultProperties().maxStackSize(1)));
//Books of Calling
//Foliot
public static final RegistryObject<BookOfCallingLumberjackItem> BOOK_OF_CALLING_FOLIOT_LUMBERJACK =
ITEMS.register("book_of_calling_foliot_lumberjack",
() -> new BookOfCallingLumberjackItem(defaultProperties().maxStackSize(1),
TranslationKeys.BOOK_OF_CALLING_GENERIC + "_foliot"));
() -> new BookOfCallingLumberjackItem(defaultProperties().maxStackSize(1),
TranslationKeys.BOOK_OF_CALLING_GENERIC + "_foliot"));
public static final RegistryObject<BookOfCallingTransportItems> BOOK_OF_CALLING_FOLIOT_TRANSPORT_ITEMS =
ITEMS.register("book_of_calling_foliot_transport_items",
() -> new BookOfCallingTransportItems(defaultProperties().maxStackSize(1),
TranslationKeys.BOOK_OF_CALLING_GENERIC + "_foliot"));
() -> new BookOfCallingTransportItems(defaultProperties().maxStackSize(1),
TranslationKeys.BOOK_OF_CALLING_GENERIC + "_foliot"));

//Djinn
public static final RegistryObject<BookOfCallingManageMachineItem> BOOK_OF_CALLING_DJINNI_MANAGE_MACHINE =
ITEMS.register("book_of_calling_djinni_manage_machine",
() -> new BookOfCallingManageMachineItem(defaultProperties().maxStackSize(1),
TranslationKeys.BOOK_OF_CALLING_GENERIC + "_djinni"));
() -> new BookOfCallingManageMachineItem(defaultProperties().maxStackSize(1),
TranslationKeys.BOOK_OF_CALLING_GENERIC + "_djinni"));

//Armor
public static final RegistryObject<OtherworldGogglesItem> OTHERWORLD_GOGGLES = ITEMS.register("otherworld_goggles",
Expand All @@ -224,12 +228,22 @@ public class OccultismItems {
() -> new Item(defaultProperties().food(OccultismFoods.DATURA.get())));

//Miner Spirits
public static final RegistryObject<MinerSpiritItem> MINER_DEBUG_UNSPECIALIZED = ITEMS.register("miner_debug_unspecialized",
() -> new MinerSpiritItem(defaultProperties().maxDamage(10000), 100, 10));
public static final RegistryObject<MinerSpiritItem> MINER_FOLIOT_UNSPECIALIZED = ITEMS.register("miner_foliot_unspecialized",
() -> new MinerSpiritItem(defaultProperties().maxDamage(1000), 400, 1));
public static final RegistryObject<MinerSpiritItem> MINER_DEBUG_UNSPECIALIZED =
ITEMS.register("miner_debug_unspecialized",
() -> new MinerSpiritItem(defaultProperties().maxDamage(10000), 100, 10));
public static final RegistryObject<MinerSpiritItem> MINER_FOLIOT_UNSPECIALIZED =
ITEMS.register("miner_foliot_unspecialized",
() -> new MinerSpiritItem(defaultProperties()
.maxDamage(
Occultism.CONFIG.dimensionalMineshaft.minerFoliotUnspecialized.durability
.get()),
Occultism.CONFIG.dimensionalMineshaft.minerFoliotUnspecialized.maxMiningTime.get(),
Occultism.CONFIG.dimensionalMineshaft.minerFoliotUnspecialized.rollsPerOperation.get()));
public static final RegistryObject<MinerSpiritItem> MINER_DJINNI_ORES = ITEMS.register("miner_djinni_ores",
() -> new MinerSpiritItem(defaultProperties().maxDamage(100), 400, 1));
() -> new MinerSpiritItem(defaultProperties().maxDamage(
Occultism.CONFIG.dimensionalMineshaft.minerDjinniOres.durability.get())
, Occultism.CONFIG.dimensionalMineshaft.minerDjinniOres.maxMiningTime.get(),
Occultism.CONFIG.dimensionalMineshaft.minerDjinniOres.rollsPerOperation.get()));
//endregion Fields

//region Static Methods
Expand Down

0 comments on commit 1595239

Please sign in to comment.