From 2195107d6d4fe120bf41d39c6305dade5cf2b63d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 1 Jul 2015 16:32:21 +0200 Subject: [PATCH] A bit of reorganizing --- .../actuallyadditions/ActuallyAdditions.java | 2 +- .../config/ConfigValues.java | 30 ++++-------- .../config/values/ConfigBoolValues.java | 5 +- .../config/values/ConfigCrafting.java | 5 +- .../config/values/ConfigFloatValues.java | 5 +- .../config/values/ConfigIntValues.java | 5 +- .../crafting/ItemCrafting.java | 46 ------------------ .../crafting/ToolCrafting.java | 47 +++++++++++++++++++ .../inventory/ContainerGrinder.java | 2 +- 9 files changed, 69 insertions(+), 78 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java index b4afdc733..226a1378b 100644 --- a/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java @@ -30,7 +30,7 @@ import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.BlockDispenser; -@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION) +@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION, canBeDeactivated = false) public class ActuallyAdditions{ @Instance(ModUtil.MOD_ID) diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index 731e7c82e..6c77a8f53 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -9,37 +9,23 @@ import net.minecraftforge.common.config.Configuration; public class ConfigValues{ public static ConfigCrafting[] craftingConfig = ConfigCrafting.values(); - public static boolean[] craftingValues = new boolean[craftingConfig.length]; - public static ConfigIntValues[] intConfig = ConfigIntValues.values(); - public static int[] intValues = new int[intConfig.length]; - public static ConfigFloatValues[] floatConfig = ConfigFloatValues.values(); - public static float[] floatValues = new float[floatConfig.length]; - public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values(); - public static boolean[] boolValues = new boolean[boolConfig.length]; public static void defineConfigValues(Configuration config){ - for(int i = 0; i < craftingValues.length; i++){ - ConfigCrafting currConf = craftingConfig[i]; - craftingValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the " + currConf.name + " is Enabled"); + for(ConfigCrafting currConf : craftingConfig){ + currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the "+currConf.name+" is Enabled"); } - - for(int i = 0; i < intValues.length; i++){ - ConfigIntValues currConf = intConfig[i]; - intValues[i] = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc); + for(ConfigIntValues currConf : intConfig){ + currConf.currentValue = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc); } - - for(int i = 0; i < floatValues.length; i++){ - ConfigFloatValues currConf = floatConfig[i]; - floatValues[i] = config.getFloat(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc); + for(ConfigFloatValues currConf : floatConfig){ + currConf.currentValue = config.getFloat(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc); } - - for(int i = 0; i < boolValues.length; i++){ - ConfigBoolValues currConf = boolConfig[i]; - boolValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc); + for(ConfigBoolValues currConf : boolConfig){ + currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java index 719b30b5f..3cd4a8cb1 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java @@ -1,7 +1,6 @@ package ellpeck.actuallyadditions.config.values; import ellpeck.actuallyadditions.config.ConfigCategories; -import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.ConfigurationHandler; public enum ConfigBoolValues{ @@ -43,6 +42,8 @@ public enum ConfigBoolValues{ public final boolean defaultValue; public final String desc; + public boolean currentValue; + ConfigBoolValues(String name, ConfigCategories category, boolean defaultValue, String desc){ this.name = name; this.category = category.name; @@ -51,7 +52,7 @@ public enum ConfigBoolValues{ } public boolean isEnabled(){ - return ConfigValues.boolValues[this.ordinal()]; + return this.currentValue; } } diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java index 530c36472..5e094d073 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigCrafting.java @@ -1,7 +1,6 @@ package ellpeck.actuallyadditions.config.values; import ellpeck.actuallyadditions.config.ConfigCategories; -import ellpeck.actuallyadditions.config.ConfigValues; public enum ConfigCrafting{ @@ -111,6 +110,8 @@ public enum ConfigCrafting{ public final String category; public final boolean defaultValue; + public boolean currentValue; + ConfigCrafting(String name, ConfigCategories category){ this(name, category, true); } @@ -122,6 +123,6 @@ public enum ConfigCrafting{ } public boolean isEnabled(){ - return ConfigValues.craftingValues[this.ordinal()]; + return this.currentValue; } } diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java index e8d94df86..8842748c7 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigFloatValues.java @@ -1,7 +1,6 @@ package ellpeck.actuallyadditions.config.values; import ellpeck.actuallyadditions.config.ConfigCategories; -import ellpeck.actuallyadditions.config.ConfigValues; public enum ConfigFloatValues{ @@ -20,6 +19,8 @@ public enum ConfigFloatValues{ public final float max; public final String desc; + public float currentValue; + ConfigFloatValues(String name, ConfigCategories category, float defaultValue, float min, float max, String desc){ this.name = name; this.category = category.name; @@ -30,7 +31,7 @@ public enum ConfigFloatValues{ } public float getValue(){ - return ConfigValues.floatValues[this.ordinal()]; + return this.currentValue; } } diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index 2ed8f077e..11debb0c4 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -1,7 +1,6 @@ package ellpeck.actuallyadditions.config.values; import ellpeck.actuallyadditions.config.ConfigCategories; -import ellpeck.actuallyadditions.config.ConfigValues; import net.minecraftforge.fluids.FluidContainerRegistry; public enum ConfigIntValues{ @@ -108,6 +107,8 @@ public enum ConfigIntValues{ public final int max; public final String desc; + public int currentValue; + ConfigIntValues(String name, ConfigCategories category, int defaultValue, int min, int max, String desc){ this.name = name; this.category = category.name; @@ -118,6 +119,6 @@ public enum ConfigIntValues{ } public int getValue(){ - return ConfigValues.intValues[this.ordinal()]; + return this.currentValue; } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 681c79474..cf4aed5c1 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -146,52 +146,6 @@ public class ItemCrafting{ 'S', "stone", 'C', ((INameableItem)InitItems.itemCoffeeBean).getOredictName())); - //Paxels - if(ConfigCrafting.PAXELS.isEnabled()){ - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.woodenPaxel), - new ItemStack(Items.wooden_axe), - new ItemStack(Items.wooden_pickaxe), - new ItemStack(Items.wooden_shovel), - new ItemStack(Items.wooden_sword), - new ItemStack(Items.wooden_hoe))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.stonePaxel), - new ItemStack(Items.stone_axe), - new ItemStack(Items.stone_pickaxe), - new ItemStack(Items.stone_shovel), - new ItemStack(Items.stone_sword), - new ItemStack(Items.stone_hoe))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.ironPaxel), - new ItemStack(Items.iron_axe), - new ItemStack(Items.iron_pickaxe), - new ItemStack(Items.iron_shovel), - new ItemStack(Items.iron_sword), - new ItemStack(Items.iron_hoe))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.goldPaxel), - new ItemStack(Items.golden_axe), - new ItemStack(Items.golden_pickaxe), - new ItemStack(Items.golden_shovel), - new ItemStack(Items.golden_sword), - new ItemStack(Items.golden_hoe))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.diamondPaxel), - new ItemStack(Items.diamond_axe), - new ItemStack(Items.diamond_pickaxe), - new ItemStack(Items.diamond_shovel), - new ItemStack(Items.diamond_sword), - new ItemStack(Items.diamond_hoe))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.emeraldPaxel), - new ItemStack(InitItems.itemAxeEmerald), - new ItemStack(InitItems.itemPickaxeEmerald), - new ItemStack(InitItems.itemSwordEmerald), - new ItemStack(InitItems.itemShovelEmerald), - new ItemStack(InitItems.itemHoeEmerald))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.obsidianPaxel), - new ItemStack(InitItems.itemAxeObsidian), - new ItemStack(InitItems.itemPickaxeObsidian), - new ItemStack(InitItems.itemSwordObsidian), - new ItemStack(InitItems.itemShovelObsidian), - new ItemStack(InitItems.itemHoeObsidian))); - } - //Resonant Rice if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium", false).isEmpty()) GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice), diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java index 103b1bf17..6e08fd874 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java @@ -7,6 +7,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class ToolCrafting{ @@ -75,6 +76,52 @@ public class ToolCrafting{ 'E', new ItemStack(Blocks.obsidian), 'S', new ItemStack(Items.stick)); } + + //Paxels + if(ConfigCrafting.PAXELS.isEnabled()){ + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.woodenPaxel), + new ItemStack(Items.wooden_axe), + new ItemStack(Items.wooden_pickaxe), + new ItemStack(Items.wooden_shovel), + new ItemStack(Items.wooden_sword), + new ItemStack(Items.wooden_hoe))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.stonePaxel), + new ItemStack(Items.stone_axe), + new ItemStack(Items.stone_pickaxe), + new ItemStack(Items.stone_shovel), + new ItemStack(Items.stone_sword), + new ItemStack(Items.stone_hoe))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.ironPaxel), + new ItemStack(Items.iron_axe), + new ItemStack(Items.iron_pickaxe), + new ItemStack(Items.iron_shovel), + new ItemStack(Items.iron_sword), + new ItemStack(Items.iron_hoe))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.goldPaxel), + new ItemStack(Items.golden_axe), + new ItemStack(Items.golden_pickaxe), + new ItemStack(Items.golden_shovel), + new ItemStack(Items.golden_sword), + new ItemStack(Items.golden_hoe))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.diamondPaxel), + new ItemStack(Items.diamond_axe), + new ItemStack(Items.diamond_pickaxe), + new ItemStack(Items.diamond_shovel), + new ItemStack(Items.diamond_sword), + new ItemStack(Items.diamond_hoe))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.emeraldPaxel), + new ItemStack(InitItems.itemAxeEmerald), + new ItemStack(InitItems.itemPickaxeEmerald), + new ItemStack(InitItems.itemSwordEmerald), + new ItemStack(InitItems.itemShovelEmerald), + new ItemStack(InitItems.itemHoeEmerald))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.obsidianPaxel), + new ItemStack(InitItems.itemAxeObsidian), + new ItemStack(InitItems.itemPickaxeObsidian), + new ItemStack(InitItems.itemSwordObsidian), + new ItemStack(InitItems.itemShovelObsidian), + new ItemStack(InitItems.itemHoeObsidian))); + } } } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java index ce1892003..c366b63a3 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java @@ -18,7 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection; @InventoryContainer public class ContainerGrinder extends Container{ - private TileEntityGrinder tileGrinder; + public TileEntityGrinder tileGrinder; private boolean isDouble; private int lastFirstCrushTime;