A bit of reorganizing

This commit is contained in:
Ellpeck 2015-07-01 16:32:21 +02:00
parent 56bb502ab7
commit 2195107d6d
9 changed files with 69 additions and 78 deletions

View file

@ -30,7 +30,7 @@ import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.BlockDispenser; 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{ public class ActuallyAdditions{
@Instance(ModUtil.MOD_ID) @Instance(ModUtil.MOD_ID)

View file

@ -9,37 +9,23 @@ import net.minecraftforge.common.config.Configuration;
public class ConfigValues{ public class ConfigValues{
public static ConfigCrafting[] craftingConfig = ConfigCrafting.values(); public static ConfigCrafting[] craftingConfig = ConfigCrafting.values();
public static boolean[] craftingValues = new boolean[craftingConfig.length];
public static ConfigIntValues[] intConfig = ConfigIntValues.values(); public static ConfigIntValues[] intConfig = ConfigIntValues.values();
public static int[] intValues = new int[intConfig.length];
public static ConfigFloatValues[] floatConfig = ConfigFloatValues.values(); public static ConfigFloatValues[] floatConfig = ConfigFloatValues.values();
public static float[] floatValues = new float[floatConfig.length];
public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values(); public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values();
public static boolean[] boolValues = new boolean[boolConfig.length];
public static void defineConfigValues(Configuration config){ public static void defineConfigValues(Configuration config){
for(int i = 0; i < craftingValues.length; i++){ for(ConfigCrafting currConf : craftingConfig){
ConfigCrafting currConf = craftingConfig[i]; currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the "+currConf.name+" is Enabled");
craftingValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the " + currConf.name + " is Enabled");
} }
for(ConfigIntValues currConf : intConfig){
for(int i = 0; i < intValues.length; i++){ currConf.currentValue = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
ConfigIntValues currConf = intConfig[i];
intValues[i] = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
} }
for(ConfigFloatValues currConf : floatConfig){
for(int i = 0; i < floatValues.length; i++){ currConf.currentValue = config.getFloat(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
ConfigFloatValues currConf = floatConfig[i];
floatValues[i] = config.getFloat(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
} }
for(ConfigBoolValues currConf : boolConfig){
for(int i = 0; i < boolValues.length; i++){ currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc);
ConfigBoolValues currConf = boolConfig[i];
boolValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc);
} }
} }
} }

View file

@ -1,7 +1,6 @@
package ellpeck.actuallyadditions.config.values; package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories; import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.config.ConfigurationHandler; import ellpeck.actuallyadditions.config.ConfigurationHandler;
public enum ConfigBoolValues{ public enum ConfigBoolValues{
@ -43,6 +42,8 @@ public enum ConfigBoolValues{
public final boolean defaultValue; public final boolean defaultValue;
public final String desc; public final String desc;
public boolean currentValue;
ConfigBoolValues(String name, ConfigCategories category, boolean defaultValue, String desc){ ConfigBoolValues(String name, ConfigCategories category, boolean defaultValue, String desc){
this.name = name; this.name = name;
this.category = category.name; this.category = category.name;
@ -51,7 +52,7 @@ public enum ConfigBoolValues{
} }
public boolean isEnabled(){ public boolean isEnabled(){
return ConfigValues.boolValues[this.ordinal()]; return this.currentValue;
} }
} }

View file

@ -1,7 +1,6 @@
package ellpeck.actuallyadditions.config.values; package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories; import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
public enum ConfigCrafting{ public enum ConfigCrafting{
@ -111,6 +110,8 @@ public enum ConfigCrafting{
public final String category; public final String category;
public final boolean defaultValue; public final boolean defaultValue;
public boolean currentValue;
ConfigCrafting(String name, ConfigCategories category){ ConfigCrafting(String name, ConfigCategories category){
this(name, category, true); this(name, category, true);
} }
@ -122,6 +123,6 @@ public enum ConfigCrafting{
} }
public boolean isEnabled(){ public boolean isEnabled(){
return ConfigValues.craftingValues[this.ordinal()]; return this.currentValue;
} }
} }

View file

@ -1,7 +1,6 @@
package ellpeck.actuallyadditions.config.values; package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories; import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
public enum ConfigFloatValues{ public enum ConfigFloatValues{
@ -20,6 +19,8 @@ public enum ConfigFloatValues{
public final float max; public final float max;
public final String desc; public final String desc;
public float currentValue;
ConfigFloatValues(String name, ConfigCategories category, float defaultValue, float min, float max, String desc){ ConfigFloatValues(String name, ConfigCategories category, float defaultValue, float min, float max, String desc){
this.name = name; this.name = name;
this.category = category.name; this.category = category.name;
@ -30,7 +31,7 @@ public enum ConfigFloatValues{
} }
public float getValue(){ public float getValue(){
return ConfigValues.floatValues[this.ordinal()]; return this.currentValue;
} }
} }

View file

@ -1,7 +1,6 @@
package ellpeck.actuallyadditions.config.values; package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories; import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
public enum ConfigIntValues{ public enum ConfigIntValues{
@ -108,6 +107,8 @@ public enum ConfigIntValues{
public final int max; public final int max;
public final String desc; public final String desc;
public int currentValue;
ConfigIntValues(String name, ConfigCategories category, int defaultValue, int min, int max, String desc){ ConfigIntValues(String name, ConfigCategories category, int defaultValue, int min, int max, String desc){
this.name = name; this.name = name;
this.category = category.name; this.category = category.name;
@ -118,6 +119,6 @@ public enum ConfigIntValues{
} }
public int getValue(){ public int getValue(){
return ConfigValues.intValues[this.ordinal()]; return this.currentValue;
} }
} }

View file

@ -146,52 +146,6 @@ public class ItemCrafting{
'S', "stone", 'S', "stone",
'C', ((INameableItem)InitItems.itemCoffeeBean).getOredictName())); '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 //Resonant Rice
if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium", false).isEmpty()) if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium", false).isEmpty())
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice),

View file

@ -7,6 +7,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class ToolCrafting{ public class ToolCrafting{
@ -75,6 +76,52 @@ public class ToolCrafting{
'E', new ItemStack(Blocks.obsidian), 'E', new ItemStack(Blocks.obsidian),
'S', new ItemStack(Items.stick)); '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)));
}
} }
} }

View file

@ -18,7 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection;
@InventoryContainer @InventoryContainer
public class ContainerGrinder extends Container{ public class ContainerGrinder extends Container{
private TileEntityGrinder tileGrinder; public TileEntityGrinder tileGrinder;
private boolean isDouble; private boolean isDouble;
private int lastFirstCrushTime; private int lastFirstCrushTime;