Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Added most needed configuration aspects (missing ore config) - Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
renevo committed Mar 19, 2016
1 parent 5e33107 commit eed20e1
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/renevo/nethercore/NetherCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
dependencies = "required-after:Forge@[11.15.1,);required-after:mantle@[1.8.9-0.7,)",
acceptedMinecraftVersions = "1.8.9",
updateJSON = "https://raw.githubusercontent.com/RenEvo/nethercore/master/update.json",
useMetadata = true)
useMetadata = true,
guiFactory="com.renevo.nethercore.client.gui.config.ModGuiFactory")
public class NetherCore
{
public Logger log;
public Random random = new Random();

@Mod.Instance(Util.MODID)
public static NetherCore instance;
Expand Down
68 changes: 40 additions & 28 deletions src/main/java/com/renevo/nethercore/NetherCoreRegistry.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.renevo.nethercore;

import com.renevo.nethercore.common.Config;
import com.renevo.nethercore.item.NetherCoreItems;
import com.renevo.nethercore.tconstruct.TinkersIntegration;
import net.minecraft.init.Blocks;
Expand All @@ -14,7 +15,8 @@
import com.renevo.nethercore.blocks.NetherCoreBlocks;

public final class NetherCoreRegistry {
private NetherCoreRegistry() {}
private NetherCoreRegistry() {
}

public static CreativeTab tabNetherCore = new CreativeTab("NetherCore", new ItemStack(Blocks.netherrack));

Expand All @@ -31,10 +33,13 @@ public static void registerSmelting() {
GameRegistry.addSmelting(NetherCoreItems.stoneBrick, NetherCoreItems.stoneBrickCracked, 0.0F);

// collides with Soul Shards - The old way, need to adjust if present
GameRegistry.addSmelting(Blocks.soul_sand, NetherCoreItems.soulGlass, 0.0F);
if (Config.enableSoulGlassRecipe) {
GameRegistry.addSmelting(Blocks.soul_sand, NetherCoreItems.soulGlass, 0.0F);
}

// TODO: option to disable this
GameRegistry.addSmelting(NetherCoreItems.compressedNetherrackOctuple, new ItemStack(Items.nether_star, 1), 10.0f);
if (Config.enableSmeltedNetherStar) {
GameRegistry.addSmelting(NetherCoreItems.compressedNetherrackOctuple, new ItemStack(Items.nether_star, 1), 10.0f);
}
}

public static void registerOreDictionary() {
Expand Down Expand Up @@ -92,22 +97,26 @@ public static void registerRecipes() {
"###",
'#', NetherCoreItems.stoneBrick);

GameRegistry.addRecipe(new ItemStack(NetherCoreItems.netherSpore),
"MGM",
"WSW",
"BGB",
'M', Items.magma_cream,
'G', Items.ghast_tear,
'S', Items.wheat_seeds,
'B', Items.blaze_powder,
'W', Items.nether_wart);

GameRegistry.addRecipe(new ItemStack(NetherCoreBlocks.blockNetherFurnace),
"CCC",
"CMC",
"CCC",
'C', NetherCoreItems.stoneCobble,
'M', Items.magma_cream);
if (Config.enableNetherSporeRecipe) {
GameRegistry.addRecipe(new ItemStack(NetherCoreItems.netherSpore),
"MGM",
"WSW",
"BGB",
'M', Items.magma_cream,
'G', Items.ghast_tear,
'S', Items.wheat_seeds,
'B', Items.blaze_powder,
'W', Items.nether_wart);
}

if (Config.enableNetherFurnaceRecipe) {
GameRegistry.addRecipe(new ItemStack(NetherCoreBlocks.blockNetherFurnace),
"CCC",
"CMC",
"CCC",
'C', NetherCoreItems.stoneCobble,
'M', Items.magma_cream);
}

ItemStack netherRods = NetherCoreItems.netherRod.copy();
netherRods.stackSize = 4;
Expand All @@ -118,14 +127,17 @@ public static void registerRecipes() {
'B', Blocks.nether_brick);

addCompressedRecipe(new ItemStack(NetherCoreItems.netherCoal), NetherCoreItems.netherCoalBlock);
addCompressedRecipe(new ItemStack(Blocks.netherrack), NetherCoreItems.compressedNetherrackSingle);
addCompressedRecipe(NetherCoreItems.compressedNetherrackSingle, NetherCoreItems.compressedNetherrackDouble);
addCompressedRecipe(NetherCoreItems.compressedNetherrackDouble, NetherCoreItems.compressedNetherrackTriple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackTriple, NetherCoreItems.compressedNetherrackQuadruple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackQuadruple, NetherCoreItems.compressedNetherrackQuintuple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackQuintuple, NetherCoreItems.compressedNetherrackSextuple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackSextuple, NetherCoreItems.compressedNetherrackSeptuple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackSeptuple, NetherCoreItems.compressedNetherrackOctuple);

if (Config.enableCompressedNetherrackRecipes) {
addCompressedRecipe(new ItemStack(Blocks.netherrack), NetherCoreItems.compressedNetherrackSingle);
addCompressedRecipe(NetherCoreItems.compressedNetherrackSingle, NetherCoreItems.compressedNetherrackDouble);
addCompressedRecipe(NetherCoreItems.compressedNetherrackDouble, NetherCoreItems.compressedNetherrackTriple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackTriple, NetherCoreItems.compressedNetherrackQuadruple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackQuadruple, NetherCoreItems.compressedNetherrackQuintuple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackQuintuple, NetherCoreItems.compressedNetherrackSextuple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackSextuple, NetherCoreItems.compressedNetherrackSeptuple);
addCompressedRecipe(NetherCoreItems.compressedNetherrackSeptuple, NetherCoreItems.compressedNetherrackOctuple);
}

addSlabRecipe(NetherCoreItems.stone, NetherCoreItems.slabStone);
addSlabRecipe(NetherCoreItems.stoneCobble, NetherCoreItems.slabStoneCobble);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.renevo.nethercore.client.gui.config;

import com.renevo.nethercore.Util;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;

import java.util.ArrayList;
import java.util.List;

public class ModConfigGui extends GuiConfig {
public ModConfigGui(GuiScreen parent) {
super(parent, getConfigElements(), Util.MODID, false, false, "Nether Core Configuration");
}

private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<IConfigElement>();

return list;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.renevo.nethercore.client.gui.config;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.IModGuiFactory;

import java.util.Set;

public class ModGuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraft) {

}

@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ModConfigGui.class;
}

@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}

@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement runtimeOptionCategoryElement) {
return null;
}
}
9 changes: 7 additions & 2 deletions src/main/java/com/renevo/nethercore/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ public void preInit() {

NetherCoreRegistry.registerOreDictionary();

GameRegistry.registerWorldGenerator(new NetherOreGenerator(), 1);
NetherCoreAchievements.init();
if (Config.enableWorldOreGeneration) {
GameRegistry.registerWorldGenerator(new NetherOreGenerator(), 1);
}

if (Config.enableAchievements) {
NetherCoreAchievements.init();
}

registerModels();
}
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/renevo/nethercore/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,32 @@ public final class Config {

private Config() {}

public static boolean enableAchievements = true;
public static boolean enableSmeltedNetherStar = true;
public static boolean enableCompressedNetherrackRecipes = true;
public static boolean enableNetherSporeRecipe = true;
public static boolean enableNetherFurnaceRecipe = true;
public static boolean enableSoulGlassRecipe = true;

public static boolean enableWorldOreGeneration = true;

public static boolean enableTinkersIntegration = true;

public static void loadConfiguration(File configurationFile) {
forgeConfiguration = new Configuration(configurationFile);

forgeConfiguration.load();

// TODO: Load configuration stuff...
enableAchievements = forgeConfiguration.get("General", "Enable Achievements", true, "When false, no achievements will be registered or available").getBoolean();
enableSmeltedNetherStar = forgeConfiguration.get("General", "Enable Nether Star Smelting", true, "When false, the Nether Star can not be smelted with Octuple Compressed Netherrack").getBoolean();
enableCompressedNetherrackRecipes = forgeConfiguration.get("General", "Enable Compressed Netherrack", true, "When false, the Compressed Netherrack recipes will not be enabled").getBoolean();
enableNetherSporeRecipe = forgeConfiguration.get("General", "Enable Nether Spore", true, "When false, the Nether Spore will not be craftable").getBoolean();
enableNetherFurnaceRecipe = forgeConfiguration.get("General", "Enable Nether Furance", true, "When false, the Nether Furnace will not be craftable").getBoolean();
enableSoulGlassRecipe = forgeConfiguration.get("General", "Enable Soul Glass", true, "When false, Soul Glass can not be smelted from Soul Sand").getBoolean();

enableWorldOreGeneration = forgeConfiguration.get("World", "Generate Ores", true, "When false, no ores will be generated in the Nether").getBoolean();

enableTinkersIntegration = forgeConfiguration.get("Integration", "Tinkers", true, "When false, nothing will be integrated with Tinkers").getBoolean();

forgeConfiguration.save();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.renevo.nethercore.tconstruct;

import com.renevo.nethercore.common.Config;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fml.common.FMLLog;
Expand All @@ -18,8 +19,7 @@ public static void addTinkersSmelting(ItemStack cook, Fluid output, int amount)
return;
}

// TODO: Check configuration
if (!Loader.isModLoaded("tconstruct")) {
if (!Loader.isModLoaded("tconstruct") || !Config.enableTinkersIntegration) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"1.3.2": "Added Nether Rods",
"1.3.3": "Added Soul Glass",
"1.3.4": "Added Nether Coal",
"1.3.5": "Added WAILA Support"
"1.3.5": "Added Configuration"
}
}

0 comments on commit eed20e1

Please sign in to comment.