Some rework on configs (where they are stored/etc)
This commit is contained in:
parent
d95ab7473a
commit
8b059dfd0c
8 changed files with 179 additions and 92 deletions
|
@ -25,8 +25,12 @@ import static net.minecraftforge.common.Configuration.*;
|
||||||
*/
|
*/
|
||||||
public class ConfigurationHandler {
|
public class ConfigurationHandler {
|
||||||
|
|
||||||
private static final String CATEGORY_KEYBIND = "keybinds";
|
private static final String CATEGORY_KEYBIND = "keybindings";
|
||||||
private static final String CATEGORY_GRAPHICS = "graphics";
|
private static final String CATEGORY_GRAPHICS = "graphics";
|
||||||
|
private static final String CATEGORY_TRANSMUTATION = "transmutation";
|
||||||
|
private static final String CATEGORY_BLOCK_PROPERTIES = Configuration.CATEGORY_BLOCK + Configuration.CATEGORY_SPLITTER + "properties";
|
||||||
|
private static final String CATEGORY_RED_WATER_PROPERTIES = CATEGORY_BLOCK_PROPERTIES + Configuration.CATEGORY_SPLITTER + "red_water";
|
||||||
|
private static final String CATEGORY_DURABILITY = Configuration.CATEGORY_ITEM + Configuration.CATEGORY_SPLITTER + "durability";
|
||||||
|
|
||||||
public static void init(File configFile) {
|
public static void init(File configFile) {
|
||||||
Configuration configuration = new Configuration(configFile);
|
Configuration configuration = new Configuration(configFile);
|
||||||
|
@ -34,21 +38,15 @@ public class ConfigurationHandler {
|
||||||
try {
|
try {
|
||||||
configuration.load();
|
configuration.load();
|
||||||
|
|
||||||
/* General Configs */
|
/* General configs */
|
||||||
ConfigurationSettings.ENABLE_VERSION_CHECK = configuration
|
ConfigurationSettings.ENABLE_VERSION_CHECK = configuration
|
||||||
.get(CATEGORY_GENERAL, ConfigurationSettings.ENABLE_VERSION_CHECK_CONFIGNAME, ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT)
|
.get(CATEGORY_GENERAL, ConfigurationSettings.ENABLE_VERSION_CHECK_CONFIGNAME, ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT)
|
||||||
.getBoolean(ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT);
|
.getBoolean(ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT);
|
||||||
ConfigurationSettings.ENABLE_SOUNDS = configuration
|
ConfigurationSettings.ENABLE_SOUNDS = configuration
|
||||||
.get(CATEGORY_GENERAL, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT)
|
.get(CATEGORY_GENERAL, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT)
|
||||||
.getBoolean(ConfigurationSettings.ENABLE_SOUNDS_DEFAULT);
|
.getBoolean(ConfigurationSettings.ENABLE_SOUNDS_DEFAULT);
|
||||||
ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST = configuration
|
|
||||||
.get(CATEGORY_GENERAL, ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST_DEFAULT)
|
|
||||||
.getInt(ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST_DEFAULT);
|
|
||||||
ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY = configuration
|
|
||||||
.get(CATEGORY_GENERAL, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT)
|
|
||||||
.getInt(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT);
|
|
||||||
|
|
||||||
/* Graphics/Rendering Configs */
|
/* Graphic configs */
|
||||||
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration
|
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration
|
||||||
.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT)
|
.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT)
|
||||||
.getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
|
.getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
|
||||||
|
@ -56,18 +54,34 @@ public class ConfigurationHandler {
|
||||||
.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT)
|
.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT)
|
||||||
.getBoolean(ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT);
|
.getBoolean(ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT);
|
||||||
|
|
||||||
/* Block Configs */
|
/* Block configs */
|
||||||
ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS = configuration
|
|
||||||
.get(CATEGORY_BLOCK, ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS_CONFIGNAME, ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS_DEFAULT)
|
|
||||||
.getBoolean(ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS_DEFAULT);
|
|
||||||
BlockIds.CALCINATOR = configuration
|
BlockIds.CALCINATOR = configuration
|
||||||
.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT)
|
.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT)
|
||||||
.getInt(BlockIds.CALCINATOR_DEFAULT);
|
.getInt(BlockIds.CALCINATOR_DEFAULT);
|
||||||
BlockIds.RED_WATER_STILL = configuration
|
BlockIds.RED_WATER_STILL = configuration
|
||||||
.getBlock(Strings.RED_WATER_STILL_NAME, BlockIds.RED_WATER_STILL_DEFAULT)
|
.getBlock(Strings.RED_WATER_STILL_NAME, BlockIds.RED_WATER_STILL_DEFAULT)
|
||||||
.getInt(BlockIds.RED_WATER_STILL_DEFAULT);
|
.getInt(BlockIds.RED_WATER_STILL_DEFAULT);
|
||||||
|
|
||||||
|
/* Block property configs */
|
||||||
|
configuration.addCustomCategoryComment(CATEGORY_BLOCK_PROPERTIES, "Custom block properties");
|
||||||
|
|
||||||
|
/* Red Water configs */
|
||||||
|
configuration.addCustomCategoryComment(CATEGORY_RED_WATER_PROPERTIES, "Configuration settings for various properties of Red Water");
|
||||||
|
ConfigurationSettings.RED_WATER_DURATION_BASE = configuration
|
||||||
|
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_DURATION_BASE_CONFIGNAME, ConfigurationSettings.RED_WATER_DURATION_BASE_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.RED_WATER_DURATION_BASE_DEFAULT);
|
||||||
|
ConfigurationSettings.RED_WATER_DURATION_MODIFIER = configuration
|
||||||
|
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_DURATION_MODIFIER_CONFIGNAME, ConfigurationSettings.RED_WATER_DURATION_MODIFIER_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.RED_WATER_DURATION_MODIFIER_DEFAULT);
|
||||||
|
ConfigurationSettings.RED_WATER_RANGE_BASE = configuration
|
||||||
|
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_RANGE_BASE_CONFIGNAME, ConfigurationSettings.RED_WATER_RANGE_BASE_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.RED_WATER_RANGE_BASE_DEFAULT);
|
||||||
|
ConfigurationSettings.RED_WATER_RANGE_MODIFIER = configuration
|
||||||
|
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_RANGE_MODIFIER_CONFIGNAME, ConfigurationSettings.RED_WATER_RANGE_MODIFIER_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.RED_WATER_RANGE_MODIFIER_DEFAULT);
|
||||||
|
|
||||||
|
|
||||||
/* Item Configs */
|
/* Item configs */
|
||||||
ItemIds.MINIUM_SHARD = configuration
|
ItemIds.MINIUM_SHARD = configuration
|
||||||
.getItem(Strings.MINIUM_SHARD_NAME, ItemIds.MINIUM_SHARD_DEFAULT)
|
.getItem(Strings.MINIUM_SHARD_NAME, ItemIds.MINIUM_SHARD_DEFAULT)
|
||||||
.getInt(ItemIds.MINIUM_SHARD_DEFAULT);
|
.getInt(ItemIds.MINIUM_SHARD_DEFAULT);
|
||||||
|
@ -86,21 +100,40 @@ public class ConfigurationHandler {
|
||||||
ItemIds.ALCHEMY_BAG = configuration
|
ItemIds.ALCHEMY_BAG = configuration
|
||||||
.getItem(Strings.ALCHEMY_BAG_NAME, ItemIds.ALCHEMY_BAG_DEFAULT)
|
.getItem(Strings.ALCHEMY_BAG_NAME, ItemIds.ALCHEMY_BAG_DEFAULT)
|
||||||
.getInt(ItemIds.ALCHEMY_BAG_DEFAULT);
|
.getInt(ItemIds.ALCHEMY_BAG_DEFAULT);
|
||||||
|
|
||||||
|
/* Item durability configs */
|
||||||
|
ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY = configuration
|
||||||
|
.get(CATEGORY_DURABILITY, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT);
|
||||||
|
ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY = configuration
|
||||||
|
.get(CATEGORY_DURABILITY, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT);
|
||||||
|
|
||||||
/* KeyBinding Configs */
|
/* KeyBinding configs */
|
||||||
configuration.addCustomCategoryComment(CATEGORY_KEYBIND, "");
|
configuration.addCustomCategoryComment(CATEGORY_KEYBIND, "Keybindings for Equivalent Exchange 3. See http://www.minecraftwiki.net/wiki/Key_codes for mapping of key codes to keyboard keys");
|
||||||
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_EXTRA, configuration
|
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_EXTRA, configuration
|
||||||
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_EXTRA, Reference.KEYBINDING_EXTRA_DEFAULT)
|
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_EXTRA, ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT)
|
||||||
.getInt(Reference.KEYBINDING_EXTRA_DEFAULT));
|
.getInt(ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT));
|
||||||
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_CHARGE, configuration
|
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_CHARGE, configuration
|
||||||
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_CHARGE, Reference.KEYBINDING_CHARGE_DEFAULT)
|
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_CHARGE, ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT)
|
||||||
.getInt(Reference.KEYBINDING_CHARGE_DEFAULT));
|
.getInt(ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT));
|
||||||
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_TOGGLE, configuration
|
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_TOGGLE, configuration
|
||||||
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_TOGGLE, Reference.KEYBINDING_TOGGLE_DEFAULT)
|
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_TOGGLE, ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT)
|
||||||
.getInt(Reference.KEYBINDING_TOGGLE_DEFAULT));
|
.getInt(ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT));
|
||||||
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_RELEASE, configuration
|
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_RELEASE, configuration
|
||||||
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_RELEASE, Reference.KEYBINDING_RELEASE_DEFAULT)
|
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_RELEASE, ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT)
|
||||||
.getInt(Reference.KEYBINDING_RELEASE_DEFAULT));
|
.getInt(ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT));
|
||||||
|
|
||||||
|
/* Transmutation configs */
|
||||||
|
ConfigurationSettings.TRANSMUTE_COST_ITEM = configuration
|
||||||
|
.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_ITEM_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT);
|
||||||
|
ConfigurationSettings.TRANSMUTE_COST_BLOCK = configuration
|
||||||
|
.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_BLOCK_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT);
|
||||||
|
ConfigurationSettings.TRANSMUTE_COST_MOB = configuration
|
||||||
|
.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_MOB_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT)
|
||||||
|
.getInt(ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its configuration");
|
FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its configuration");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package ee3.common.core.helper;
|
package ee3.common.core.helper;
|
||||||
|
|
||||||
import ee3.common.block.ModBlocks;
|
import ee3.common.block.ModBlocks;
|
||||||
import ee3.common.lib.Reference;
|
import ee3.common.lib.ConfigurationSettings;
|
||||||
import net.minecraft.src.AxisAlignedBB;
|
import net.minecraft.src.AxisAlignedBB;
|
||||||
import net.minecraft.src.Block;
|
import net.minecraft.src.Block;
|
||||||
import net.minecraft.src.EntityLiving;
|
import net.minecraft.src.EntityLiving;
|
||||||
|
@ -24,12 +24,12 @@ public class RedWaterHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBlockInBB(World world, AxisAlignedBB par1AxisAlignedBB, Block block) {
|
public static boolean isBlockInBB(World world, AxisAlignedBB par1AxisAlignedBB, Block block) {
|
||||||
int minX = MathHelper.floor_double(par1AxisAlignedBB.minX - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
|
int minX = MathHelper.floor_double(par1AxisAlignedBB.minX - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
|
||||||
int maxX = MathHelper.floor_double(par1AxisAlignedBB.maxX + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
|
int maxX = MathHelper.floor_double(par1AxisAlignedBB.maxX + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
|
||||||
int minY = MathHelper.floor_double(par1AxisAlignedBB.minY - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
|
int minY = MathHelper.floor_double(par1AxisAlignedBB.minY - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
|
||||||
int maxY = MathHelper.floor_double(par1AxisAlignedBB.maxY + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
|
int maxY = MathHelper.floor_double(par1AxisAlignedBB.maxY + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
|
||||||
int minZ = MathHelper.floor_double(par1AxisAlignedBB.minZ - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
|
int minZ = MathHelper.floor_double(par1AxisAlignedBB.minZ - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
|
||||||
int maxZ = MathHelper.floor_double(par1AxisAlignedBB.maxZ + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
|
int maxZ = MathHelper.floor_double(par1AxisAlignedBB.maxZ + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
|
||||||
|
|
||||||
for (int i = minX; i < maxX; ++i) {
|
for (int i = minX; i < maxX; ++i) {
|
||||||
for (int j = minY; j < maxY; ++j) {
|
for (int j = minY; j < maxY; ++j) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class ItemMiniumStone extends ItemEE
|
||||||
@Override
|
@Override
|
||||||
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
|
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
|
||||||
|
|
||||||
if (keyBinding.equals(Reference.KEYBINDING_EXTRA)) {
|
if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) {
|
||||||
openPortableCrafting(thePlayer);
|
openPortableCrafting(thePlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
import ee3.common.EquivalentExchange3;
|
import ee3.common.EquivalentExchange3;
|
||||||
import ee3.common.core.helper.NBTHelper;
|
import ee3.common.core.helper.NBTHelper;
|
||||||
import ee3.common.core.helper.TransmutationHelper;
|
import ee3.common.core.helper.TransmutationHelper;
|
||||||
|
import ee3.common.lib.ConfigurationSettings;
|
||||||
import ee3.common.lib.CustomItemRarity;
|
import ee3.common.lib.CustomItemRarity;
|
||||||
import ee3.common.lib.GuiIds;
|
import ee3.common.lib.GuiIds;
|
||||||
import ee3.common.lib.Reference;
|
import ee3.common.lib.Reference;
|
||||||
|
@ -39,6 +40,7 @@ public class ItemPhilosopherStone extends ItemEE
|
||||||
this.setIconCoord(2, 0);
|
this.setIconCoord(2, 0);
|
||||||
this.setItemName(Strings.PHILOSOPHER_STONE_NAME);
|
this.setItemName(Strings.PHILOSOPHER_STONE_NAME);
|
||||||
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
||||||
|
this.setMaxDamage(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY - 1);
|
||||||
this.maxChargeLevel = 3;
|
this.maxChargeLevel = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +68,24 @@ public class ItemPhilosopherStone extends ItemEE
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getContainerItemStack(ItemStack itemStack) {
|
||||||
|
|
||||||
|
itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||||
|
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l, float f1, float f2, float f3) {
|
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l, float f1, float f2, float f3) {
|
||||||
|
|
||||||
return TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);
|
boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
itemStack.damageItem(1, entityPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,40 +97,40 @@ public class ItemPhilosopherStone extends ItemEE
|
||||||
@Override
|
@Override
|
||||||
public short getCharge(ItemStack stack) {
|
public short getCharge(ItemStack stack) {
|
||||||
|
|
||||||
return NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY);
|
return NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCharge(ItemStack stack, short charge) {
|
public void setCharge(ItemStack stack, short charge) {
|
||||||
|
|
||||||
if (charge <= maxChargeLevel) {
|
if (charge <= maxChargeLevel) {
|
||||||
NBTHelper.setShort(stack, Strings.NBT_CHARGE_LEVEL_KEY, charge);
|
NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, charge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void increaseCharge(ItemStack stack) {
|
public void increaseCharge(ItemStack stack) {
|
||||||
|
|
||||||
if (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) < maxChargeLevel) {
|
if (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) < maxChargeLevel) {
|
||||||
NBTHelper.setShort(stack, Strings.NBT_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) + 1));
|
NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decreaseCharge(ItemStack stack) {
|
public void decreaseCharge(ItemStack stack) {
|
||||||
|
|
||||||
if (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) > 0) {
|
if (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) > 0) {
|
||||||
NBTHelper.setShort(stack, Strings.NBT_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) - 1));
|
NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
|
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
|
||||||
|
|
||||||
if (keyBinding.equals(Reference.KEYBINDING_EXTRA)) {
|
if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) {
|
||||||
openPortableCrafting(thePlayer);
|
openPortableCrafting(thePlayer);
|
||||||
}
|
}
|
||||||
else if (keyBinding.equals(Reference.KEYBINDING_CHARGE)) {
|
else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_CHARGE)) {
|
||||||
if (!thePlayer.isSneaking()) {
|
if (!thePlayer.isSneaking()) {
|
||||||
increaseCharge(itemStack);
|
increaseCharge(itemStack);
|
||||||
thePlayer.worldObj.playSoundAtEntity(thePlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + (0.5F * (getCharge(itemStack) * 1.0F / maxChargeLevel)));
|
thePlayer.worldObj.playSoundAtEntity(thePlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + (0.5F * (getCharge(itemStack) * 1.0F / maxChargeLevel)));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ee3.common.lib;
|
package ee3.common.lib;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.Configuration;
|
||||||
import ee3.common.item.ModItems;
|
import ee3.common.item.ModItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,49 +17,96 @@ public class ConfigurationSettings {
|
||||||
/*
|
/*
|
||||||
* General configuration settings
|
* General configuration settings
|
||||||
*/
|
*/
|
||||||
// Whether or not automatic block id resolution for EE3 is turned on or off
|
|
||||||
public static boolean AUTO_RESOLVE_BLOCK_IDS;
|
|
||||||
public static final String ENABLE_VERSION_CHECK_CONFIGNAME = "enable_version_check";
|
|
||||||
public static final boolean AUTO_RESOLVE_BLOCK_IDS_DEFAULT = false;
|
|
||||||
|
|
||||||
// Whether or not EE3 sounds are enabled
|
// Whether or not EE3 sounds are enabled
|
||||||
public static boolean ENABLE_SOUNDS;
|
public static boolean ENABLE_SOUNDS;
|
||||||
public static final String ENABLE_SOUNDS_CONFIGNAME = "enable_sounds";
|
public static final String ENABLE_SOUNDS_CONFIGNAME = "sounds.enabled";
|
||||||
public static final boolean ENABLE_SOUNDS_DEFAULT = true;
|
public static final boolean ENABLE_SOUNDS_DEFAULT = true;
|
||||||
|
|
||||||
// Whether or not EE3 will do a version check when loaded
|
// Whether or not EE3 will do a version check when loaded
|
||||||
public static boolean ENABLE_VERSION_CHECK;
|
public static boolean ENABLE_VERSION_CHECK;
|
||||||
public static final String AUTO_RESOLVE_BLOCK_IDS_CONFIGNAME = "auto_resolve_block_ids";
|
public static final String ENABLE_VERSION_CHECK_CONFIGNAME = "version_check.enabled";
|
||||||
public static final boolean ENABLE_VERSION_CHECK_DEFAULT = true;
|
public static final boolean ENABLE_VERSION_CHECK_DEFAULT = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Render config settings
|
* Graphic config settings
|
||||||
*/
|
*/
|
||||||
// Whether or not EE3 particle fx are enabled
|
// Whether or not EE3 particle fx are enabled
|
||||||
public static boolean ENABLE_PARTICLE_FX;
|
public static boolean ENABLE_PARTICLE_FX;
|
||||||
public static final String ENABLE_PARTICLE_FX_CONFIGNAME = "enable_particle_fx";
|
public static final String ENABLE_PARTICLE_FX_CONFIGNAME = "particle_fx.enabled";
|
||||||
public static final boolean ENABLE_PARTICLE_FX_DEFAULT = true;
|
public static final boolean ENABLE_PARTICLE_FX_DEFAULT = true;
|
||||||
|
|
||||||
// Whether or not the in world transmutation overlay is enabled
|
// Whether or not the in world transmutation overlay is enabled
|
||||||
public static boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION;
|
public static boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION;
|
||||||
public static final String ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME = "enable_world_transmutation_overlay";
|
public static final String ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME = "world_transmutation_overlay.enabled";
|
||||||
public static final boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT = true;
|
public static final boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Minium stone config settings
|
* Block related config settings
|
||||||
*/
|
*/
|
||||||
// The durability cost for each transmute with the Minium Stone
|
public static int RED_WATER_DURATION_BASE;
|
||||||
public static int MINIUM_STONE_TRANSMUTE_COST;
|
public static String RED_WATER_DURATION_BASE_CONFIGNAME = "duration.base";
|
||||||
public static final String MINIUM_STONE_TRANSMUTE_COST_CONFIGNAME = Strings.MINIUM_STONE_NAME + ".transmuteCost";
|
public static final int RED_WATER_DURATION_BASE_DEFAULT = 5;
|
||||||
public static final int MINIUM_STONE_TRANSMUTE_COST_DEFAULT = 1;
|
|
||||||
|
|
||||||
|
public static int RED_WATER_DURATION_MODIFIER;
|
||||||
|
public static String RED_WATER_DURATION_MODIFIER_CONFIGNAME = "duration.modifier";
|
||||||
|
public static final int RED_WATER_DURATION_MODIFIER_DEFAULT = 2;
|
||||||
|
|
||||||
|
public static int RED_WATER_RANGE_BASE;
|
||||||
|
public static String RED_WATER_RANGE_BASE_CONFIGNAME = "range.base";
|
||||||
|
public static final int RED_WATER_RANGE_BASE_DEFAULT = 1;
|
||||||
|
|
||||||
|
public static int RED_WATER_RANGE_MODIFIER;
|
||||||
|
public static String RED_WATER_RANGE_MODIFIER_CONFIGNAME = "range.modifier";
|
||||||
|
public static final int RED_WATER_RANGE_MODIFIER_DEFAULT = 3;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Item related config settings
|
||||||
|
*/
|
||||||
// The maximum durability for the Minium Stone
|
// The maximum durability for the Minium Stone
|
||||||
public static int MINIUM_STONE_MAX_DURABILITY;
|
public static int MINIUM_STONE_MAX_DURABILITY;
|
||||||
public static final String MINIUM_STONE_MAX_DURABILITY_CONFIGNAME = Strings.MINIUM_STONE_NAME + ".maxDurability";
|
public static final String MINIUM_STONE_MAX_DURABILITY_CONFIGNAME = Strings.MINIUM_STONE_NAME;
|
||||||
public static final int MINIUM_STONE_MAX_DURABILITY_DEFAULT = 1521;
|
public static final int MINIUM_STONE_MAX_DURABILITY_DEFAULT = 1521;
|
||||||
|
|
||||||
|
// The maximum durability for the Philosophers Stone
|
||||||
public static int PHILOSOPHERS_STONE_MAX_DURABILITY;
|
public static int PHILOSOPHERS_STONE_MAX_DURABILITY;
|
||||||
public static final String PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME = Strings.PHILOSOPHER_STONE_NAME + ".maxDurability";
|
public static final String PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME = Strings.PHILOSOPHER_STONE_NAME;
|
||||||
public static final int PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT = 10001;
|
public static final int PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT = 10001;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keybinding related config settings
|
||||||
|
*/
|
||||||
|
// Extra key
|
||||||
|
public static final String KEYBINDING_EXTRA = "key.extra";
|
||||||
|
public static final int KEYBINDING_EXTRA_DEFAULT = 46;
|
||||||
|
|
||||||
|
// Release key
|
||||||
|
public static final String KEYBINDING_RELEASE = "key.release";
|
||||||
|
public static final int KEYBINDING_RELEASE_DEFAULT = 19;
|
||||||
|
|
||||||
|
// Toggle key
|
||||||
|
public static final String KEYBINDING_TOGGLE = "key.toggle";
|
||||||
|
public static final int KEYBINDING_TOGGLE_DEFAULT = 34;
|
||||||
|
|
||||||
|
// Charge key
|
||||||
|
public static final String KEYBINDING_CHARGE = "key.charge";
|
||||||
|
public static final int KEYBINDING_CHARGE_DEFAULT = 47;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Transmutation related config settings
|
||||||
|
*/
|
||||||
|
// The durability cost for each item transmutation
|
||||||
|
public static int TRANSMUTE_COST_ITEM;
|
||||||
|
public static final String TRANSMUTE_COST_ITEM_CONFIGNAME = Strings.TRANSMUTATION_COST_ITEM;
|
||||||
|
public static final int TRANSMUTE_COST_ITEM_DEFAULT = 1;
|
||||||
|
|
||||||
|
// The durability cost for each block transmutation
|
||||||
|
public static int TRANSMUTE_COST_BLOCK;
|
||||||
|
public static final String TRANSMUTE_COST_BLOCK_CONFIGNAME = Strings.TRANSMUTATION_COST_BLOCK;
|
||||||
|
public static final int TRANSMUTE_COST_BLOCK_DEFAULT = 1;
|
||||||
|
|
||||||
|
// The durability cost for each block transmutation
|
||||||
|
public static int TRANSMUTE_COST_MOB;
|
||||||
|
public static final String TRANSMUTE_COST_MOB_CONFIGNAME = Strings.TRANSMUTATION_COST_MOB;
|
||||||
|
public static final int TRANSMUTE_COST_MOB_DEFAULT = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,25 +24,4 @@ public class Reference {
|
||||||
public static final String SERVER_PROXY_CLASS = "ee3.common.core.CommonProxy";
|
public static final String SERVER_PROXY_CLASS = "ee3.common.core.CommonProxy";
|
||||||
public static final String CLIENT_PROXY_CLASS = "ee3.client.core.ClientProxy";
|
public static final String CLIENT_PROXY_CLASS = "ee3.client.core.ClientProxy";
|
||||||
|
|
||||||
/* KeyBinding related constants */
|
|
||||||
public static final String KEYBINDING_EXTRA = "key.extra";
|
|
||||||
public static final int KEYBINDING_EXTRA_DEFAULT = 46;
|
|
||||||
public static final String KEYBINDING_RELEASE = "key.release";
|
|
||||||
public static final int KEYBINDING_RELEASE_DEFAULT = 19;
|
|
||||||
public static final String KEYBINDING_TOGGLE = "key.toggle";
|
|
||||||
public static final int KEYBINDING_TOGGLE_DEFAULT = 34;
|
|
||||||
public static final String KEYBINDING_CHARGE = "key.charge";
|
|
||||||
public static final int KEYBINDING_CHARGE_DEFAULT = 47;
|
|
||||||
|
|
||||||
/* General Tile Entity related constants */
|
|
||||||
public static final String TE_GEN_OWNER_NBT_TAG_LABEL = "owner";
|
|
||||||
public static final String TE_GEN_STATE_NBT_TAG_LABEL = "state";
|
|
||||||
public static final String TE_GEN_DIRECTION_NBT_TAG_LABEL = "direction";
|
|
||||||
|
|
||||||
// TODO: Find a better spot for these
|
|
||||||
public static final int BLOCK_RED_WATER_EFFECT_DURATION_BASE = 5;
|
|
||||||
public static final int BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER = 2;
|
|
||||||
public static final int BLOCK_RED_WATER_RANGE_BASE = 1;
|
|
||||||
public static final int BLOCK_RED_WATER_RANGE_MODIFIER = 3;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package ee3.common.lib;
|
||||||
|
|
||||||
public class Strings {
|
public class Strings {
|
||||||
|
|
||||||
/* General text keys */
|
/* General keys */
|
||||||
|
|
||||||
/* Version check related constants */
|
/* Version check related constants */
|
||||||
public static final String VERSION_CHECK_DISABLED = "version.check_disabled";
|
public static final String VERSION_CHECK_DISABLED = "version.check_disabled";
|
||||||
|
@ -16,7 +16,11 @@ public class Strings {
|
||||||
public static final String GUI_CALCINATOR_NAME = "gui.calcinator.name";
|
public static final String GUI_CALCINATOR_NAME = "gui.calcinator.name";
|
||||||
|
|
||||||
/* NBT related constants */
|
/* NBT related constants */
|
||||||
public static final String NBT_CHARGE_LEVEL_KEY = "chargeLevel";
|
public static final String NBT_ITEM_CHARGE_LEVEL_KEY = "itemChargeLevel";
|
||||||
|
public static final String NBT_ITEM_MODE_KEY = "itemMode";
|
||||||
|
public static final String NBT_TE_OWNER_KEY = "teOwner";
|
||||||
|
public static final String NBT_TE_STATE_KEY = "teState";
|
||||||
|
public static final String NBT_TE_DIRECTION_KEY = "teDirection";
|
||||||
|
|
||||||
/* Block name constants */
|
/* Block name constants */
|
||||||
public static final String CALCINATOR_NAME = "calcinator";
|
public static final String CALCINATOR_NAME = "calcinator";
|
||||||
|
@ -33,5 +37,11 @@ public class Strings {
|
||||||
|
|
||||||
/* TileEntity name constants */
|
/* TileEntity name constants */
|
||||||
public static final String TE_CALCINATOR_NAME = "tileCalcinator";
|
public static final String TE_CALCINATOR_NAME = "tileCalcinator";
|
||||||
|
|
||||||
|
/* Transmutation cost related constants */
|
||||||
|
public static final String TRANSMUTATION_COST = "_cost";
|
||||||
|
public static final String TRANSMUTATION_COST_ITEM = "item" + TRANSMUTATION_COST;
|
||||||
|
public static final String TRANSMUTATION_COST_BLOCK = "block" + TRANSMUTATION_COST;
|
||||||
|
public static final String TRANSMUTATION_COST_MOB = "mob" + TRANSMUTATION_COST;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ee3.common.tile;
|
package ee3.common.tile;
|
||||||
|
|
||||||
import ee3.common.lib.Reference;
|
import ee3.common.lib.Reference;
|
||||||
|
import ee3.common.lib.Strings;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.src.NBTTagCompound;
|
||||||
import net.minecraft.src.TileEntity;
|
import net.minecraft.src.TileEntity;
|
||||||
|
@ -51,18 +52,18 @@ public class TileEE extends TileEntity {
|
||||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||||
super.readFromNBT(nbtTagCompound);
|
super.readFromNBT(nbtTagCompound);
|
||||||
|
|
||||||
direction = nbtTagCompound.getByte(Reference.TE_GEN_DIRECTION_NBT_TAG_LABEL);
|
direction = nbtTagCompound.getByte(Strings.NBT_TE_DIRECTION_KEY);
|
||||||
state = nbtTagCompound.getShort(Reference.TE_GEN_STATE_NBT_TAG_LABEL);
|
state = nbtTagCompound.getShort(Strings.NBT_TE_STATE_KEY);
|
||||||
owner = nbtTagCompound.getString(Reference.TE_GEN_OWNER_NBT_TAG_LABEL);
|
owner = nbtTagCompound.getString(Strings.NBT_TE_OWNER_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
||||||
super.writeToNBT(nbtTagCompound);
|
super.writeToNBT(nbtTagCompound);
|
||||||
|
|
||||||
nbtTagCompound.setByte(Reference.TE_GEN_DIRECTION_NBT_TAG_LABEL, direction);
|
nbtTagCompound.setByte(Strings.NBT_TE_DIRECTION_KEY, direction);
|
||||||
nbtTagCompound.setShort(Reference.TE_GEN_STATE_NBT_TAG_LABEL, state);
|
nbtTagCompound.setShort(Strings.NBT_TE_STATE_KEY, state);
|
||||||
if(owner != null && owner != "") {
|
if(owner != null && owner != "") {
|
||||||
nbtTagCompound.setString(Reference.TE_GEN_OWNER_NBT_TAG_LABEL, owner);
|
nbtTagCompound.setString(Strings.NBT_TE_OWNER_KEY, owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue