Fixed configs resetting randomly.

Closes #107
This commit is contained in:
Ellpeck 2016-06-05 12:15:02 +02:00
parent b65f0a7c76
commit 707f71d7e3
26 changed files with 158 additions and 80 deletions

View file

@ -10,9 +10,11 @@
package de.ellpeck.actuallyadditions.mod.config;
import java.util.Locale;
public enum ConfigCategories{
PERFORMANCE("PERFORMANCE", "Performance Settings"),
PERFORMANCE("Performance", "Performance Settings"),
FOOD_CRAFTING("Food Crafting", "Crafting Recipes for Food Items"),
BLOCKS_CRAFTING("Block Crafting", "Crafting Recipes for Blocks"),
ITEMS_CRAFTING("Item Crafting", "Crafting Recipes for Items"),
@ -21,14 +23,13 @@ public enum ConfigCategories{
MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"),
WORLD_GEN("World Gen", "Everything regarding World Generation"),
POTION_RING_CRAFTING("Ring Crafting", "Crafting Recipes for Rings"),
FLUIDS("Fluids", "Everything regarding fluids"),
OTHER("Other", "Everything else");
public final String name;
public final String comment;
ConfigCategories(String name, String comment){
this.name = name;
this.name = name.toLowerCase(Locale.ROOT);
this.comment = comment;
}
}

View file

@ -10,62 +10,32 @@
package de.ellpeck.actuallyadditions.mod.config;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.config.values.*;
import net.minecraftforge.common.config.Configuration;
public class ConfigValues{
public static final ConfigCrafting[] CRAFTING_CONFIG = ConfigCrafting.values();
public static final ConfigIntValues[] INT_CONFIG = ConfigIntValues.values();
public static final ConfigBoolValues[] BOOL_CONFIG = ConfigBoolValues.values();
public static String[] crusherRecipeExceptions;
public static String[] mashedFoodCraftingExceptions;
public static String[] paxelExtraMiningWhitelist;
public static String[] drillExtraMiningWhitelist;
public static int[] oreGenDimensionBlacklist;
public static int[] plantDimensionBlacklist;
public static String[] minerExtraWhitelist;
public static String[] minerBlacklist;
public static String[] repairerExtraWhitelist;
public static String[] spawnerChangerBlacklist;
public static boolean lessSound;
public static boolean lessParticles;
public static boolean lessBlockBreakingEffects;
public static void defineConfigValues(Configuration config){
for(ConfigCrafting currConf : CRAFTING_CONFIG){
for(ConfigCrafting currConf : ConfigCrafting.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, "If the Recipe for the "+currConf.name+" is Enabled").getBoolean();
}
for(ConfigIntValues currConf : INT_CONFIG){
for(ConfigIntValues currConf : ConfigIntValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
}
for(ConfigBoolValues currConf : BOOL_CONFIG){
for(ConfigBoolValues currConf : ConfigBoolValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean();
}
crusherRecipeExceptions = config.get(ConfigCategories.OTHER.name, "Crusher Recipe Exceptions", new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only.").getStringList();
mashedFoodCraftingExceptions = config.get(ConfigCategories.ITEMS_CRAFTING.name, "Mashed Food Crafting Exceptions", new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.").getStringList();
paxelExtraMiningWhitelist = config.get(ConfigCategories.TOOL_VALUES.name, "AIOT Extra Whitelist", new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.").getStringList();
drillExtraMiningWhitelist = config.get(ConfigCategories.TOOL_VALUES.name, "Drill Extra Whitelist", new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.").getStringList();
oreGenDimensionBlacklist = config.get(ConfigCategories.WORLD_GEN.name, "OreGen Dimension Blacklist", new int[0], "The IDs of the dimensions that Actually Additions OreGen (Black Quartz for example) is banned in. This also applies for other world gen like lush caves.").getIntList();
plantDimensionBlacklist = config.get(ConfigCategories.WORLD_GEN.name, "Plant Blacklist", new int[0], "The IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in").getIntList();
minerExtraWhitelist = config.get(ConfigCategories.MACHINE_VALUES.name, "Vertical Digger Extra Whitelist", new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option only applies if the miner is in Ores Only Mode.").getStringList();
minerBlacklist = config.get(ConfigCategories.MACHINE_VALUES.name, "Vertical Digger Blacklist", new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can mine, but shouldn't be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option will apply in both modes.").getStringList();
repairerExtraWhitelist = config.get(ConfigCategories.MACHINE_VALUES.name, "Item Repairer Extra Whitelist", new String[]{"tconstruct:pickaxe", "tconstruct:shovel", "tconstruct:hatchet", "tconstruct:mattock", "tconstruct:broadsword", "tconstruct:longsword", "tconstruct:frypan", "tconstruct:battlesign", "tconstruct:hammer", "tconstruct:excavator", "tconstruct:lumberaxe", "tconstruct:cleaver"}, "By default, the Item Repairer only repairs items which are repairable in an anvil. Add an item's REGISTRY NAME here if you want it to be repairable.").getStringList();
spawnerChangerBlacklist = config.get(ConfigCategories.OTHER.name, "Spawner Changer Blacklist", new String[]{"VillagerGolem"}, "By default, the Spawner Changer allows every living entity to be put into a spawner. If there is one that shouldn't be able to, put its MAPPING NAME here.").getStringList();
for(ConfigIntListValues currConf : ConfigIntListValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getIntList();
}
for(ConfigStringListValues currConf : ConfigStringListValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getStringList();
}
lessSound = config.get(ConfigCategories.PERFORMANCE.name, "Less Sound", false, "If blocks in Actually Additions should have less sounds").getBoolean();
lessParticles = config.get(ConfigCategories.PERFORMANCE.name, "Less Particles", false, "If blocks in Actually Additions should have less particles").getBoolean();
lessBlockBreakingEffects = config.get(ConfigCategories.PERFORMANCE.name, "Less Block Breaking Effects", false, "If there should not be a sound effect and particles when a block is being destroyed by a breaker or similar").getBoolean();
}
}

View file

@ -27,13 +27,13 @@ public class ConfigurationHandler{
Util.registerEvent(this);
if(config == null){
config = new Configuration(configFile, true);
loadConfig();
}
config = new Configuration(configFile);
config.load();
redefineConfigs();
}
private static void loadConfig(){
private static void redefineConfigs(){
ConfigValues.defineConfigValues(config);
if(config.hasChanged()){
@ -44,7 +44,7 @@ public class ConfigurationHandler{
@SubscribeEvent
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event){
if(event.getModID().equalsIgnoreCase(ModUtil.MOD_ID)){
loadConfig();
redefineConfigs();
}
}
}

View file

@ -51,7 +51,11 @@ public enum ConfigBoolValues{
BOOKLET_TEXT_TO_FILE("Booklet Text to File", ConfigCategories.OTHER, false, "Should the entire text of the booklet be put into a new file in the Minecraft Folder on startup or resource reload. This is for debug purposes only and shouldn't really ever be needed."),
WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "If right-clicking a bowl on water should create a water bowl");
WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "If right-clicking a bowl on water should create a water bowl"),
LESS_SOUND("Less Sound", ConfigCategories.PERFORMANCE, false, "If blocks in Actually Additions should have less sounds"),
LESS_PARTICLES("Less Particles", ConfigCategories.PERFORMANCE, false, "If blocks in Actually Additions should have less particles"),
LESS_BLOCK_BREAKING_EFFECTS("Less Block Breaking Effects", ConfigCategories.PERFORMANCE, false, "If there should not be a sound effect and particles when a block is being destroyed by a breaker or similar");
public final String name;
public final String category;

View file

@ -0,0 +1,38 @@
/*
* This file ("ConfigIntListValues.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config.values;
import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
public enum ConfigIntListValues{
ORE_GEN_DIMENSION_BLACKLIST("OreGen Dimension Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The IDs of the dimensions that Actually Additions OreGen (Black Quartz for example) is banned in. This also applies for other world gen like lush caves."),
PLANT_DIMENSION_BLACKLIST("Plant Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in");
public final String name;
public final String category;
public final int[] defaultValue;
public final String desc;
public int[] currentValue;
ConfigIntListValues(String name, ConfigCategories category, int[] defaultValue, String desc){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
this.desc = desc;
}
public int[] getValue(){
return this.currentValue;
}
}

View file

@ -0,0 +1,44 @@
/*
* This file ("ConfigStringListValues.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config.values;
import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
public enum ConfigStringListValues{
CRUSHER_RECIPE_EXCEPTIONS("Crusher Recipe Exceptions", ConfigCategories.OTHER, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."),
MASHED_FOOD_CRAFTING_EXCEPTIONS("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
PAXEL_EXTRA_MINING_WHITELIST("AIOT Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
DRILL_EXTRA_MINING_WHITELIST("Drill Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
MINER_EXTRA_WHITELIST("Vertical Digger Extra Whitelist", ConfigCategories.MACHINE_VALUES, new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option only applies if the miner is in Ores Only Mode."),
MINER_BLACKLIST("Vertical Digger Blacklist", ConfigCategories.MACHINE_VALUES, new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can mine, but shouldn't be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option will apply in both modes."),
REPAIRER_EXTRA_WHITELIST("Item Repairer Extra Whitelist", ConfigCategories.MACHINE_VALUES, new String[]{"tconstruct:pickaxe", "tconstruct:shovel", "tconstruct:hatchet", "tconstruct:mattock", "tconstruct:broadsword", "tconstruct:longsword", "tconstruct:frypan", "tconstruct:battlesign", "tconstruct:hammer", "tconstruct:excavator", "tconstruct:lumberaxe", "tconstruct:cleaver"}, "By default, the Item Repairer only repairs items which are repairable in an anvil. Add an item's REGISTRY NAME here if you want it to be repairable."),
SPAWNER_CHANGER_BLACKLIST("Spawner Changer Blacklist", ConfigCategories.OTHER, new String[]{"VillagerGolem"}, "By default, the Spawner Changer allows every living entity to be put into a spawner. If there is one that shouldn't be able to, put its MAPPING NAME here.");
public final String name;
public final String category;
public final String[] defaultValue;
public final String desc;
public String[] currentValue;
ConfigStringListValues(String name, ConfigCategories category, String[] defaultValue, String desc){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
this.desc = desc;
}
public String[] getValue(){
return this.currentValue;
}
}

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.*;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
@ -572,7 +573,7 @@ public class ItemCrafting{
}
private static boolean isBlacklisted(Item item){
for(String except : ConfigValues.mashedFoodCraftingExceptions){
for(String except : ConfigStringListValues.MASHED_FOOD_CRAFTING_EXCEPTIONS.getValue()){
if(item.getRegistryName().toString().equals(except)){
return true;
}

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
@ -34,7 +35,7 @@ public class WorldDecorationEvent{
@SubscribeEvent
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.getWorld().provider.getDimension()) < 0){
if(Util.arrayContains(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue(), event.getWorld().provider.getDimension()) < 0){
this.generateRice(event);
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event);

View file

@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
@ -48,7 +49,7 @@ public class OreGen implements IWorldGenerator{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
int dimension = world.provider.getDimension();
if(dimension != -1 && dimension != 1){
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), world.provider.getDimension()) < 0){
this.generateDefault(world, random, chunkX*16, chunkZ*16);
}
}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
@ -77,7 +78,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{
private boolean hasExtraWhitelist(Block block){
String name = block.getRegistryName().toString();
if(name != null){
for(String list : ConfigValues.paxelExtraMiningWhitelist){
for(String list : ConfigStringListValues.PAXEL_EXTRA_MINING_WHITELIST.getValue()){
if(list.equals(name)){
return true;
}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
@ -55,7 +56,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{
}
//Set New Block
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
world.playEvent(2001, pos, Block.getStateId(world.getBlockState(pos)));
}
PosUtil.setBlock(pos, world, InitBlocks.blockGiantChest, 0, 2);

View file

@ -15,6 +15,7 @@ import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
@ -502,7 +503,7 @@ public class ItemDrill extends ItemEnergy{
private boolean hasExtraWhitelist(Block block){
String name = block.getRegistryName().toString();
if(name != null){
for(String list : ConfigValues.drillExtraMiningWhitelist){
for(String list : ConfigStringListValues.DRILL_EXTRA_MINING_WHITELIST.getValue()){
if(list.equals(name)){
return true;
}

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block;
@ -75,7 +76,7 @@ public class ItemLeafBlower extends ItemBase{
//Breaks the Blocks
this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
//Plays a Minecart sounds (It really sounds like a Leaf Blower!)
if(!ConfigValues.lessSound){
if(!ConfigBoolValues.LESS_SOUND.isEnabled()){
player.worldObj.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_MINECART_RIDING, SoundCategory.PLAYERS, 0.3F, 0.001F);
}
}
@ -119,7 +120,7 @@ public class ItemLeafBlower extends ItemBase{
drops.addAll(theBlock.getDrops(world, theCoord, world.getBlockState(theCoord), 0));
//Plays the Breaking Sound
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
world.playEvent(2001, theCoord, Block.getStateId(world.getBlockState(theCoord)));
}

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
@ -95,7 +96,7 @@ public class ItemSpawnerChanger extends ItemBase{
if(!(entity instanceof EntityPlayer)){
String entityName = EntityList.getEntityString(entity);
if(entityName != null && !entityName.isEmpty()){
for(String name : ConfigValues.spawnerChangerBlacklist){
for(String name : ConfigStringListValues.SPAWNER_CHANGER_BLACKLIST.getValue()){
if(entityName.equals(name)){
return false;
}

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block;
@ -135,7 +136,7 @@ public class MethodHandler implements IMethodHandler{
if(outputs != null && !outputs.isEmpty()){
ItemStack output = outputs.get(0);
if(output.getItem() instanceof ItemBlock){
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
tile.getWorldObject().playEvent(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos)));
}
PosUtil.setBlock(pos, tile.getWorldObject(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2);

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.recipe;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.ItemStack;
@ -63,7 +64,7 @@ public class CrusherRecipeRegistry{
}
private static boolean hasException(String ore){
for(String conf : ConfigValues.crusherRecipeExceptions){
for(String conf : ConfigStringListValues.CRUSHER_RECIPE_EXCEPTIONS.getValue()){
if(conf.equals(ore)){
return true;
}

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
@ -46,10 +47,10 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
public static void shootLaser(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens){
if(!ConfigValues.lessSound){
if(!ConfigBoolValues.LESS_SOUND.isEnabled()){
world.playSound(null, startX, startY, startZ, SoundHandler.reconstructor, SoundCategory.BLOCKS, 0.35F, 1.0F);
}
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), ConfigValues.lessParticles ? 2 : 8, 2F), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 64));
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 2 : 8, 2F), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 64));
}
@Override

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
@ -90,7 +91,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
if(Util.RANDOM.nextFloat() <= chance){
if(WorldUtil.addToInventory(this, drops, false, true)){
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(stateToBreak));
}
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.pos);

View file

@ -14,6 +14,7 @@ import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
@ -141,7 +142,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
if(!this.worldObj.isRemote){
if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){
if(this.storage.getEnergyStored() >= ENERGY_USED){
if(this.brewTime%30 == 0 && !ConfigValues.lessSound){
if(this.brewTime%30 == 0 && !ConfigBoolValues.LESS_SOUND.isEnabled()){
this.worldObj.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.35F, 1.0F);
}

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
@ -92,7 +93,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
if(Util.RANDOM.nextFloat() <= chance){
if(WorldUtil.addToInventory(this, drops, false, true)){
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(this.worldObj.getBlockState(coordsBlock)));
}
WorldUtil.breakBlockAtSide(sideToManipulate, this.worldObj, this.getPos(), i);

View file

@ -14,6 +14,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
@ -159,7 +160,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
this.lastSecondCrush = this.secondCrushTime;
}
if(shouldPlaySound && !ConfigValues.lessSound){
if(shouldPlaySound && !ConfigBoolValues.LESS_SOUND.isEnabled()){
this.worldObj.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.25F, 1.0F);
}
}

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -43,7 +44,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
else{
String reg = item.getRegistryName().toString();
if(reg != null){
for(String strg : ConfigValues.repairerExtraWhitelist){
for(String strg : ConfigStringListValues.REPAIRER_EXTRA_WHITELIST.getValue()){
if(reg.equals(strg)){
return true;
}

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
@ -77,13 +78,13 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{
@SideOnly(Side.CLIENT)
public void renderParticles(){
if(Util.RANDOM.nextInt(ConfigValues.lessParticles ? 16 : 8) == 0){
if(Util.RANDOM.nextInt(ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 16 : 8) == 0){
BlockPos thisPos = this.pos;
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getNetworkFor(thisPos, this.worldObj);
if(network != null){
for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){
if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){
PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigValues.lessParticles ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, this.isItem ? COLOR_ITEM : COLOR, 1F);
PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, this.isItem ? COLOR_ITEM : COLOR, 1F);
}
}
}

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyProvider;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
@ -82,7 +83,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
Collections.shuffle(breakPositions);
BlockPos theCoord = breakPositions.get(0);
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
this.worldObj.playEvent(2001, theCoord, Block.getStateId(this.worldObj.getBlockState(theCoord)));
}
@ -90,7 +91,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
this.storage.receiveEnergy(ENERGY_PRODUCED, false);
if(!ConfigValues.lessParticles){
if(!ConfigBoolValues.LESS_PARTICLES.isEnabled()){
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 64));
}
}

View file

@ -13,6 +13,8 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
@ -107,7 +109,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
if(Util.RANDOM.nextFloat() <= chance){
if(WorldUtil.addToInventory(this, drops, false, true)){
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
this.worldObj.playEvent(2001, pos, Block.getStateId(this.worldObj.getBlockState(pos)));
}
this.worldObj.setBlockToAir(pos);
@ -148,7 +150,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
String reg = block.getRegistryName().toString();
if(!reg.isEmpty()){
for(String string : ConfigValues.minerExtraWhitelist){
for(String string : ConfigStringListValues.MINER_EXTRA_WHITELIST.getValue()){
if(reg.equals(string)){
return true;
}
@ -162,7 +164,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
}
private void shootParticles(int endX, int endY, int endZ){
if(!ConfigValues.lessParticles){
if(!ConfigBoolValues.LESS_PARTICLES.isEnabled()){
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96));
}
}
@ -170,7 +172,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
private boolean isBlacklisted(Block block){
String reg = block.getRegistryName().toString();
if(!reg.isEmpty()){
for(String string : ConfigValues.minerBlacklist){
for(String string : ConfigStringListValues.MINER_BLACKLIST.getValue()){
if(reg.equals(string)){
return true;
}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
@ -130,7 +131,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
drops.addAll(blockToBreak.getDrops(this.worldObj, this.boundPosition, this.worldObj.getBlockState(this.boundPosition), 0));
if(WorldUtil.addToInventory(this, drops, false, true)){
if(!ConfigValues.lessBlockBreakingEffects){
if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
this.worldObj.playEvent(2001, this.boundPosition, Block.getStateId(this.worldObj.getBlockState(this.boundPosition)));
}
this.worldObj.setBlockToAir(this.boundPosition);