begin work on ingame config

This commit is contained in:
asiekierka 2015-04-02 14:46:57 +02:00
parent 341f311ab6
commit d6f5063c42
24 changed files with 534 additions and 245 deletions

View file

@ -56,6 +56,46 @@ color.red=Red
color.white=White
color.yellow=Yellow
config.general=General
config.general.pipes=Pipes
config.blueprints=Blueprints
config.power=Power Usage
config.display=Display
config.worldgen=World Generation
config.network=Networking
config.buildcraft=BuildCraft Configuration
config.blueprints.clientDatabaseDirectory=Client directory
config.blueprints.excludedMods=Excluded mods
config.blueprints.excludedBlocks=Excluded blocks
config.display.colorBlindMode=Colorblind mode
config.display.hideFluidValues=Hide fluid numbers
config.display.hidePowerValues=Hide power numbers
config.general.pumpsConsumeWater=Pumps consume water
config.general.updateCheck=Check for updates
config.general.itemLifespan=Item lifespan (seconds)
config.general.canEnginesExplode=Engines explode
config.general.oilCanBurn=Burning oil
config.general.oilIsDense=Dense oil
config.general.quarry=Quarry Options
config.general.quarry.oneTimeUse=One-time use
config.general.quarry.doChunkLoading=Automatic chunk loading
config.general.miningDepth=Maximum relative mining depth
config.general.pumpDimensionControl=Pump dimension control
config.network.longUpdateFactor=Client synchronization factor (ticks)
config.network.updateFactor=Packet sending factor (ticks)
config.power.miningUsageMultiplier=Mining usage multiplier
config.power.chipsetCostMultiplier=Chipset cost multiplier
config.worldgen.enable=Enable
config.worldgen.oilWellGenerationRate=Oil well generation rate
config.worldgen.spawnOilSprings=Spawn oil springs
direction.north=North
direction.west=West
direction.east=East

View file

