mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 16:54:06 +00:00
Add a proper config for potion IDs.
This commit is contained in:
1 parent
684f23c354
commit
17d0fe0c38
7 files changed
+32
-15
No files matched your search
@@ -15,13 +15,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityFishHook;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class PotionAllure extends PotionMod {
|
||||
|
||||
public PotionAllure() {
|
||||
super(LibPotionNames.ALLURE, false, 0x0034E4, 5);
|
||||
super(ConfigHandler.potionIDAllure, LibPotionNames.ALLURE, false, 0x0034E4, 5);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import vazkii.botania.common.brew.ModPotions;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -27,7 +28,7 @@ public class PotionBloodthirst extends PotionMod {
|
||||
private static final int RANGE = 64;
|
||||
|
||||
public PotionBloodthirst() {
|
||||
super(LibPotionNames.BLOODTHIRST, false, 0xC30000, 3);
|
||||
super(ConfigHandler.potionIDBloodthirst, LibPotionNames.BLOODTHIRST, false, 0xC30000, 3);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -26,7 +27,7 @@ public class PotionEmptiness extends PotionMod {
|
||||
private static final int RANGE = 128;
|
||||
|
||||
public PotionEmptiness() {
|
||||
super(LibPotionNames.EMPTINESS, false, 0xE7E7E7, 2);
|
||||
super(ConfigHandler.potionIDEmptiness, LibPotionNames.EMPTINESS, false, 0xE7E7E7, 2);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,14 @@ package vazkii.botania.common.brew.potion;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class PotionFeatherfeet extends PotionMod {
|
||||
|
||||
public PotionFeatherfeet() {
|
||||
super(LibPotionNames.FEATHER_FEET, false, 0x26ADFF, 1);
|
||||
super(ConfigHandler.potionIDFeatherfeet, LibPotionNames.FEATHER_FEET, false, 0x26ADFF, 1);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,20 +22,12 @@ public class PotionMod extends Potion {
|
||||
|
||||
private static final ResourceLocation resource = new ResourceLocation(LibResources.GUI_POTIONS);
|
||||
|
||||
public PotionMod(String name, boolean badEffect, int color, int iconIndex) {
|
||||
super(findFreeID(), badEffect, color);
|
||||
public PotionMod(int id, String name, boolean badEffect, int color, int iconIndex) {
|
||||
super(id, badEffect, color);
|
||||
setPotionName("botania.potion." + name);
|
||||
setIconIndex(iconIndex % 8, iconIndex / 8);
|
||||
}
|
||||
|
||||
static int findFreeID() {
|
||||
for(int i = 0; i < potionTypes.length; i++)
|
||||
if(potionTypes[i] == null)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getStatusIconIndex() {
|
||||
|
||||
@@ -14,13 +14,14 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class PotionSoulCross extends PotionMod {
|
||||
|
||||
public PotionSoulCross() {
|
||||
super(LibPotionNames.SOUL_CROSS, false, 0x47453d, 0);
|
||||
super(ConfigHandler.potionIDSoulCross, LibPotionNames.SOUL_CROSS, false, 0x47453d, 0);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -22,6 +23,8 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
public final class ConfigHandler {
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
private static final String CATEGORY_POTIONS = "potions";
|
||||
|
||||
public static boolean useShaders = true;
|
||||
public static boolean lexiconRotatingItems = true;
|
||||
@@ -56,6 +59,12 @@ public final class ConfigHandler {
|
||||
|
||||
public static int flowerQuantity = 2;
|
||||
public static int flowerDensity = 16;
|
||||
|
||||
public static int potionIDSoulCross = 191;
|
||||
public static int potionIDFeatherfeet = 192;
|
||||
public static int potionIDEmptiness = 193;
|
||||
public static int potionIDBloodthirst = 194;
|
||||
public static int potionIDAllure = 195;
|
||||
|
||||
public static void loadConfig(File configFile) {
|
||||
config = new Configuration(configFile);
|
||||
@@ -156,6 +165,12 @@ public final class ConfigHandler {
|
||||
desc = "The density of each flower patch generataed, defaults to 16, the lower the number, the less each patch will have.";
|
||||
flowerDensity = loadPropInt("worldgen.flower.density", desc, flowerDensity);
|
||||
|
||||
potionIDSoulCross = loadPropPotionId(LibPotionNames.SOUL_CROSS, potionIDSoulCross);
|
||||
potionIDFeatherfeet = loadPropPotionId(LibPotionNames.FEATHER_FEET, potionIDFeatherfeet);
|
||||
potionIDEmptiness = loadPropPotionId(LibPotionNames.EMPTINESS, potionIDEmptiness);
|
||||
potionIDBloodthirst = loadPropPotionId(LibPotionNames.BLOODTHIRST, potionIDBloodthirst);
|
||||
potionIDAllure = loadPropPotionId(LibPotionNames.ALLURE, potionIDAllure);
|
||||
|
||||
if(config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
@@ -184,6 +199,11 @@ public final class ConfigHandler {
|
||||
prop.comment = desc;
|
||||
return prop.getBoolean(default_);
|
||||
}
|
||||
|
||||
public static int loadPropPotionId(String propName, int default_) {
|
||||
Property prop = config.get(CATEGORY_POTIONS, propName, default_);
|
||||
return prop.getInt(default_);
|
||||
}
|
||||
|
||||
public static class ChangeListener {
|
||||
|
||||
|
||||
Reference in new issue
Block a user