Skip to content

Commit

Permalink
added config for cooldown
Browse files Browse the repository at this point in the history
  • Loading branch information
MelanX committed Sep 18, 2020
1 parent 0e8f50a commit ee5e266
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 15 deletions.
40 changes: 40 additions & 0 deletions src/main/java/de/melanx/ultimatools/ServerConfig.java
Expand Up @@ -20,9 +20,27 @@ public class ServerConfig {

public static ForgeConfigSpec.ConfigValue<List<? extends String>> OVERWORLD_ORES;
public static ForgeConfigSpec.ConfigValue<List<? extends String>> NETHER_ORES;

public static ForgeConfigSpec.ConfigValue<List<? extends String>> ANIMALS;
public static ForgeConfigSpec.ConfigValue<List<? extends String>> WATER_ANIMALS;

public static ForgeConfigSpec.IntValue BEGINNER;
public static ForgeConfigSpec.IntValue BLOOD_MAGICIAN;
public static ForgeConfigSpec.IntValue CURSED_KNIGHT;
public static ForgeConfigSpec.IntValue FARMER;
public static ForgeConfigSpec.IntValue ORE_BETTER;
public static ForgeConfigSpec.IntValue SCHOLAR;
public static ForgeConfigSpec.IntValue SOOTHSAYER;
public static ForgeConfigSpec.IntValue ULTIMA_FIGHTER;
public static ForgeConfigSpec.IntValue ULTIMA_GOD;

public static ForgeConfigSpec.IntValue KRYPTO_BEGINNER;
public static ForgeConfigSpec.IntValue KRYPTO_BLOOD_MAGICIAN;
public static ForgeConfigSpec.IntValue KRYPTO_CURSED_KNIGHT;
public static ForgeConfigSpec.IntValue KRYPTO_FARMER;
public static ForgeConfigSpec.IntValue KRYPTO_SCHOLAR;
public static ForgeConfigSpec.IntValue KRYPTO_SOOTHSAYER;

public static void init(ForgeConfigSpec.Builder builder) {
builder.push("ores");
OVERWORLD_ORES = builder.comment("All the ores for upgrading normal ores, order matters")
Expand Down Expand Up @@ -75,6 +93,28 @@ public static void init(ForgeConfigSpec.Builder builder) {
"minecraft:tropical_fish"
), (obj) -> obj instanceof String);
builder.pop();

builder.comment("Cooldowns for the crystals").push("cooldowns");
builder.push("normal");
BEGINNER = builder.defineInRange("beginner", 200, 0, Integer.MAX_VALUE);
BLOOD_MAGICIAN = builder.defineInRange("blood_magician", 1200, 0, Integer.MAX_VALUE);
CURSED_KNIGHT = builder.defineInRange("cursed_knight", 1200, 0, Integer.MAX_VALUE);
FARMER = builder.defineInRange("farmer", 1200, 0, Integer.MAX_VALUE);
ORE_BETTER = builder.defineInRange("ore_better", 200, 0, Integer.MAX_VALUE);
SCHOLAR = builder.defineInRange("scholar", 200, 0, Integer.MAX_VALUE);
SOOTHSAYER = builder.defineInRange("soothsayer", 200, 0, Integer.MAX_VALUE);
ULTIMA_FIGHTER = builder.defineInRange("ultima_fighter", 200, 0, Integer.MAX_VALUE);
ULTIMA_GOD = builder.defineInRange("ultima_god", 200, 0, Integer.MAX_VALUE);
builder.pop();

builder.push("krypto");
KRYPTO_BEGINNER = builder.defineInRange("krypto_beginner", 200, 0, Integer.MAX_VALUE);
KRYPTO_BLOOD_MAGICIAN = builder.defineInRange("krypto_blood_magician", 200, 0, Integer.MAX_VALUE);
KRYPTO_CURSED_KNIGHT = builder.defineInRange("krypto_cursed_knight", 200, 0, Integer.MAX_VALUE);
KRYPTO_FARMER = builder.defineInRange("krypto_farmer", 200, 0, Integer.MAX_VALUE);
KRYPTO_SCHOLAR = builder.defineInRange("krypto_scholar", 200, 0, Integer.MAX_VALUE);
KRYPTO_SOOTHSAYER = builder.defineInRange("krypto_soothsayer", 200, 0, Integer.MAX_VALUE);
builder.pop(2);
}

