From f6914b21e9c9bca86272546ec84da837b3f26d7a Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Wed, 4 Sep 2013 22:50:29 -0400 Subject: [PATCH] merged ilus element into core 100% optional content, everything can be disabled --- src/dark/core/common/CoreRecipeLoader.java | 65 ++++++- src/dark/core/common/DarkMain.java | 27 ++- .../common/blocks}/BlockBasalt.java | 8 +- .../common/blocks}/BlockColorGlass.java | 6 +- .../common/blocks}/BlockColorSand.java | 7 +- .../common/blocks}/ItemBlockBasalt.java | 2 +- .../common/blocks}/ItemBlockColored.java | 6 +- .../{items => blocks}/ItemBlockOre.java | 3 +- .../common}/items/ItemColored.java | 12 +- .../colored => core/prefab}/BlockColored.java | 10 +- src/dark/illus/ClientProxy.java | 15 -- src/dark/illus/CommonProxy.java | 21 --- src/dark/illus/IllustriousElements.java | 159 ------------------ src/dark/illus/TranslationHelper.java | 72 -------- 14 files changed, 120 insertions(+), 293 deletions(-) rename src/dark/{illus/blocks/colored => core/common/blocks}/BlockBasalt.java (88%) rename src/dark/{illus/blocks/colored => core/common/blocks}/BlockColorGlass.java (82%) rename src/dark/{illus/blocks/colored => core/common/blocks}/BlockColorSand.java (92%) rename src/dark/{illus/blocks/colored => core/common/blocks}/ItemBlockBasalt.java (96%) rename src/dark/{illus/blocks/colored => core/common/blocks}/ItemBlockColored.java (81%) rename src/dark/core/common/{items => blocks}/ItemBlockOre.java (88%) rename src/dark/{illus => core/common}/items/ItemColored.java (78%) rename src/dark/{illus/blocks/colored => core/prefab}/BlockColored.java (80%) delete mode 100644 src/dark/illus/ClientProxy.java delete mode 100644 src/dark/illus/CommonProxy.java delete mode 100644 src/dark/illus/IllustriousElements.java delete mode 100644 src/dark/illus/TranslationHelper.java diff --git a/src/dark/core/common/CoreRecipeLoader.java b/src/dark/core/common/CoreRecipeLoader.java index 4afad88e3..0227a0182 100644 --- a/src/dark/core/common/CoreRecipeLoader.java +++ b/src/dark/core/common/CoreRecipeLoader.java @@ -4,16 +4,22 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; +import cpw.mods.fml.common.registry.GameRegistry; +import dark.core.common.blocks.BlockBasalt; import dark.core.common.items.EnumMeterials; import dark.core.common.items.EnumOreParts; -import dark.core.common.items.ItemWrench; import dark.core.common.items.ItemParts.Parts; +import dark.core.common.items.ItemWrench; public class CoreRecipeLoader extends RecipeLoader { /* BLOCKS */ public static Block blockOre, blockDebug, blockWire; + public static Block blockStainGlass; + public static Block blockColorSand; + public static Block blockBasalt; + public static Block blockGlowGlass; /* ITEMS */ public static Item itemMetals, battery, itemTool, itemParts; @@ -23,6 +29,8 @@ public class CoreRecipeLoader extends RecipeLoader public static ItemStack leatherSeal, slimeSeal; public static ItemStack valvePart; public static ItemStack unfinishedTank; + public static Item itemRefinedSand; + public static Item itemGlowingSand; @Override public void loadRecipes() @@ -84,4 +92,59 @@ public class CoreRecipeLoader extends RecipeLoader } } } + + public void loadStainGlass() + { + // Stained Glass // + if (itemRefinedSand != null) + { + for (int i = 0; i < DarkMain.dyeColorNames.length; i++) + { + FurnaceRecipes.smelting().addSmelting(itemRefinedSand.itemID, i, new ItemStack(blockStainGlass, 1, i), 10F); + } + + for (int j = 0; j < DarkMain.dyeColorNames.length; j++) + { + GameRegistry.addShapelessRecipe(new ItemStack(itemRefinedSand, 1, j), new Object[] { new ItemStack(blockColorSand, 1, j) }); + } + } + + // Glowing Glass // + if (itemGlowingSand != null) + { + for (int i = 0; i < DarkMain.dyeColorNames.length; i++) + { + FurnaceRecipes.smelting().addSmelting(itemGlowingSand.itemID, i, new ItemStack(blockGlowGlass, 1, i), 10F); + } + for (int j = 0; j < DarkMain.dyeColorNames.length; j++) + { + GameRegistry.addShapelessRecipe(new ItemStack(itemGlowingSand, 1, j), new Object[] { new ItemStack(itemRefinedSand, 1, j), Item.redstone }); + GameRegistry.addShapelessRecipe(new ItemStack(itemGlowingSand, 1, j), new Object[] { new ItemStack(itemRefinedSand, 1, j), Item.glowstone }); + + } + } + + // Colored Sand // + if (blockColorSand != null) + { + for (int j = 0; j < DarkMain.dyeColorNames.length; j++) + { + GameRegistry.addRecipe(new ItemStack(blockColorSand, 8, j), new Object[] { "SSS", "SDS", "SSS", 'S', Block.sand, 'D', new ItemStack(Item.dyePowder, 1, j) }); + } + } + + // Extra Block // + if (blockBasalt != null) + { + GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 1, BlockBasalt.block.COBBLE.ordinal()), new Object[] { new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); + GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 1, BlockBasalt.block.MOSSY.ordinal()), new Object[] { new ItemStack(blockBasalt, 1, BlockBasalt.block.BRICK.ordinal()), Block.vine }); + GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 2, BlockBasalt.block.CRACKED.ordinal()), new Object[] { new ItemStack(blockBasalt, 1, BlockBasalt.block.BRICK.ordinal()), new ItemStack(blockBasalt, 1, BlockBasalt.block.BRICK.ordinal()) }); + GameRegistry.addRecipe(new ItemStack(blockBasalt, 4, BlockBasalt.block.BRICK.ordinal()), new Object[] { "SS", "SS", 'S', new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); + GameRegistry.addRecipe(new ItemStack(blockBasalt, 8, BlockBasalt.block.CHISILED.ordinal()), new Object[] { "SSS", "S S", "SSS", 'S', new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); + + GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 2, BlockBasalt.block.COBBLE.ordinal()), new Object[] { Block.cobblestone, new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); + GameRegistry.addSmelting(Block.stone.blockID, new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()), 1f); + } + + } } diff --git a/src/dark/core/common/DarkMain.java b/src/dark/core/common/DarkMain.java index 9e61e55c5..7735be7f4 100644 --- a/src/dark/core/common/DarkMain.java +++ b/src/dark/core/common/DarkMain.java @@ -1,5 +1,6 @@ package dark.core.common; +import java.awt.Color; import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -28,12 +29,19 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; import cpw.mods.fml.common.network.NetworkMod; +import cpw.mods.fml.common.registry.GameRegistry; import dark.core.common.BlockRegistry.BlockData; +import dark.core.common.blocks.BlockBasalt; +import dark.core.common.blocks.BlockColorGlass; +import dark.core.common.blocks.BlockColorSand; import dark.core.common.blocks.BlockOre; +import dark.core.common.blocks.ItemBlockBasalt; +import dark.core.common.blocks.ItemBlockColored; +import dark.core.common.blocks.ItemBlockOre; import dark.core.common.debug.BlockDebug; import dark.core.common.items.EnumMeterials; import dark.core.common.items.ItemBattery; -import dark.core.common.items.ItemBlockOre; +import dark.core.common.items.ItemColored; import dark.core.common.items.ItemOreDirv; import dark.core.common.items.ItemParts; import dark.core.common.items.ItemTools; @@ -82,6 +90,10 @@ public class DarkMain extends ModPrefab public static CoreRecipeLoader recipeLoader; + public static final String[] dyeColorNames = new String[] { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "Silver", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" }; + public static final Color[] dyeColors = new Color[] { Color.black, Color.red, Color.green, new Color(139, 69, 19), Color.BLUE, new Color(75, 0, 130), Color.cyan, new Color(192, 192, 192), Color.gray, Color.pink, new Color(0, 255, 0), Color.yellow, new Color(135, 206, 250), Color.magenta, Color.orange, Color.white }; + + public static DarkMain getInstance() { if (instance == null) @@ -172,7 +184,17 @@ public class DarkMain extends ModPrefab CoreRecipeLoader.blockOre = new BlockOre(getNextID(), CONFIGURATION); CoreRecipeLoader.blockWire = new BlockWire(CONFIGURATION, getNextID()); CoreRecipeLoader.blockDebug = new BlockDebug(getNextID(), CONFIGURATION); + CoreRecipeLoader.blockStainGlass = new BlockColorGlass(getNextID(), "StainedGlass"); + CoreRecipeLoader.blockColorSand = new BlockColorSand(getNextID()); + CoreRecipeLoader.blockBasalt = new BlockBasalt(getNextID()); + CoreRecipeLoader.blockGlowGlass = new BlockColorGlass(getNextID(), "GlowGlass").setLightOpacity(2).setLightValue(1); + + // // Registration //// + dataList.add(new BlockData(CoreRecipeLoader.blockStainGlass, ItemBlockColored.class, "stainGlass")); + dataList.add(new BlockData(CoreRecipeLoader.blockColorSand, ItemBlockColored.class, "stainSand")); + dataList.add(new BlockData(CoreRecipeLoader.blockBasalt, ItemBlockBasalt.class, "extraBlocks")); + dataList.add(new BlockData(CoreRecipeLoader.blockGlowGlass, ItemBlockColored.class, "stainGlowGlass")); dataList.add(new BlockData(CoreRecipeLoader.blockOre, ItemBlockOre.class, "DMOre")); dataList.add(new BlockData(CoreRecipeLoader.blockWire, "DMWire")); dataList.add(new BlockData(CoreRecipeLoader.blockDebug, "DMDebug")); @@ -185,6 +207,9 @@ public class DarkMain extends ModPrefab if (CONFIGURATION.get("general", "LoadCraftingParts", true, "Only disable this if you do not plan to craft, or are not using any mods that need these parts.").getBoolean(true)) { CoreRecipeLoader.itemParts = new ItemParts(ITEM_ID_PREFIX++, CONFIGURATION); + CoreRecipeLoader.itemRefinedSand = new ItemColored(CONFIGURATION.getItem(Configuration.CATEGORY_ITEM, "RefinedSandItemID", ITEM_ID_PREFIX++).getInt(), "RefinedSand"); + CoreRecipeLoader.itemGlowingSand = new ItemColored(CONFIGURATION.getItem(Configuration.CATEGORY_ITEM, "GlowingRefinedSandItemID", ITEM_ID_PREFIX++).getInt(), "GlowRefinedSand"); + } if (CONFIGURATION.get("general", "EnableBattery", true).getBoolean(true)) { diff --git a/src/dark/illus/blocks/colored/BlockBasalt.java b/src/dark/core/common/blocks/BlockBasalt.java similarity index 88% rename from src/dark/illus/blocks/colored/BlockBasalt.java rename to src/dark/core/common/blocks/BlockBasalt.java index 9716c1f38..b751b97cf 100644 --- a/src/dark/illus/blocks/colored/BlockBasalt.java +++ b/src/dark/core/common/blocks/BlockBasalt.java @@ -1,4 +1,4 @@ -package dark.illus.blocks.colored; +package dark.core.common.blocks; import java.util.Random; @@ -9,7 +9,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.illus.IllustriousElements; +import dark.core.common.DarkMain; public class BlockBasalt extends Block { @@ -35,7 +35,7 @@ public class BlockBasalt extends Block public BlockBasalt(int par1) { - super(par1, Material.rock); + super(DarkMain.CONFIGURATION.getBlock("basalt", par1).getInt(), Material.rock); this.setCreativeTab(CreativeTabs.tabDecorations); this.setHardness(2f); this.setResistance(2f); @@ -80,7 +80,7 @@ public class BlockBasalt extends Block for (int i = 0; i < this.blockNames.length; ++i) { - this.icons[i] = iconReg.registerIcon(IllustriousElements.TEXTURE_NAME_PREFIX + this.blockNames[i]); + this.icons[i] = iconReg.registerIcon(DarkMain.getInstance().PREFIX + this.blockNames[i]); } } diff --git a/src/dark/illus/blocks/colored/BlockColorGlass.java b/src/dark/core/common/blocks/BlockColorGlass.java similarity index 82% rename from src/dark/illus/blocks/colored/BlockColorGlass.java rename to src/dark/core/common/blocks/BlockColorGlass.java index 6f35a38fc..a14d63e66 100644 --- a/src/dark/illus/blocks/colored/BlockColorGlass.java +++ b/src/dark/core/common/blocks/BlockColorGlass.java @@ -1,4 +1,4 @@ -package dark.illus.blocks.colored; +package dark.core.common.blocks; import java.util.Random; @@ -6,13 +6,15 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import dark.core.common.DarkMain; +import dark.core.prefab.BlockColored; public class BlockColorGlass extends BlockColored { public BlockColorGlass(int id, String name) { - super(name, id, Material.glass); + super(name, DarkMain.CONFIGURATION.getBlock(name, id).getInt(), Material.glass); this.setCreativeTab(CreativeTabs.tabDecorations); this.setHardness(.5f); this.setResistance(.5f); diff --git a/src/dark/illus/blocks/colored/BlockColorSand.java b/src/dark/core/common/blocks/BlockColorSand.java similarity index 92% rename from src/dark/illus/blocks/colored/BlockColorSand.java rename to src/dark/core/common/blocks/BlockColorSand.java index 86f4c7cf0..5f0fd8f04 100644 --- a/src/dark/illus/blocks/colored/BlockColorSand.java +++ b/src/dark/core/common/blocks/BlockColorSand.java @@ -1,7 +1,10 @@ -package dark.illus.blocks.colored; +package dark.core.common.blocks; import java.util.Random; +import dark.core.common.DarkMain; +import dark.core.prefab.BlockColored; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -11,7 +14,7 @@ public class BlockColorSand extends BlockColored { public BlockColorSand(int par1) { - super("colorSand", par1, Material.sand); + super("colorSand", DarkMain.CONFIGURATION.getBlock("colorSand", par1).getInt(), Material.sand); this.setCreativeTab(CreativeTabs.tabDecorations); this.setHardness(1f); this.setResistance(.5f); diff --git a/src/dark/illus/blocks/colored/ItemBlockBasalt.java b/src/dark/core/common/blocks/ItemBlockBasalt.java similarity index 96% rename from src/dark/illus/blocks/colored/ItemBlockBasalt.java rename to src/dark/core/common/blocks/ItemBlockBasalt.java index 7a0791887..8fd999cc2 100644 --- a/src/dark/illus/blocks/colored/ItemBlockBasalt.java +++ b/src/dark/core/common/blocks/ItemBlockBasalt.java @@ -1,4 +1,4 @@ -package dark.illus.blocks.colored; +package dark.core.common.blocks; import java.util.List; diff --git a/src/dark/illus/blocks/colored/ItemBlockColored.java b/src/dark/core/common/blocks/ItemBlockColored.java similarity index 81% rename from src/dark/illus/blocks/colored/ItemBlockColored.java rename to src/dark/core/common/blocks/ItemBlockColored.java index 44bb5b126..ab9964d8f 100644 --- a/src/dark/illus/blocks/colored/ItemBlockColored.java +++ b/src/dark/core/common/blocks/ItemBlockColored.java @@ -1,9 +1,9 @@ -package dark.illus.blocks.colored; +package dark.core.common.blocks; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import dark.illus.IllustriousElements; +import dark.core.common.DarkMain; public class ItemBlockColored extends ItemBlock { @@ -23,7 +23,7 @@ public class ItemBlockColored extends ItemBlock @Override public String getUnlocalizedName(ItemStack par1ItemStack) { - return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + IllustriousElements.dyeColorNames[par1ItemStack.getItemDamage()]; + return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + DarkMain.dyeColorNames[par1ItemStack.getItemDamage()]; } @Override diff --git a/src/dark/core/common/items/ItemBlockOre.java b/src/dark/core/common/blocks/ItemBlockOre.java similarity index 88% rename from src/dark/core/common/items/ItemBlockOre.java rename to src/dark/core/common/blocks/ItemBlockOre.java index 8a4724eea..615c95250 100644 --- a/src/dark/core/common/items/ItemBlockOre.java +++ b/src/dark/core/common/blocks/ItemBlockOre.java @@ -1,8 +1,9 @@ -package dark.core.common.items; +package dark.core.common.blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import dark.core.common.DarkMain; +import dark.core.common.items.EnumMeterials; public class ItemBlockOre extends ItemBlock { diff --git a/src/dark/illus/items/ItemColored.java b/src/dark/core/common/items/ItemColored.java similarity index 78% rename from src/dark/illus/items/ItemColored.java rename to src/dark/core/common/items/ItemColored.java index 1e4afb017..2b7866e25 100644 --- a/src/dark/illus/items/ItemColored.java +++ b/src/dark/core/common/items/ItemColored.java @@ -1,4 +1,4 @@ -package dark.illus.items; +package dark.core.common.items; import java.util.List; @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.illus.IllustriousElements; +import dark.core.common.DarkMain; public class ItemColored extends Item { @@ -29,7 +29,7 @@ public class ItemColored extends Item @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - return IllustriousElements.dyeColors[par1ItemStack.getItemDamage() % 16].getRGB(); + return DarkMain.dyeColors[par1ItemStack.getItemDamage() % 16].getRGB(); } @Override @@ -48,7 +48,7 @@ public class ItemColored extends Item @Override public void registerIcons(IconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon(IllustriousElements.TEXTURE_NAME_PREFIX + "dust"); + this.itemIcon = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "dust"); this.theIcon = par1IconRegister.registerIcon("glowingPowder_overlay"); } @@ -61,13 +61,13 @@ public class ItemColored extends Item @Override public final String getUnlocalizedName(ItemStack par1ItemStack) { - return this.getUnlocalizedName() + "." + IllustriousElements.dyeColorNames[par1ItemStack.getItemDamage()]; + return this.getUnlocalizedName() + "." + DarkMain.dyeColorNames[par1ItemStack.getItemDamage()]; } @Override public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) { - for (int i = 0; i < IllustriousElements.dyeColorNames.length; i++) + for (int i = 0; i < DarkMain.dyeColorNames.length; i++) { par3List.add(new ItemStack(par1, 1, i)); } diff --git a/src/dark/illus/blocks/colored/BlockColored.java b/src/dark/core/prefab/BlockColored.java similarity index 80% rename from src/dark/illus/blocks/colored/BlockColored.java rename to src/dark/core/prefab/BlockColored.java index 66c35f382..70f9e9ff4 100644 --- a/src/dark/illus/blocks/colored/BlockColored.java +++ b/src/dark/core/prefab/BlockColored.java @@ -1,4 +1,4 @@ -package dark.illus.blocks.colored; +package dark.core.prefab; import java.util.List; @@ -11,7 +11,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.illus.IllustriousElements; +import dark.core.common.DarkMain; public class BlockColored extends Block { @@ -61,7 +61,7 @@ public class BlockColored extends Block { if (colorized) { - this.singleIcon = iconReg.registerIcon(IllustriousElements.TEXTURE_NAME_PREFIX + this.getUnlocalizedName().replace("tile.", "")); + this.singleIcon = iconReg.registerIcon(DarkMain.getInstance().PREFIX + this.getUnlocalizedName().replace("tile.", "")); } else { @@ -69,7 +69,7 @@ public class BlockColored extends Block for (int i = 0; i < this.icons.length; ++i) { - this.icons[i] = iconReg.registerIcon(IllustriousElements.TEXTURE_NAME_PREFIX + IllustriousElements.dyeColorNames[~i & 15] + this.getUnlocalizedName().replace("tile.", "")); + this.icons[i] = iconReg.registerIcon(DarkMain.getInstance().PREFIX + DarkMain.dyeColorNames[~i & 15] + this.getUnlocalizedName().replace("tile.", "")); } } } @@ -88,7 +88,7 @@ public class BlockColored extends Block if (this.colorized) { - return IllustriousElements.dyeColors[meta & 15].getRGB(); + return DarkMain.dyeColors[meta & 15].getRGB(); } return super.getRenderColor(meta); } diff --git a/src/dark/illus/ClientProxy.java b/src/dark/illus/ClientProxy.java deleted file mode 100644 index dc87eebc5..000000000 --- a/src/dark/illus/ClientProxy.java +++ /dev/null @@ -1,15 +0,0 @@ -package dark.illus; - -public class ClientProxy extends CommonProxy -{ - public void preInit() - { - - } - - @Override - public void init() - { - - } -} diff --git a/src/dark/illus/CommonProxy.java b/src/dark/illus/CommonProxy.java deleted file mode 100644 index 3d46a19f3..000000000 --- a/src/dark/illus/CommonProxy.java +++ /dev/null @@ -1,21 +0,0 @@ -package dark.illus; - -public class CommonProxy -{ - - public void preInit() - { - - } - - public void postInit() - { - - } - - public void init() - { - - } - -} diff --git a/src/dark/illus/IllustriousElements.java b/src/dark/illus/IllustriousElements.java deleted file mode 100644 index a14d2401a..000000000 --- a/src/dark/illus/IllustriousElements.java +++ /dev/null @@ -1,159 +0,0 @@ -package dark.illus; - -import java.awt.Color; -import java.io.File; -import java.util.logging.Logger; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraftforge.common.Configuration; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.network.NetworkMod; -import cpw.mods.fml.common.registry.GameRegistry; -import dark.illus.blocks.colored.BlockBasalt; -import dark.illus.blocks.colored.BlockColorGlass; -import dark.illus.blocks.colored.BlockColorSand; -import dark.illus.blocks.colored.ItemBlockBasalt; -import dark.illus.blocks.colored.ItemBlockColored; -import dark.illus.items.ItemColored; - - -public class IllustriousElements -{ - // @Mod Prerequisites - public static final String MAJOR_VERSION = "@MAJOR@"; - public static final String MINOR_VERSION = "@MINOR@"; - public static final String REVIS_VERSION = "@REVIS@"; - public static final String BUILD_VERSION = "@BUILD@"; - - // @Mod - public static final String MOD_ID = "Illustrious_Elements"; - public static final String MOD_NAME = "Illustrious_Elements"; - public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVIS_VERSION + "." + BUILD_VERSION; - @Instance(IllustriousElements.MOD_ID) - public static IllustriousElements Instance; - - @SidedProxy(clientSide = "dark.illus.ClientProxy", serverSide = "dark.illus.CommonProxy") - public static CommonProxy proxy; - - public static final String RESOURCE_PATH = "/mods/illus/"; - - public static final String TEXTURE_DIRECTORY = RESOURCE_PATH + "textures/"; - public static final String GUI_DIRECTORY = TEXTURE_DIRECTORY + "gui/"; - public static final String BLOCK_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + "blocks/"; - public static final String ITEM_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + "items/"; - public static final String MODEL_TEXTURE_DIRECTORY = TEXTURE_DIRECTORY + "models/"; - public static final String LANGUAGE_PATH = RESOURCE_PATH + "lang/"; - - public static final String TEXTURE_NAME_PREFIX = "illus:"; - - // Variables // - private static final String[] LANGUAGES_SUPPORTED = new String[] { "en_US" }; - - static Configuration config = new Configuration(new File(Loader.instance().getConfigDir(), "IllustriousElements.cfg")); - - public static Logger FMLog = Logger.getLogger(MOD_NAME); - - public static final String[] dyeColorNames = new String[] { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "Silver", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" }; - public static final Color[] dyeColors = new Color[] { Color.black, Color.red, Color.green, new Color(139, 69, 19), Color.BLUE, new Color(75, 0, 130), Color.cyan, new Color(192, 192, 192), Color.gray, Color.pink, new Color(0, 255, 0), Color.yellow, new Color(135, 206, 250), Color.magenta, Color.orange, Color.white }; - // Blocks // - public static Block blockStainGlass; - public static Block blockColorSand; - public static Block blockBasalt; - public static Block blockGlowGlass; - - // Item // - public static Item itemRefinedSand; - public static Item itemGlowingSand; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - proxy.preInit(); - - // // Configuration //// - config.load(); - blockStainGlass = new BlockColorGlass(config.getBlock(Configuration.CATEGORY_BLOCK, "StainedGlassBlockID", 1200).getInt(), "StainedGlass"); - blockColorSand = new BlockColorSand(config.getBlock(Configuration.CATEGORY_BLOCK, "ColoredSandBlockID", 1201).getInt()); - blockBasalt = new BlockBasalt(config.getBlock(Configuration.CATEGORY_BLOCK, "ExtraBlocksBlockID", 1202).getInt()); - blockGlowGlass = new BlockColorGlass(config.getBlock(Configuration.CATEGORY_BLOCK, "GlowingGlassBlockID", 1203).getInt(), "GlowGlass").setLightOpacity(2).setLightValue(1); - - itemRefinedSand = new ItemColored(config.getItem(Configuration.CATEGORY_ITEM, "RefinedSandItemID", 30010).getInt(), "RefinedSand"); - itemGlowingSand = new ItemColored(config.getItem(Configuration.CATEGORY_ITEM, "GlowingRefinedSandItemID", 30020).getInt(), "GlowRefinedSand"); - config.save(); - - // // Registration //// - GameRegistry.registerBlock(blockStainGlass, ItemBlockColored.class, "stainGlass"); - GameRegistry.registerBlock(blockColorSand, ItemBlockColored.class, "stainSand"); - GameRegistry.registerBlock(blockBasalt, ItemBlockBasalt.class, "extraBlocks"); - GameRegistry.registerBlock(blockGlowGlass, ItemBlockColored.class, "stainGlowGlass"); - - } - - @EventHandler - public void generalLoad(FMLInitializationEvent event) - { - proxy.init(); - // // Block Names //// - FMLog.info(" Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages."); - } - - @EventHandler - public void postLoad(FMLPostInitializationEvent event) - { - proxy.postInit(); - // // Block Recipes //// - - // Stained Glass // - for (int i = 0; i < dyeColorNames.length; i++) - { - FurnaceRecipes.smelting().addSmelting(IllustriousElements.itemRefinedSand.itemID, i, new ItemStack(IllustriousElements.blockStainGlass, 1, i), 10F); - } - - // Glowing Glass // - for (int i = 0; i < dyeColorNames.length; i++) - { - FurnaceRecipes.smelting().addSmelting(IllustriousElements.itemGlowingSand.itemID, i, new ItemStack(IllustriousElements.blockGlowGlass, 1, i), 10F); - } - - // Colored Sand // - for (int j = 0; j < dyeColorNames.length; j++) - { - GameRegistry.addRecipe(new ItemStack(blockColorSand, 8, j), new Object[] { "SSS", "SDS", "SSS", 'S', Block.sand, 'D', new ItemStack(Item.dyePowder, 1, j) }); - } - - // Extra Block // - - GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 1, BlockBasalt.block.COBBLE.ordinal()), new Object[] { new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); - GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 1, BlockBasalt.block.MOSSY.ordinal()), new Object[] { new ItemStack(blockBasalt, 1, BlockBasalt.block.BRICK.ordinal()), Block.vine }); - GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 2, BlockBasalt.block.CRACKED.ordinal()), new Object[] { new ItemStack(blockBasalt, 1, BlockBasalt.block.BRICK.ordinal()), new ItemStack(blockBasalt, 1, BlockBasalt.block.BRICK.ordinal()) }); - GameRegistry.addRecipe(new ItemStack(blockBasalt, 4, BlockBasalt.block.BRICK.ordinal()), new Object[] { "SS", "SS", 'S', new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); - GameRegistry.addRecipe(new ItemStack(blockBasalt, 8, BlockBasalt.block.CHISILED.ordinal()), new Object[] { "SSS", "S S", "SSS", 'S', new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); - - GameRegistry.addShapelessRecipe(new ItemStack(blockBasalt, 2, BlockBasalt.block.COBBLE.ordinal()), new Object[] { Block.cobblestone, new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()) }); - GameRegistry.addSmelting(Block.stone.blockID, new ItemStack(blockBasalt, 1, BlockBasalt.block.STONE.ordinal()), 1f); - - // // Item Recipes //// - - // Refined Sand // - for (int j = 0; j < dyeColorNames.length; j++) - { - GameRegistry.addShapelessRecipe(new ItemStack(itemRefinedSand, 1, j), new Object[] { new ItemStack(blockColorSand, 1, j) }); - } - - // Glowing Refined Sand // - for (int j = 0; j < dyeColorNames.length; j++) - { - GameRegistry.addShapelessRecipe(new ItemStack(itemGlowingSand, 1, j), new Object[] { new ItemStack(itemRefinedSand, 1, j), Item.redstone }); - } - } -} \ No newline at end of file diff --git a/src/dark/illus/TranslationHelper.java b/src/dark/illus/TranslationHelper.java deleted file mode 100644 index 205fc0002..000000000 --- a/src/dark/illus/TranslationHelper.java +++ /dev/null @@ -1,72 +0,0 @@ -package dark.illus; - -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.registry.LanguageRegistry; - -/** A class to help you out with translations. - * - * @author Calclavia */ -public class TranslationHelper -{ - /** Loads all the language files for a mod. This supports the loading of "child" language files - * for sub-languages to be loaded all from one file instead of creating multiple of them. An - * example of this usage would be different Spanish sub-translations (es_MX, es_YU). - * - * @param languagePath - The path to the mod's language file folder. - * @param languageSupported - The languages supported. E.g: new String[]{"en_US", "en_AU", - * "en_UK"} - * @return The amount of language files loaded successfully. */ - public static int loadLanguages(String languagePath, String[] languageSupported) - { - int languages = 0; - - /** Load all languages. */ - for (String language : languageSupported) - { - LanguageRegistry.instance().loadLocalization(languagePath + language + ".properties", language, false); - - if (LanguageRegistry.instance().getStringLocalization("children", language) != "") - { - try - { - String[] children = LanguageRegistry.instance().getStringLocalization("children", language).split(","); - - for (String child : children) - { - if (child != "" || child != null) - { - LanguageRegistry.instance().loadLocalization(languagePath + language + ".properties", child, false); - languages++; - } - } - } - catch (Exception e) - { - FMLLog.severe("Failed to load a child language file."); - e.printStackTrace(); - } - } - - languages++; - } - - return languages; - } - - /** Gets the local text of your translation based on the given key. This will look through your - * mod's translation file that was previously registered. Make sure you enter the full name - * - * @param key - e.g tile.block.name - * @return The translated string or the default English translation if none was found. */ - public static String getLocal(String key) - { - String text = LanguageRegistry.instance().getStringLocalization(key); - - if (text == null || text == "") - { - text = LanguageRegistry.instance().getStringLocalization(key, "en_US"); - } - - return text; - } -}