aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/config
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-28 19:03:53 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-28 19:03:53 -0800
commitf51616bda220887fdd45c4bc951ff59e3398213a (patch)
tree35fdbb15b4c7ea0282773a388eff517a1d09d941 /src/main/java/kubatech/config
parent11216d666cbc30fc1e1dfc84e1e0c2f4252b1fc2 (diff)
downloadGT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.tar.gz
GT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.tar.bz2
GT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/kubatech/config')
-rw-r--r--src/main/java/kubatech/config/Config.java93
-rw-r--r--src/main/java/kubatech/config/OverridesConfig.java84
2 files changed, 76 insertions, 101 deletions
diff --git a/src/main/java/kubatech/config/Config.java b/src/main/java/kubatech/config/Config.java
index 86acf47768..7b2520bccc 100644
--- a/src/main/java/kubatech/config/Config.java
+++ b/src/main/java/kubatech/config/Config.java
@@ -1,33 +1,28 @@
/*
- * KubaTech - Gregtech Addon
- * Copyright (C) 2022 - 2023 kuba6000
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
- *
+ * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in
+ * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have
+ * received a copy of the GNU Lesser General Public License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
*/
package kubatech.config;
import java.io.File;
+
import kubatech.Tags;
+
import net.minecraftforge.common.config.Configuration;
public class Config {
private enum Category {
+
MOB_HANDLER("MobHandler"),
DEBUG("Debug");
+
final String categoryName;
Category(String s) {
@@ -49,6 +44,7 @@ public class Config {
public static boolean mobHandlerEnabled = true;
public enum _CacheRegenerationTrigger {
+
Never,
ModAdditionRemoval,
ModAdditionRemovalChange,
@@ -59,62 +55,41 @@ public class Config {
}
}
- public static _CacheRegenerationTrigger regenerationTrigger =
- _CacheRegenerationTrigger.ModAdditionRemovalChange;
+ public static _CacheRegenerationTrigger regenerationTrigger = _CacheRegenerationTrigger.ModAdditionRemovalChange;
public static boolean includeEmptyMobs = true;
public static String[] mobBlacklist;
public static double playerOnlyDropsModifier = .1d;
private static void load(Configuration configuration) {
Category category = Category.MOB_HANDLER;
- mobHandlerEnabled = configuration
- .get(
- category.get(),
- "Enabled",
- true,
- "Enable \"Mob Drops\" NEI page and Extreme Extermination Chamber")
- .getBoolean();
+ mobHandlerEnabled = configuration.get(
+ category.get(),
+ "Enabled",
+ true,
+ "Enable \"Mob Drops\" NEI page and Extreme Extermination Chamber").getBoolean();
StringBuilder c = new StringBuilder("When will cache regeneration trigger? ");
for (_CacheRegenerationTrigger value : _CacheRegenerationTrigger.values())
c.append(value.ordinal()).append(" - ").append(value.name()).append(", ");
- regenerationTrigger = _CacheRegenerationTrigger.get(configuration
- .get(
+ regenerationTrigger = _CacheRegenerationTrigger.get(
+ configuration.get(
category.get(),
"CacheRegenerationTrigger",
_CacheRegenerationTrigger.ModAdditionRemovalChange.ordinal(),
- c.toString())
- .getInt());
+ c.toString()).getInt());
includeEmptyMobs = configuration
.get(category.get(), "IncludeEmptyMobs", true, "Include mobs that have no drops in NEI")
.getBoolean();
- mobBlacklist = configuration
- .get(
- category.get(),
- "MobBlacklist",
- new String[] {
- "Giant",
- "Thaumcraft.TravelingTrunk",
- "chisel.snowman",
- "OpenBlocks.Luggage",
- "OpenBlocks.MiniMe",
- "SpecialMobs.SpecialCreeper",
- "SpecialMobs.SpecialZombie",
- "SpecialMobs.SpecialPigZombie",
- "SpecialMobs.SpecialSlime",
- "SpecialMobs.SpecialSkeleton",
- "SpecialMobs.SpecialEnderman",
- "SpecialMobs.SpecialCaveSpider",
- "SpecialMobs.SpecialGhast",
- "SpecialMobs.SpecialWitch",
- "SpecialMobs.SpecialSpider",
- "TwilightForest.HydraHead",
- "TwilightForest.RovingCube",
- "TwilightForest.Harbinger Cube",
- "TwilightForest.Adherent",
- "SpecialMobs.SpecialSilverfish",
- },
- "These mobs will be skipped when generating recipe map")
- .getStringList();
+ mobBlacklist = configuration.get(
+ category.get(),
+ "MobBlacklist",
+ new String[] { "Giant", "Thaumcraft.TravelingTrunk", "chisel.snowman", "OpenBlocks.Luggage",
+ "OpenBlocks.MiniMe", "SpecialMobs.SpecialCreeper", "SpecialMobs.SpecialZombie",
+ "SpecialMobs.SpecialPigZombie", "SpecialMobs.SpecialSlime", "SpecialMobs.SpecialSkeleton",
+ "SpecialMobs.SpecialEnderman", "SpecialMobs.SpecialCaveSpider", "SpecialMobs.SpecialGhast",
+ "SpecialMobs.SpecialWitch", "SpecialMobs.SpecialSpider", "TwilightForest.HydraHead",
+ "TwilightForest.RovingCube", "TwilightForest.Harbinger Cube", "TwilightForest.Adherent",
+ "SpecialMobs.SpecialSilverfish", },
+ "These mobs will be skipped when generating recipe map").getStringList();
playerOnlyDropsModifier = configuration
.get(
category.get(),
@@ -126,12 +101,12 @@ public class Config {
}
public static class Debug {
+
public static boolean showRenderErrors = false;
private static void load(Configuration configuration) {
Category category = Category.DEBUG;
- showRenderErrors =
- configuration.get(category.get(), "ShowRenderErrors", false).getBoolean();
+ showRenderErrors = configuration.get(category.get(), "ShowRenderErrors", false).getBoolean();
}
}
diff --git a/src/main/java/kubatech/config/OverridesConfig.java b/src/main/java/kubatech/config/OverridesConfig.java
index d58d3a27ed..365638727d 100644
--- a/src/main/java/kubatech/config/OverridesConfig.java
+++ b/src/main/java/kubatech/config/OverridesConfig.java
@@ -1,32 +1,15 @@
/*
- * KubaTech - Gregtech Addon
- * Copyright (C) 2022 - 2023 kuba6000
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
- *
+ * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in
+ * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have
+ * received a copy of the GNU Lesser General Public License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
*/
package kubatech.config;
-import com.dreammaster.main.MainRegistry;
-import com.dreammaster.modcustomdrops.CustomDrops;
-import com.google.common.io.Files;
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import cpw.mods.fml.common.registry.GameRegistry;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
import java.io.File;
import java.io.Reader;
import java.io.Writer;
@@ -35,26 +18,40 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import kubatech.Tags;
import kubatech.api.ConstructableItemStack;
import kubatech.api.LoaderReference;
import kubatech.api.helpers.ReflectionHelper;
import kubatech.api.mobhandler.MobDrop;
import kubatech.api.utils.GSONUtils;
+
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTTagCompound;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import com.dreammaster.main.MainRegistry;
+import com.dreammaster.modcustomdrops.CustomDrops;
+import com.google.common.io.Files;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+
public class OverridesConfig {
private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[Config-Overrides]");
public static class MobDropSimplified {
+
@GSONUtils.SkipGSON
ItemStack stack;
@@ -97,6 +94,7 @@ public class OverridesConfig {
}
public static class MobOverride {
+
public boolean removeAll = false;
public List<MobDrop> additions = new ArrayList<>();
public List<MobDropSimplified> removals = new ArrayList<>();
@@ -144,12 +142,12 @@ public class OverridesConfig {
overrides.values().forEach(o -> o.additions.forEach(MobDrop::reconstructStack));
if (LoaderReference.GTNHCoreMod) {
LOG.info("Detected GTNH Core Mod, parsing custom drops from there.");
- CustomDrops coredrops =
- ReflectionHelper.getField(MainRegistry.Module_CustomDrops, "_mCustomDrops", null);
+ CustomDrops coredrops = ReflectionHelper
+ .getField(MainRegistry.Module_CustomDrops, "_mCustomDrops", null);
if (coredrops != null) {
@SuppressWarnings("unchecked")
- ArrayList<CustomDrops.CustomDrop> customdrops = (ArrayList<CustomDrops.CustomDrop>)
- ((ArrayList<CustomDrops.CustomDrop>) coredrops.getCustomDrops()).clone();
+ ArrayList<CustomDrops.CustomDrop> customdrops = (ArrayList<CustomDrops.CustomDrop>) ((ArrayList<CustomDrops.CustomDrop>) coredrops
+ .getCustomDrops()).clone();
for (CustomDrops.CustomDrop customdrop : customdrops) {
try {
Class<?> eclass = Class.forName(customdrop.getEntityName());
@@ -166,8 +164,7 @@ public class OverridesConfig {
if (pNBT != null && !pNBT.isEmpty()) {
try {
stack.stackTagCompound = (NBTTagCompound) JsonToNBT.func_150315_a(pNBT);
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
}
int chance = drop.getChance() * 100;
int amount = drop.getAmount();
@@ -196,11 +193,9 @@ public class OverridesConfig {
} catch (Exception ex) {
ex.printStackTrace();
} finally {
- if (reader != null)
- try {
- reader.close();
- } catch (Exception ignored) {
- }
+ if (reader != null) try {
+ reader.close();
+ } catch (Exception ignored) {}
}
}
@@ -217,19 +212,24 @@ public class OverridesConfig {
exdamages.put(1, 1);
exdamages.put(2, 5);
exdamages.put(3, 10);
- ex1.additions.add(new MobDrop(
- new ItemStack(Items.diamond_sword), MobDrop.DropType.Rare, 500, 20, exdamages, true, false));
+ ex1.additions.add(
+ new MobDrop(
+ new ItemStack(Items.diamond_sword),
+ MobDrop.DropType.Rare,
+ 500,
+ 20,
+ exdamages,
+ true,
+ false));
example.put("ExampleMob", ex1);
gson.toJson(example, writer);
writer.flush();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
- if (writer != null)
- try {
- writer.close();
- } catch (Exception ignored) {
- }
+ if (writer != null) try {
+ writer.close();
+ } catch (Exception ignored) {}
}
}
}