@ -0,0 +1,17 @@
Eveyrthing from BuildCraft 6.4.6, and:
Additions:
* Modularization is actually released this time, after some bugfixes.
* Facade recipes are now available without Silicon (asie)
* Laser beams now need heat-up time to become blue (asie)
* Comparator suppport for BuildCraft tanks (asie)
Improvements:
* [#2599] Stripes pipes don't move forward when using a non-item pipe (asie)
* [#2567] Emzuli Pipes support lists now (asie)
* Robot particle frequency is affected by Minecraft graphics settings (asie)
Bugfixes:
* [#2603} Assembly Table crashes without Robotics (asie)
* [#2602] NPE when comparing two StatementSlots (asie)
* Fixes to Fancy pipe connection rendering (asie)

View file

@ -100,5 +100,22 @@
"dependencies": [
"mod_MinecraftForge"
]
},
{
"modid": "BuildCraft|Robotics",
"name": "BC Robotics",
"version": "$version",
"mcversion": "$mcversion",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Transport Component)",
"credits": "Created by SpaceToad",
"logoFile": "assets/buildcraft/logo.png",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authorList": [ "SpaceToad", "BuildCraft Team" ],
"parent": "BuildCraft|Core",
"screenshots": [],
"dependencies": [
"mod_MinecraftForge"
]
}
]

View file

@ -25,6 +25,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.stats.Achievement;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
@ -39,7 +41,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.api.blueprints.BlueprintDeployer;
import buildcraft.api.blueprints.BuilderAPI;
@ -137,6 +138,7 @@ import buildcraft.core.builders.schematics.SchematicRotateMeta;
import buildcraft.core.builders.schematics.SchematicStandalone;
import buildcraft.core.builders.schematics.SchematicTileCreative;
import buildcraft.core.builders.schematics.SchematicWallSide;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.proxy.CoreProxy;
@Mod(name = "BuildCraft Builders", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE)
@ -168,53 +170,66 @@ public class BuildCraftBuilders extends BuildCraftMod {
public static boolean debugPrintSchematicList = false;
public static boolean dropBrokenBlocks = false;
private String blueprintServerDir;
private String blueprintLibraryOutput;
private String[] blueprintLibraryInput;
private String blueprintServerDir, blueprintClientDir;
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
blueprintServerDir = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL,
"blueprints.serverDir",
BuildCraftCore.mainConfigManager.register("blueprints.serverDatabaseDirectory",
"\"$MINECRAFT" + File.separator + "config" + File.separator + "buildcraft" + File.separator
+ "blueprints" + File.separator + "server\"").getString();
+ "blueprints" + File.separator + "server\"",
"Location for the server blueprint database (used by all blueprint items).", ConfigManager.RestartRequirement.WORLD);
BuildCraftCore.mainConfigManager.register("blueprints.clientDatabaseDirectory",
"\"$MINECRAFT" + File.separator + "blueprints\"",
"Location for the client blueprint database (used by the Electronic Library).", ConfigManager.RestartRequirement.NONE);
blueprintLibraryOutput = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL,
"blueprints.libraryOutput", "\"$MINECRAFT" + File.separator + "blueprints\"").getString();
BuildCraftCore.mainConfigManager.register("general.markerRange", 64, "Set the maximum marker range.", ConfigManager.RestartRequirement.NONE);
blueprintLibraryInput = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL,
"blueprints.libraryInput", new String []
{
// expected location
"\"$MINECRAFT" + File.separator + "blueprints\"",
// legacy beta BuildCraft
"\"$MINECRAFT" + File.separator + "config" + File.separator + "buildcraft" + File.separator
+ "blueprints" + File.separator + "client\"",
// inferred user download location
"\"" + getDownloadsDir() + "\""
}
).getStringList().clone();
BuildCraftCore.mainConfigManager.get("blueprints.serverDatabaseDirectory").setShowInGui(false);
BuildCraftCore.mainConfigManager.get("general.markerRange").setMinValue(8).setMaxValue(64);
blueprintServerDir = JavaTools.stripSurroundingQuotes(replacePathVariables(blueprintServerDir));
blueprintLibraryOutput = JavaTools.stripSurroundingQuotes(replacePathVariables(blueprintLibraryOutput));
serverDB = new BlueprintServerDatabase();
clientDB = new LibraryDatabase();
for (int i = 0; i < blueprintLibraryInput.length; ++i) {
blueprintLibraryInput[i] = JavaTools.stripSurroundingQuotes(replacePathVariables(blueprintLibraryInput[i]));
}
reloadConfig(ConfigManager.RestartRequirement.GAME);
// TODO
//Property dropBlock = BuildCraftCore.mainConfiguration.get("general", "builder.dropBrokenBlocks", false, "set to true to force the builder to drop broken blocks");
//dropBrokenBlocks = dropBlock.getBoolean(false);
Property markerRange = BuildCraftCore.mainConfiguration.get("general", "marker.range", 64, "Set the default marker range. Setting it too high might cause lag and general weirdness, so watch out!");
markerRange.setMinValue(8);
markerRange.setMaxValue(64);
DefaultProps.MARKER_RANGE = markerRange.getInt();
Property printSchematicList = BuildCraftCore.mainConfiguration.get("debug", "blueprints.printSchematicList", false);
Property printSchematicList = BuildCraftCore.mainConfiguration.get("debug", "printBlueprintSchematicList", false);
debugPrintSchematicList = printSchematicList.getBoolean();
}
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
public void reloadConfig(ConfigManager.RestartRequirement restartType) {
if (restartType == ConfigManager.RestartRequirement.GAME) {
reloadConfig(ConfigManager.RestartRequirement.WORLD);
} else if (restartType == ConfigManager.RestartRequirement.WORLD) {
blueprintServerDir = BuildCraftCore.mainConfigManager.get("blueprints.serverDatabaseDirectory").getString();
blueprintServerDir = JavaTools.stripSurroundingQuotes(replacePathVariables(blueprintServerDir));
serverDB.init(new String[] {blueprintServerDir}, blueprintServerDir);
reloadConfig(ConfigManager.RestartRequirement.NONE);
} else {
blueprintClientDir = BuildCraftCore.mainConfigManager.get("blueprints.clientDatabaseDirectory").getString();
blueprintClientDir = JavaTools.stripSurroundingQuotes(replacePathVariables(blueprintClientDir));
clientDB.init(new String[] {
blueprintClientDir,
getDownloadsDir()
}, blueprintClientDir);
DefaultProps.MARKER_RANGE = BuildCraftCore.mainConfigManager.get("general.markerRange").getInt();
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
}
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.PostConfigChangedEvent event) {
if ("BuildCraft|Core".equals(event.modID)) {
reloadConfig(event.isWorldRunning ? ConfigManager.RestartRequirement.NONE : ConfigManager.RestartRequirement.WORLD);
}
}
@ -267,12 +282,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
public void postInit(FMLPostInitializationEvent evt) {
HeuristicBlockDetection.start();
serverDB = new BlueprintServerDatabase();
clientDB = new LibraryDatabase();
serverDB.init(new String[] {blueprintServerDir}, blueprintServerDir);
clientDB.init(blueprintLibraryInput, blueprintLibraryOutput);
if (debugPrintSchematicList) {
try {
PrintWriter writer = new PrintWriter("SchematicDebug.txt", "UTF-8");
@ -526,6 +535,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
}
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
// Create filler registry
try {

View file

@ -12,7 +12,6 @@ import java.io.File;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.HashSet;
import java.util.UUID;
import com.mojang.authlib.GameProfile;
import org.lwjgl.input.Mouse;
@ -28,6 +27,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.IIcon;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@ -43,7 +43,6 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.oredict.OreDictionary;
@ -53,7 +52,6 @@ import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.EnumColor;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.core.IWorldProperty;
import buildcraft.api.core.JavaTools;
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
import buildcraft.api.statements.IActionExternal;
import buildcraft.api.statements.IActionInternal;
@ -68,7 +66,7 @@ import buildcraft.core.BCCreativeTab;
import buildcraft.core.BlockBuildTool;
import buildcraft.core.BlockEngine;
import buildcraft.core.BlockSpring;
import buildcraft.core.BuildCraftConfiguration;
import buildcraft.core.config.BuildCraftConfiguration;
import buildcraft.core.CommandBuildCraft;
import buildcraft.core.CompatHooks;
import buildcraft.core.CoreGuiHandler;
@ -88,6 +86,7 @@ import buildcraft.core.TickHandlerCore;
import buildcraft.core.TileEngineWood;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.engines.ItemEngine;
import buildcraft.core.lib.engines.TileEngineBase;
import buildcraft.core.lib.network.ChannelHandler;
@ -123,7 +122,7 @@ import buildcraft.core.statements.TriggerInventoryLevel;
import buildcraft.core.statements.TriggerMachine;
import buildcraft.core.statements.TriggerRedstoneInput;
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.7.10,1.8)", dependencies = "required-after:Forge@[10.13.2.1236,)")
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.7.10,1.8)", dependencies = "required-after:Forge@[10.13.2.1236,)", guiFactory = "buildcraft.core.config.ConfigManager")
public class BuildCraftCore extends BuildCraftMod {
@Mod.Instance("BuildCraft|Core")
public static BuildCraftCore instance;
@ -145,6 +144,7 @@ public class BuildCraftCore extends BuildCraftMod {
public static int updateFactor = 10;
public static long longUpdateFactor = 40;
public static BuildCraftConfiguration mainConfiguration;
public static ConfigManager mainConfigManager;
public static BlockEngine engineBlock;
public static Block springBlock;
@ -210,8 +210,6 @@ public class BuildCraftCore extends BuildCraftMod {
public static Achievement wrenchAchievement;
public static Achievement engineRedstoneAchievement;
public static HashSet<String> recipesBlacklist = new HashSet<String>();
public static float diffX, diffY, diffZ;
public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("buildcraft.core".getBytes()), "[BuildCraft]");
@ -235,40 +233,31 @@ public class BuildCraftCore extends BuildCraftMod {
BuilderAPI.schematicRegistry = SchematicRegistry.INSTANCE;
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.cfg"));
mainConfigManager = new ConfigManager(mainConfiguration);
try {
mainConfiguration.load();
Property updateCheck = BuildCraftCore.mainConfiguration.get("general", "update.check", true);
updateCheck.comment = "set to true for version check on startup";
if (updateCheck.getBoolean(true)) {
Version.check();
}
mainConfigManager.getCat("debug").setShowInGui(false);
mainConfigManager.getCat("vars").setShowInGui(false);
Property hideRFNumbers = BuildCraftCore.mainConfiguration.get("general", "hidePowerNumbers", false);
hideRFNumbers.comment = "set to true to not display any RF or RF/t numbers.";
hidePowerNumbers = hideRFNumbers.getBoolean(false);
Property hideMBNumbers = BuildCraftCore.mainConfiguration.get("general", "hideFluidNumbers", false);
hideMBNumbers.comment = "set to true to not display any mB or mB/t numbers.";
hideFluidNumbers = hideMBNumbers.getBoolean(false);
mainConfigManager.register("general.updateCheck", true, "Should I check the BuildCraft version on startup?", ConfigManager.RestartRequirement.NONE);
mainConfigManager.register("display.hidePowerValues", false, "Should all power values (RF, RF/t) be hidden?", ConfigManager.RestartRequirement.NONE);
mainConfigManager.register("display.hideFluidValues", false, "Should all fluid values (mB, mB/t) be hidden?", ConfigManager.RestartRequirement.NONE);
mainConfigManager.register("general.itemLifespan", 60, "How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60)", ConfigManager.RestartRequirement.NONE)
.setMinValue(5);
mainConfigManager.register("network.updateFactor", 10, "How often, in ticks, should network update packets be sent? Increasing this might help network performance.", ConfigManager.RestartRequirement.GAME)
.setMinValue(1);
mainConfigManager.register("network.longUpdateFactor", 40, "How often, in ticks, should full network sync packets be sent? Increasing this might help network performance.", ConfigManager.RestartRequirement.GAME)
.setMinValue(1);
mainConfigManager.register("general.canEnginesExplode", false, "Should engines explode upon overheat?", ConfigManager.RestartRequirement.NONE);
mainConfigManager.register("worldgen.enable", true, "Should BuildCraft generate anything in the world?", ConfigManager.RestartRequirement.GAME);
mainConfigManager.register("general.pumpsConsumeWater", false, "Should pumps consume water? Enabling this might cause performance issues!", ConfigManager.RestartRequirement.NONE);
mainConfigManager.register("power.miningUsageMultiplier", 1.0D, "What should the multiplier of all mining-related power usage be?", ConfigManager.RestartRequirement.NONE);
mainConfigManager.register("display.colorBlindMode", false, "Should I enable colorblind mode?", ConfigManager.RestartRequirement.GAME);
mainConfigManager.register("worldgen.generateWaterSprings", true, "Should BuildCraft generate water springs?", ConfigManager.RestartRequirement.GAME);
Property lifespan = BuildCraftCore.mainConfiguration.get("general", "itemLifespan", itemLifespan);
lifespan.comment = "the lifespan in ticks of items dropped on the ground by pipes and machines, vanilla = 6000, default = 1200";
itemLifespan = lifespan.getInt(itemLifespan);
if (itemLifespan < 100) {
itemLifespan = 100;
}
Property factor = BuildCraftCore.mainConfiguration.get("general", "network.updateFactor", 10);
factor.comment = "increasing this number will decrease network update frequency, useful for overloaded servers";
updateFactor = factor.getInt(10);
Property longFactor = BuildCraftCore.mainConfiguration.get("general", "network.stateRefreshPeriod", 40);
longFactor.comment = "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization.";
longUpdateFactor = longFactor.getInt(40);
canEnginesExplode = BuildCraftCore.mainConfiguration.get("general", "enginesExplode", false, "Do engines explode upon overheat?").getBoolean(false);
reloadConfig(ConfigManager.RestartRequirement.GAME);
wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem");
CoreProxy.proxy.registerItem(wrenchItem);
@ -282,22 +271,12 @@ public class BuildCraftCore extends BuildCraftMod {
debuggerItem = (ItemDebugger) ((new ItemDebugger())).setUnlocalizedName("debugger");
CoreProxy.proxy.registerItem(debuggerItem);
Property modifyWorldProp = BuildCraftCore.mainConfiguration.get("general", "modifyWorld", true);
modifyWorldProp.comment = "set to false if BuildCraft should not generate custom blocks (e.g. oil)";
modifyWorld = modifyWorldProp.getBoolean(true);
if (BuildCraftCore.modifyWorld) {
BlockSpring.EnumSpring.WATER.canGen = BuildCraftCore.mainConfiguration.get("worldgen", "waterSpring", true).getBoolean(true);
BlockSpring.EnumSpring.WATER.canGen = BuildCraftCore.mainConfigManager.get("worldgen.generateWaterSprings").getBoolean();
springBlock = new BlockSpring().setBlockName("eternalSpring");
CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class);
}
Property consumeWater = BuildCraftCore.mainConfiguration.get("general", "consumeWater", consumeWaterSources);
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
consumeWater.comment = "set to true if the Pump should consume water";
miningMultiplier = BuildCraftCore.mainConfiguration.getFloat("general", "mining.cost.multipler", 1F, 1F, 10F, "cost multiplier for mining operations, range (1.0 - 10.0)\nhigh values may render engines incapable of powering machines directly");
woodenGearItem = (new ItemGear()).setUnlocalizedName("woodenGearItem");
CoreProxy.proxy.registerItem(woodenGearItem);
OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
@ -330,12 +309,10 @@ public class BuildCraftCore extends BuildCraftMod {
engineBlock.registerTile((Class<? extends TileEngineBase>) CompatHooks.INSTANCE.getTile(TileEngineWood.class), "tile.engineWood");
CoreProxy.proxy.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood");
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
} finally {
if (mainConfiguration.hasChanged()) {
mainConfiguration.save();
}
}
}
@ -372,11 +349,6 @@ public class BuildCraftCore extends BuildCraftMod {
MinecraftForge.EVENT_BUS.register(new SpringPopulate());
}
for (String l : BuildCraftCore.mainConfiguration.get("general",
"recipesBlacklist", new String[0]).getStringList()) {
recipesBlacklist.add(JavaTools.stripSurroundingQuotes(l.trim()));
}
if (mainConfiguration.hasChanged()) {
mainConfiguration.save();
}
@ -454,7 +426,42 @@ public class BuildCraftCore extends BuildCraftMod {
BuildCraftCore.stripesLaserTexture = event.map.registerIcon("buildcraftcore:laserBox/blockStripesLaser");
BuildCraftCore.transparentTexture = event.map.registerIcon("buildcraftcore:misc/transparent");
}
}
public void reloadConfig(ConfigManager.RestartRequirement restartType) {
if (restartType == ConfigManager.RestartRequirement.GAME) {
modifyWorld = mainConfigManager.get("worldgen.enable").getBoolean();
updateFactor = mainConfigManager.get("network.updateFactor").getInt();
longUpdateFactor = mainConfigManager.get("network.longUpdateFactor").getInt();
colorBlindMode = mainConfigManager.get("display.colorBlindMode").getBoolean();
reloadConfig(ConfigManager.RestartRequirement.WORLD);
} else if (restartType == ConfigManager.RestartRequirement.WORLD) {
reloadConfig(ConfigManager.RestartRequirement.NONE);
} else {
hideFluidNumbers = mainConfigManager.get("display.hideFluidValues").getBoolean();
hidePowerNumbers = mainConfigManager.get("display.hidePowerValues").getBoolean();
itemLifespan = mainConfigManager.get("general.itemLifespan").getInt();
canEnginesExplode = mainConfigManager.get("general.canEnginesExplode").getBoolean();
consumeWaterSources = mainConfigManager.get("general.pumpsConsumeWater").getBoolean();
miningMultiplier = (float) mainConfigManager.get("power.miningUsageMultiplier").getDouble();
if (mainConfigManager.get("general.updateCheck").getBoolean(true)) {
Version.check();
}
if (mainConfiguration.hasChanged()) {
mainConfiguration.save();
}
}
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if ("BuildCraft|Core".equals(event.modID)) {
reloadConfig(event.isWorldRunning ? ConfigManager.RestartRequirement.NONE : ConfigManager.RestartRequirement.WORLD);
}
}
public void loadRecipes() {

View file

@ -19,6 +19,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
@ -50,6 +52,7 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.lib.block.BlockBuildCraftFluid;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.engines.TileEngineBase;
import buildcraft.core.lib.engines.TileEngineBase.EnergyStage;
import buildcraft.core.lib.network.ChannelHandler;
@ -109,37 +112,36 @@ public class BuildCraftEnergy extends BuildCraftMod {
private static Fluid buildcraftFluidFuel;
private static Fluid buildcraftFluidRedPlasma;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
BuildcraftFuelRegistry.fuel = FuelManager.INSTANCE;
BuildcraftFuelRegistry.coolant = CoolantManager.INSTANCE;
int oilDesertBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilDesert", DefaultProps.BIOME_OIL_DESERT).getInt(DefaultProps.BIOME_OIL_DESERT);
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
canOilBurn = BuildCraftCore.mainConfiguration.get("general", "burnOil", true, "Can oil burn?").getBoolean(true);
isOilDense = BuildCraftCore.mainConfiguration.get("general", "denseOil", true, "Should it be hard to swim in oil?").getBoolean(true);
oilWellScalar = BuildCraftCore.mainConfiguration.get("general", "oilWellGenerationRate", 1.0, "Probability of oil well generation").getDouble(1.0);
int oilDesertBiomeId = BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", DefaultProps.BIOME_OIL_DESERT).getInt(DefaultProps.BIOME_OIL_DESERT);
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
BuildCraftCore.mainConfigManager.register("worldgen.spawnOilSprings", true, "Should I spawn oil springs?", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfigManager.register("worldgen.oilWellGenerationRate", 1.0D, "How high should be the probability of an oil well generating?", ConfigManager.RestartRequirement.NONE);
setBiomeList(
OilPopulate.INSTANCE.surfaceDepositBiomes,
BuildCraftCore.mainConfiguration
.get("general", "oil.increasedBiomeIDs",
.get("worldgen.biomes", "increasedOilIDs",
new String[] {BiomeDictionary.Type.SANDY.toString(), BiomeGenBase.taiga.biomeName},
"IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that should have increased oil generation rates."));
setBiomeList(
OilPopulate.INSTANCE.excessiveBiomes,
BuildCraftCore.mainConfiguration
.get("general",
"oil.excessiveBiomeIDs",
.get("worldgen.biomes",
"excessiveOilIDs",
new String[] {},
"IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that should have GREATLY increased oil generation rates."));
setBiomeList(OilPopulate.INSTANCE.excludedBiomes,
BuildCraftCore.mainConfiguration
.get("general", "oil.excludeBiomeIDs",
new String[] {BiomeGenBase.sky.biomeName, BiomeGenBase.hell.biomeName},
.get("worldgen.biomes", "excludeOilIDs",
new String[]{BiomeGenBase.sky.biomeName, BiomeGenBase.hell.biomeName},
"IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that are excluded from generating oil."));
double fuelLavaMultiplier = BuildCraftCore.mainConfiguration.get("general", "fuel.lava.combustion", 1.0F, "adjust energy value of Lava in Combustion Engines").getDouble(1.0F);
@ -156,7 +158,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
if (BiomeGenBase.getBiomeGenArray()[oilDesertBiomeId] != null) {
oilDesertBiomeId = findUnusedBiomeID("oilDesert");
// save changes to config file
BuildCraftCore.mainConfiguration.get("biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId);
BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId);
BuildCraftCore.mainConfiguration.save();
}
biomeOilDesert = BiomeGenOilDesert.makeBiome(oilDesertBiomeId);
@ -166,7 +168,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
if (BiomeGenBase.getBiomeGenArray()[oilOceanBiomeId] != null) {
oilOceanBiomeId = findUnusedBiomeID("oilOcean");
// save changes to config file
BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId);
BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId);
BuildCraftCore.mainConfiguration.save();
}
biomeOilOcean = BiomeGenOilOcean.makeBiome(oilOceanBiomeId);
@ -198,16 +200,21 @@ public class BuildCraftEnergy extends BuildCraftMod {
fluidRedPlasma = FluidRegistry.getFluid("redplasma");
if (fluidOil.getBlock() == null) {
blockOil = new BlockBuildCraftFluid(fluidOil, Material.water, MapColor.blackColor).setFlammable(canOilBurn).setFlammability(0).setDense(isOilDense);
blockOil = new BlockBuildCraftFluid(fluidOil, Material.water, MapColor.blackColor).setFlammability(0);
blockOil.setBlockName("blockOil").setLightOpacity(8);
CoreProxy.proxy.registerBlock(blockOil);
fluidOil.setBlock(blockOil);
BuildCraftCore.mainConfigManager.register("general.oilCanBurn", true, "Should oil burn when lit on fire?", ConfigManager.RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.register("general.oilIsDense", true, "Should oil be dense and drag entities down?", ConfigManager.RestartRequirement.NONE);
} else {
blockOil = fluidOil.getBlock();
}
reloadConfig(ConfigManager.RestartRequirement.GAME);
if (blockOil != null) {
spawnOilSprings = BuildCraftCore.mainConfiguration.get("worldgen", "oilSprings", true).getBoolean(true);
spawnOilSprings = BuildCraftCore.mainConfigManager.get("worldgen.spawnOilSprings").getBoolean(true);
BlockSpring.EnumSpring.OIL.canGen = spawnOilSprings;
BlockSpring.EnumSpring.OIL.liquidBlock = blockOil;
}
@ -281,9 +288,37 @@ public class BuildCraftEnergy extends BuildCraftMod {
InterModComms.registerHandler(new IMCHandlerEnergy());
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
}
public void reloadConfig(ConfigManager.RestartRequirement restartType) {
if (restartType == ConfigManager.RestartRequirement.GAME) {
reloadConfig(ConfigManager.RestartRequirement.WORLD);
} else if (restartType == ConfigManager.RestartRequirement.WORLD) {
reloadConfig(ConfigManager.RestartRequirement.NONE);
} else {
oilWellScalar = BuildCraftCore.mainConfigManager.get("worldgen.oilWellGenerationRate").getDouble();
if (blockOil instanceof BlockBuildCraftFluid) {
canOilBurn = BuildCraftCore.mainConfigManager.get("general.oilCanBurn").getBoolean();
isOilDense = BuildCraftCore.mainConfigManager.get("general.oilIsDense").getBoolean();
((BlockBuildCraftFluid) blockOil).setFlammable(canOilBurn).setDense(isOilDense);
}
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
}
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.PostConfigChangedEvent event) {
if ("BuildCraft|Core".equals(event.modID)) {
reloadConfig(event.isWorldRunning ? ConfigManager.RestartRequirement.NONE : ConfigManager.RestartRequirement.WORLD);
}
}
private void setBiomeList(Set<Integer> list, Property configuration) {
for (String id : configuration.getStringList()) {
String strippedId = JavaTools.stripSurroundingQuotes(id.trim());

View file

@ -17,6 +17,8 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.world.World;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
@ -30,7 +32,6 @@ import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.SchematicTile;
import buildcraft.core.CompatHooks;
@ -38,9 +39,9 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.builders.schematics.SchematicIgnoreMeta;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.network.ChannelHandler;
import buildcraft.core.lib.network.PacketHandler;
import buildcraft.core.lib.utils.ConfigUtils;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.factory.BlockAutoWorkbench;
import buildcraft.factory.BlockFloodGate;
@ -92,18 +93,14 @@ public class BuildCraftFactory extends BuildCraftMod {
public static Achievement refineAndRedefineAchievement;
public static boolean quarryLoadsChunks = true;
public static boolean allowMining = true;
public static boolean quarryOneTimeUse = false;
public static float miningMultiplier = 1;
public static int miningDepth = 256;
public static PumpDimensionList pumpDimensionList;
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent evt) {
FactoryProxy.proxy.initializeNEIIntegration();
if (quarryLoadsChunks) {
ForgeChunkManager.setForcedChunkLoadingCallback(instance, new QuarryChunkloadCallback());
}
ForgeChunkManager.setForcedChunkLoadingCallback(instance, new QuarryChunkloadCallback());
}
public class QuarryChunkloadCallback implements ForgeChunkManager.OrderedLoadingCallback {
@ -181,24 +178,17 @@ public class BuildCraftFactory extends BuildCraftMod {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new ChannelHandler(), new PacketHandler());
ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, "general");
allowMining = genCat.get("mining.enabled", true, "disables the recipes for automated mining machines");
quarryOneTimeUse = genCat.get("quarry.one.time.use", false, "Quarry cannot be picked back up after placement");
miningDepth = genCat.get("mining.depth", 2, 256, 256, "how far below the machine can mining machines dig, range (2 - 256), default 256");
quarryLoadsChunks = genCat.get("quarry.loads.chunks", true, "Quarry loads chunks required for mining");
Property pumpList = BuildCraftCore.mainConfiguration.get("general", "pumping.controlList", DefaultProps.PUMP_DIMENSION_LIST);
pumpList.comment = "Allows admins to whitelist or blacklist pumping of specific fluids in specific dimensions.\n"
String plc = "Allows admins to whitelist or blacklist pumping of specific fluids in specific dimensions.\n"
+ "Eg. \"-/-1/Lava\" will disable lava in the nether. \"-/*/Lava\" will disable lava in any dimension. \"+/0/*\" will enable any fluid in the overworld.\n"
+ "Entries are comma seperated, banned fluids have precedence over allowed ones."
+ "Default is \"+/*/*,+/-1/Lava\" - the second redundant entry (\"+/-1/lava\") is there to show the format.";
pumpDimensionList = new PumpDimensionList(pumpList.getString());
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
BuildCraftCore.mainConfigManager.register("general.quarry.oneTimeUse", false, "Should the quarry only be usable once after placing?", ConfigManager.RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.register("general.miningDepth", 256, "Should the quarry only be usable once after placing?", ConfigManager.RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.register("general.quarry.doChunkLoading", true, "Should the quarry only be usable once after placing?", ConfigManager.RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.get("general.miningDepth").setMinValue(2).setMaxValue(256);
BuildCraftCore.mainConfigManager.register("general.pumpDimensionControl", DefaultProps.PUMP_DIMENSION_LIST, plc, ConfigManager.RestartRequirement.NONE);
miningWellBlock = (BlockMiningWell) CompatHooks.INSTANCE.getBlock(BlockMiningWell.class);
CoreProxy.proxy.registerBlock(miningWellBlock.setBlockName("miningWellBlock"));
@ -230,62 +220,48 @@ public class BuildCraftFactory extends BuildCraftMod {
hopperBlock = (BlockHopper) CompatHooks.INSTANCE.getBlock(BlockHopper.class);
CoreProxy.proxy.registerBlock(hopperBlock.setBlockName("blockHopper"));
FactoryProxy.proxy.initializeEntityRenders();
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
}
public static void loadRecipes() {
if (allowMining) {
if (miningWellBlock != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(miningWellBlock, 1),
"ipi",
"igi",
"iPi",
'p', "dustRedstone",
'i', "ingotIron",
'g', "gearIron",
'P', Items.iron_pickaxe);
}
if (quarryBlock != null) {
CoreProxy.proxy.addCraftingRecipe(
new ItemStack(quarryBlock),
"ipi",
"gig",
"dDd",
'i', "gearIron",
'p', "dustRedstone",
'g', "gearGold",
'd', "gearDiamond",
'D', Items.diamond_pickaxe);
}
if (pumpBlock != null && miningWellBlock != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock),
"T",
"W",
'T', tankBlock != null ? tankBlock : "blockGlass",
'W', miningWellBlock);
}
if (miningWellBlock != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(miningWellBlock, 1),
"ipi",
"igi",
"iPi",
'p', "dustRedstone",
'i', "ingotIron",
'g', "gearIron",
'P', Items.iron_pickaxe);
}
if (!allowMining || miningWellBlock == null) {
if (pumpBlock != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock),
"iri",
"iTi",
"gpg",
'r', "dustRedstone",
'i', "ingotIron",
'T', tankBlock != null ? tankBlock : "blockGlass",
'g', "gearIron",
'p', BuildCraftTransport.pipeFluidsGold);
}
if (quarryBlock != null) {
CoreProxy.proxy.addCraftingRecipe(
new ItemStack(quarryBlock),
"ipi",
"gig",
"dDd",
'i', "gearIron",
'p', "dustRedstone",
'g', "gearGold",
'd', "gearDiamond",
'D', Items.diamond_pickaxe);
}
if (pumpBlock != null) {
CoreProxy.proxy.addCraftingRecipe(
new ItemStack(pumpBlock),
"ipi",
"igi",
"TBT",
'p', "dustRedstone",
'i', "ingotIron",
'T', tankBlock,
'g', "gearIron",
'B', Items.bucket);
}
if (autoWorkbenchBlock != null) {
@ -343,6 +319,30 @@ public class BuildCraftFactory extends BuildCraftMod {
}
}
public void reloadConfig(ConfigManager.RestartRequirement restartType) {
if (restartType == ConfigManager.RestartRequirement.GAME) {
reloadConfig(ConfigManager.RestartRequirement.WORLD);
} else if (restartType == ConfigManager.RestartRequirement.WORLD) {
reloadConfig(ConfigManager.RestartRequirement.NONE);
} else {
quarryOneTimeUse = BuildCraftCore.mainConfigManager.get("general.quarry.oneTimeUse").getBoolean();
quarryLoadsChunks = BuildCraftCore.mainConfigManager.get("general.quarry.doChunkLoading").getBoolean();
miningDepth = BuildCraftCore.mainConfigManager.get("general.miningDepth").getInt();
pumpDimensionList = new PumpDimensionList(BuildCraftCore.mainConfigManager.get("general.pumpDimensionControl").getString());
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
}
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if ("BuildCraft|Core".equals(event.modID)) {
reloadConfig(event.isWorldRunning ? ConfigManager.RestartRequirement.NONE : ConfigManager.RestartRequirement.WORLD);
}
}
@Mod.EventHandler
public void processIMCRequests(FMLInterModComms.IMCEvent event) {
InterModComms.processIMC(event);

View file

@ -191,8 +191,6 @@ public class BuildCraftRobotics extends BuildCraftMod {
public static Achievement timeForSomeLogicAchievement;
public static Achievement tinglyLaserAchievement;
public static float chipsetCostMultiplier = 1.0F;
public static List<String> blacklistedRobots;
public static MapManager manager;
@ -202,8 +200,6 @@ public class BuildCraftRobotics extends BuildCraftMod {
public void preInit(FMLPreInitializationEvent evt) {
new BCCreativeTab("boards");
chipsetCostMultiplier = BuildCraftCore.mainConfiguration.getFloat("chipset.costMultiplier", "general", 1.0F, 0.001F, 1000.0F, "The multiplier for chipset recipe cost.");
blacklistedRobots = new ArrayList<String>();
blacklistedRobots.addAll(Arrays.asList(BuildCraftCore.mainConfiguration.get("general", "boards.blacklist", new String[]{}).getStringList()));

View file

@ -30,6 +30,7 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.builders.schematics.SchematicRotateMeta;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.items.ItemBuildCraft;
import buildcraft.core.lib.network.ChannelHandler;
import buildcraft.core.proxy.CoreProxy;
@ -66,9 +67,13 @@ public class BuildCraftSilicon extends BuildCraftMod {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
chipsetCostMultiplier = BuildCraftCore.mainConfiguration.getFloat("chipset.costMultiplier", "general", 1.0F, 0.001F, 1000.0F, "The multiplier for chipset recipe cost.");
BuildCraftCore.mainConfigManager.register("power.chipsetCostMultiplier", 1.0D, "The cost multiplier for Chipsets", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfiguration.save();
chipsetCostMultiplier = (float) BuildCraftCore.mainConfigManager.get("power.chipsetCostMultiplier").getDouble();
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
laserBlock = (BlockLaser) CompatHooks.INSTANCE.getBlock(BlockLaser.class);
laserBlock.setBlockName("laserBlock");

View file

@ -21,6 +21,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemMinecart;
import net.minecraft.item.ItemStack;
import net.minecraft.world.WorldServer;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
@ -65,6 +66,7 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.PowerMode;
import buildcraft.core.Version;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.items.ItemBuildCraft;
import buildcraft.core.lib.network.ChannelHandler;
import buildcraft.core.lib.utils.ColorUtils;
@ -243,7 +245,6 @@ public class BuildCraftTransport extends BuildCraftMod {
public static Item pipePowerEmerald;
public static Item pipePowerSandstone;
public static int groupItemsTrigger;
public static String[] facadeBlacklist;
public static ITriggerInternal triggerLightSensorBright, triggerLightSensorDark;
@ -292,30 +293,13 @@ public class BuildCraftTransport extends BuildCraftMod {
}
try {
Property durability = BuildCraftCore.mainConfiguration.get("general", "pipes.durability", DefaultProps.PIPES_DURABILITY);
durability.comment = "How long a pipe will take to break";
pipeDurability = (float) durability.getDouble(DefaultProps.PIPES_DURABILITY);
Property baseFlowRate = BuildCraftCore.mainConfiguration.get("general", "pipes.fluids.baseFlowRate", DefaultProps.PIPES_FLUIDS_BASE_FLOW_RATE);
pipeFluidsBaseFlowRate = baseFlowRate.getInt();
Property printFacadeList = BuildCraftCore.mainConfiguration.get("debug", "facades.printFacadeList", false);
debugPrintFacadeList = printFacadeList.getBoolean();
Property enableAdditionalWaterproofingRecipe = BuildCraftCore.mainConfiguration.get("general", "pipes.fluids.enableAdditionalWaterproofingRecipe", true);
enableAdditionalWaterproofingRecipe.comment = "Enable the slimeball based pipe waterproofing recipe";
additionalWaterproofingRecipe = enableAdditionalWaterproofingRecipe.getBoolean();
gateCostMultiplier = BuildCraftCore.mainConfiguration.getFloat("gate.recipeCostMultiplier", "general", 1.0F, 0.001F, 1000.0F, "The multiplier for gate recipe cost.");
filteredBufferBlock = new BlockFilteredBuffer();
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get("general", "pipes.groupItemsTrigger", 32);
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
groupItemsTrigger = groupItemsTriggerProp.getInt();
Property facadeBlacklistProp = BuildCraftCore.mainConfiguration.get("general", "facade.blacklist", new String[] {
BuildCraftCore.mainConfigManager.register("general.pipes.hardness", DefaultProps.PIPES_DURABILITY, "How hard to break should a pipe be?", ConfigManager.RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.register("general.pipes.baseFluidRate", DefaultProps.PIPES_FLUIDS_BASE_FLOW_RATE, "What should the base flow rate of a fluid pipe be?", ConfigManager.RestartRequirement.GAME)
.setMinValue(1).setMaxValue(40);
BuildCraftCore.mainConfigManager.register("debug.printFacadeList", false, "Print a list of all registered facades.", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfigManager.register("general.pipes.slimeballWaterproofRecipe", false, "Should I enable an alternate Waterproof recipe, based on slimeballs?", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfigManager.register("power.gateCostMultiplier", 1.0D, "What should be the multiplier of all gate power costs?", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfigManager.register("general.pipes.facadeBlacklist", new String[] {
Block.blockRegistry.getNameForObject(Blocks.bedrock),
Block.blockRegistry.getNameForObject(Blocks.command_block),
Block.blockRegistry.getNameForObject(Blocks.end_portal_frame),
@ -340,13 +324,13 @@ public class BuildCraftTransport extends BuildCraftMod {
JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.pumpBlock)),
JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.quarryBlock)),
JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftTransport.filteredBufferBlock)),
});
}, "What block types should be blacklisted from being a facade?", ConfigManager.RestartRequirement.GAME);
BuildCraftCore.mainConfigManager.register("general.pipes.facadeBlacklistAsWhitelist", false, "Should the blacklist be treated as a whitelist instead?", ConfigManager.RestartRequirement.GAME);
facadeBlacklistProp.comment = "Blocks listed here will not have facades created. The format is modid:blockname.\nFor mods with a | character, the value needs to be surrounded with quotes.";
facadeBlacklist = facadeBlacklistProp.getStringList();
reloadConfig(ConfigManager.RestartRequirement.GAME);
Property facadeAsWhitelist = BuildCraftCore.mainConfiguration.get("general", "facade.treatBlacklistAsWhitelist", false);
facadeTreatBlacklistAsWhitelist = facadeAsWhitelist.getBoolean();
filteredBufferBlock = new BlockFilteredBuffer();
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
pipeWaterproof = new ItemBuildCraft();
@ -571,6 +555,34 @@ public class BuildCraftTransport extends BuildCraftMod {
}
}
public void reloadConfig(ConfigManager.RestartRequirement restartType) {
if (restartType == ConfigManager.RestartRequirement.GAME) {
facadeTreatBlacklistAsWhitelist = BuildCraftCore.mainConfigManager.get("general.pipes.facadeBlacklistAsWhitelist").getBoolean();
facadeBlacklist = BuildCraftCore.mainConfigManager.get("general.pipes.facadeBlacklist").getStringList();
gateCostMultiplier = (float) BuildCraftCore.mainConfigManager.get("power.gateCostMultiplier").getDouble();
additionalWaterproofingRecipe = BuildCraftCore.mainConfigManager.get("general.pipes.slimeballWaterproofRecipe").getBoolean();
debugPrintFacadeList = BuildCraftCore.mainConfigManager.get("debug.printFacadeList").getBoolean();
pipeFluidsBaseFlowRate = BuildCraftCore.mainConfigManager.get("general.pipes.baseFluidRate").getInt();
reloadConfig(ConfigManager.RestartRequirement.WORLD);
} else if (restartType == ConfigManager.RestartRequirement.WORLD) {
reloadConfig(ConfigManager.RestartRequirement.NONE);
} else {
pipeDurability = (float) BuildCraftCore.mainConfigManager.get("general.pipes.hardness").getDouble();
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
}
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if ("BuildCraft|Core".equals(event.modID)) {
reloadConfig(event.isWorldRunning ? ConfigManager.RestartRequirement.NONE : ConfigManager.RestartRequirement.WORLD);
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Pre event) {

View file

@ -182,10 +182,10 @@ public final class SchematicRegistry implements ISchematicRegistry {
}
public void readConfiguration(Configuration conf) {
Property excludedMods = conf.get(Configuration.CATEGORY_GENERAL, "builder.excludedMods", new String[0],
"mods that should be excluded from the builder.");
Property excludedBlocks = conf.get(Configuration.CATEGORY_GENERAL, "builder.excludedBlocks", new String[0],
"blocks that should be excluded from the builder.");
Property excludedMods = conf.get("blueprints", "excludedMods", new String[0],
"mods that should be excluded from the builder.").setLanguageKey("config.blueprints.excludedMods").setRequiresMcRestart(true);
Property excludedBlocks = conf.get("blueprints", "excludedBlocks", new String[0],
"blocks that should be excluded from the builder.").setLanguageKey("config.blueprints.excludedBlocks").setRequiresMcRestart(true);
for (String id : excludedMods.getStringList()) {
String strippedId = JavaTools.stripSurroundingQuotes(id.trim());

View file

@ -0,0 +1,59 @@
package buildcraft.core.config;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Property;
public class BCConfigElement<T> extends ConfigElement<T> {
private ConfigCategory cat;
private boolean isProp;
public BCConfigElement(ConfigCategory ctgy) {
super(ctgy);
cat = ctgy;
isProp = false;
}
public BCConfigElement(Property prop) {
super(prop);
isProp = true;
}
@Override
public List<IConfigElement> getChildElements()
{
if (!isProp) {
List<IConfigElement> elements = new ArrayList<IConfigElement>();
Iterator<ConfigCategory> ccI = cat.getChildren().iterator();
Iterator<Property> pI = cat.getOrderedValues().iterator();
while (ccI.hasNext()) {
ConfigCategory child = ccI.next();
if (!child.parent.getQualifiedName().equals(cat.getQualifiedName())) {
continue;
}
ConfigElement temp = new BCConfigElement(child);
if (temp.showInGui()) {
elements.add(temp);
}
}
while (pI.hasNext())
{
ConfigElement<?> temp = getTypedElement(pI.next());
if (temp.showInGui()) {
elements.add(temp);
}
}
return elements;
} else {
return null;
}
}
}

View file

@ -6,11 +6,12 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core;
package buildcraft.core.config;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.core.Version;
public class BuildCraftConfiguration extends Configuration {
@ -21,6 +22,7 @@ public class BuildCraftConfiguration extends Configuration {
@Override
public void save() {
Property versionProp = get(CATEGORY_GENERAL, "version", Version.VERSION);
versionProp.setShowInGui(false);
versionProp.set(Version.VERSION);
super.save();
}

View file

@ -0,0 +1,110 @@
package buildcraft.core.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.client.IModGuiFactory;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
public class ConfigManager implements IModGuiFactory {
public static Configuration config;
public static class GuiConfigManager extends GuiConfig {
public GuiConfigManager(GuiScreen parentScreen) {
super(parentScreen, new ArrayList<IConfigElement>(), "BuildCraft|Core", "config", false, false, I18n.format("config.buildcraft"));
for (String s : config.getCategoryNames()) {
configElements.add(new BCConfigElement(config.getCategory(s)));
}
}
}
public enum RestartRequirement {
NONE, WORLD, GAME;
}
public ConfigManager() {
}
public ConfigManager(Configuration c) {
this.config = c;
}
public ConfigCategory getCat(String name) {
return config.getCategory(name);
}
public Property get(String iName) {
String prefix = iName.substring(0, iName.lastIndexOf("."));
ConfigCategory c = config.getCategory(prefix);
return c.get(iName.substring(iName.lastIndexOf(".") + 1));
}
private Property create(String s, Object o) {
Property p = null;
if (o instanceof Integer) {
p = new Property(s, o.toString(), Property.Type.INTEGER);
} else if (o instanceof String) {
p = new Property(s, (String) o, Property.Type.STRING);
} else if (o instanceof Double) {
p = new Property(s, o.toString(), Property.Type.DOUBLE);
} else if (o instanceof Boolean) {
p = new Property(s, o.toString(), Property.Type.BOOLEAN);
} else if (o instanceof String[]) {
p = new Property(s, (String[]) o, Property.Type.STRING);
} else {
return null;
}
return p;
}
public Property register(String name, Object property, String comment, RestartRequirement restartRequirement) {
String prefix = name.substring(0, name.lastIndexOf("."));
String suffix = name.substring(name.lastIndexOf(".") + 1);
ConfigCategory c = config.getCategory(prefix);
ConfigCategory parent = c;
while (parent != null) {
parent.setLanguageKey("config." + parent.getQualifiedName());
parent = parent.parent;
}
Property p = create(suffix, property);
c.put(suffix, p);
p.comment = comment;
RestartRequirement r = restartRequirement;
p.setLanguageKey("config." + name);
p.setRequiresWorldRestart(r == RestartRequirement.WORLD);
p.setRequiresMcRestart(r == RestartRequirement.GAME);
return p;
}
@Override
public void initialize(Minecraft minecraftInstance) {
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return GuiConfigManager.class;
}
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}

View file

@ -55,7 +55,7 @@ public class BlockMiner {
EntityItem entityitem = new EntityItem(owner.getWorldObj(), owner.xCoord + f, owner.yCoord + f1 + 0.5F, owner.zCoord + f2, stack);
entityitem.lifespan = BuildCraftCore.itemLifespan;
entityitem.lifespan = BuildCraftCore.itemLifespan * 20;
entityitem.delayBeforeCanPickup = 10;
float f3 = 0.05F;

View file

@ -70,7 +70,7 @@ public final class BlockUtils {
}
public static boolean breakBlock(WorldServer world, int x, int y, int z) {
return breakBlock(world, x, y, z, BuildCraftCore.itemLifespan);
return breakBlock(world, x, y, z, BuildCraftCore.itemLifespan * 20);
}
public static boolean breakBlock(WorldServer world, int x, int y, int z, int forcedLifespan) {

View file

@ -103,20 +103,12 @@ public class CoreProxy implements ICoreProxy {
public void addCraftingRecipe(ItemStack result, Object... recipe) {
String name = Item.itemRegistry.getNameForObject(result.getItem());
if (BuildCraftCore.recipesBlacklist.contains(name)) {
return;
}
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(result, recipe));
}
public void addShapelessRecipe(ItemStack result, Object... recipe) {
String name = Item.itemRegistry.getNameForObject(result.getItem());
if (BuildCraftCore.recipesBlacklist.contains(name)) {
return;
}
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(result, recipe));
}

View file

@ -26,10 +26,6 @@ public class AssemblyRecipeManager implements IAssemblyRecipeManager {
public void addRecipe(String id, int energyCost, ItemStack output, Object... input) {
String name = Item.itemRegistry.getNameForObject(output.getItem());
if (BuildCraftCore.recipesBlacklist.contains(name)) {
return;
}
addRecipe(id, new FlexibleRecipe<ItemStack>(id, output, energyCost, 0, input));
}

View file

@ -32,11 +32,6 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager {
public void addRecipe(String id, FluidStack ingredient, FluidStack result, int energy, int delay) {
String name = result.getFluid().getName();
if (BuildCraftCore.recipesBlacklist.contains(name)) {
return;
}
FlexibleRecipe<FluidStack> recipe = new FlexibleRecipe<FluidStack>(id, result, energy, delay, ingredient);
recipes.put(id, recipe);
validFluids1.add(ingredient);
@ -48,10 +43,6 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager {
int delay) {
String name = result.getFluid().getName();
if (BuildCraftCore.recipesBlacklist.contains(name)) {
return;
}
if (ingredient1 == null || ingredient2 == null || result == null) {
BCLog.logger.warn("Rejected refinery recipe " + id + " due to a null FluidStack!");
}

View file

@ -98,7 +98,7 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
public TileQuarry () {
box.kind = Kind.STRIPES;
this.setBattery(new RFBattery((int) (2 * 64 * BuilderAPI.BREAK_ENERGY * BuildCraftFactory.miningMultiplier), (int) (1000 * BuildCraftFactory.miningMultiplier), 0));
this.setBattery(new RFBattery((int) (2 * 64 * BuilderAPI.BREAK_ENERGY * BuildCraftCore.miningMultiplier), (int) (1000 * BuildCraftCore.miningMultiplier), 0));
}
public void createUtilsIfNeeded() {

View file

@ -119,7 +119,7 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
int itemStackCount = getNumberOfStacks();
if (itemStackCount > BuildCraftTransport.groupItemsTrigger) {
if (itemStackCount >= (MAX_PIPE_STACKS / 2)) {
groupEntities();
itemStackCount = getNumberOfStacks();
}

View file

@ -210,7 +210,7 @@ public class TravelingItem {
motion.moveForwards(0.1 + getSpeed() * 2F);
EntityItem entity = new EntityItem(container.getWorldObj(), xCoord, yCoord, zCoord, getItemStack());
entity.lifespan = BuildCraftCore.itemLifespan;
entity.lifespan = BuildCraftCore.itemLifespan * 20;
entity.delayBeforeCanPickup = 10;
float f3 = 0.00F + container.getWorldObj().rand.nextFloat() * 0.04F - 0.02F;