public static void loadConfig(ForgeConfigSpec spec, Path path) {
Expand Down
31 changes: 16 additions & 15 deletions src/main/java/de/melanx/ultimatools/item/Registration.java
@@ -1,6 +1,7 @@
package de.melanx.ultimatools.item;

import com.google.common.collect.ImmutableSet;
import de.melanx.ultimatools.ServerConfig;
import de.melanx.ultimatools.SkyblockUltimaTools;
import de.melanx.ultimatools.util.ToolEffects;
import net.minecraft.block.Block;
Expand All @@ -18,25 +19,25 @@ public class Registration {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SkyblockUltimaTools.MODID);
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, SkyblockUltimaTools.MODID);

public static final RegistryObject<Item> beginner = ITEMS.register("beginner", () -> new UltimaTool(ToolEffects::placeWater));
public static final RegistryObject<Item> bloodMagician = ITEMS.register("blood_magician", () -> new UltimaTool(600, ToolEffects::spawnAnimal));
public static final RegistryObject<Item> cursedKnight = ITEMS.register("cursed_knight", () -> new UltimaTool(600, ToolEffects::applyMagicDamage));
public static final RegistryObject<Item> farmer = ITEMS.register("farmer", () -> new UltimaTool(600, ToolEffects::useBonemeal));
public static final RegistryObject<Item> beginner = ITEMS.register("beginner", () -> new UltimaTool(ServerConfig.BEGINNER.get(), ToolEffects::placeWater));
public static final RegistryObject<Item> bloodMagician = ITEMS.register("blood_magician", () -> new UltimaTool(ServerConfig.BLOOD_MAGICIAN.get(), ToolEffects::spawnAnimal));
public static final RegistryObject<Item> cursedKnight = ITEMS.register("cursed_knight", () -> new UltimaTool(ServerConfig.CURSED_KNIGHT.get(), ToolEffects::applyMagicDamage));
public static final RegistryObject<Item> farmer = ITEMS.register("farmer", () -> new UltimaTool(ServerConfig.FARMER.get(), ToolEffects::useBonemeal));
public static final RegistryObject<Item> forestRunner = ITEMS.register("forest_runner", UltimaCrafting::new);
public static final RegistryObject<Item> knight = ITEMS.register("knight", UltimaCrafting::new);
public static final RegistryObject<Item> lighter = ITEMS.register("lighter", UltimaCrafting::new);
public static final RegistryObject<Item> oreBetter = ITEMS.register("ore_better", () -> new UltimaTool(ToolEffects::upgradeOre));
public static final RegistryObject<Item> scholar = ITEMS.register("scholar", () -> new UltimaTool(ToolEffects.changeBlock(ImmutableSet.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.FARMLAND), Blocks.GRASS_BLOCK)));
public static final RegistryObject<Item> soothsayer = ITEMS.register("soothsayer", () -> new UltimaTool(ToolEffects::applyPotion));
public static final RegistryObject<Item> ultimaFighter = ITEMS.register("ultima_fighter", () -> new UltimaTool(ToolEffects::generateOre));
public static final RegistryObject<Item> ultimaGod = ITEMS.register("ultima_god", () -> new UltimaTool(ToolEffects::ultimate));
public static final RegistryObject<Item> oreBetter = ITEMS.register("ore_better", () -> new UltimaTool(ServerConfig.ORE_BETTER.get(), ToolEffects::upgradeOre));
public static final RegistryObject<Item> scholar = ITEMS.register("scholar", () -> new UltimaTool(ServerConfig.SCHOLAR.get(), ToolEffects.changeBlock(ImmutableSet.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.FARMLAND), Blocks.GRASS_BLOCK)));
public static final RegistryObject<Item> soothsayer = ITEMS.register("soothsayer", () -> new UltimaTool(ServerConfig.SOOTHSAYER.get(), ToolEffects::applyPotion));
public static final RegistryObject<Item> ultimaFighter = ITEMS.register("ultima_fighter", () -> new UltimaTool(ServerConfig.ULTIMA_FIGHTER.get(), ToolEffects::generateOre));
public static final RegistryObject<Item> ultimaGod = ITEMS.register("ultima_god", () -> new UltimaTool(ServerConfig.ULTIMA_GOD.get(), ToolEffects::ultimate));

public static final RegistryObject<Item> kryptoBeginner = ITEMS.register("krypto_beginner", () -> new UltimaTool(ToolEffects::removeFluid));
public static final RegistryObject<Item> kryptoBloodMagician = ITEMS.register("krypto_blood_magician", () -> new UltimaTool(ToolEffects::applyRegeneration));
public static final RegistryObject<Item> kryptoCursedKnight = ITEMS.register("krypto_cursed_knight", () -> new UltimaTool(ToolEffects::applyLevitation));
public static final RegistryObject<Item> kryptoFarmer = ITEMS.register("krypto_farmer", () -> new UltimaTool(ToolEffects.changeBlock(ImmutableSet.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.GRASS_BLOCK), Blocks.FARMLAND.getDefaultState().with(BlockStateProperties.MOISTURE_0_7, 7))));
public static final RegistryObject<Item> kryptoScholar = ITEMS.register("krypto_scholar", () -> new UltimaTool(ToolEffects.changeBlock(ImmutableSet.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.GRASS_BLOCK), Blocks.STONE)));
public static final RegistryObject<Item> kryptoSoothsayer = ITEMS.register("krypto_soothsayer", () -> new UltimaTool(ToolEffects.changeBlock(ImmutableSet.of(Blocks.STONE, Blocks.COBBLESTONE), Blocks.COAL_ORE)));
public static final RegistryObject<Item> kryptoBeginner = ITEMS.register("krypto_beginner", () -> new UltimaTool(ServerConfig.KRYPTO_BEGINNER.get(), ToolEffects::removeFluid));
public static final RegistryObject<Item> kryptoBloodMagician = ITEMS.register("krypto_blood_magician", () -> new UltimaTool(ServerConfig.KRYPTO_BLOOD_MAGICIAN.get(), ToolEffects::applyRegeneration));
public static final RegistryObject<Item> kryptoCursedKnight = ITEMS.register("krypto_cursed_knight", () -> new UltimaTool(ServerConfig.KRYPTO_CURSED_KNIGHT.get(), ToolEffects::applyLevitation));
public static final RegistryObject<Item> kryptoFarmer = ITEMS.register("krypto_farmer", () -> new UltimaTool(ServerConfig.KRYPTO_FARMER.get(), ToolEffects.changeBlock(ImmutableSet.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.GRASS_BLOCK), Blocks.FARMLAND.getDefaultState().with(BlockStateProperties.MOISTURE_0_7, 7))));
public static final RegistryObject<Item> kryptoScholar = ITEMS.register("krypto_scholar", () -> new UltimaTool(ServerConfig.KRYPTO_SCHOLAR.get(), ToolEffects.changeBlock(ImmutableSet.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.GRASS_BLOCK), Blocks.STONE)));
public static final RegistryObject<Item> kryptoSoothsayer = ITEMS.register("krypto_soothsayer", () -> new UltimaTool(ServerConfig.KRYPTO_SOOTHSAYER.get(), ToolEffects.changeBlock(ImmutableSet.of(Blocks.STONE, Blocks.COBBLESTONE), Blocks.COAL_ORE)));
public static final RegistryObject<Item> kryptoForestRunner = ITEMS.register("krypto_forest_runner", UltimaCrafting::new);
public static final RegistryObject<Item> kryptoKnight = ITEMS.register("krypto_knight", UltimaCrafting::new);
public static final RegistryObject<Item> kryptoLighter = ITEMS.register("krypto_lighter", UltimaCrafting::new);
Expand Down

0 comments on commit ee5e266

Please sign in to comment.