From 7fb230847f97838932574d503cf850d9e8f0ce92 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Mon, 22 Apr 2013 21:00:28 +0200 Subject: [PATCH 01/16] Merged origin/master --- ee3_common/com/pahimar/ee3/EquivalentExchange3.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java index 786ca2ff..020f7850 100644 --- a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java +++ b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3; +package com.pahimar.ee3; import java.io.File; import java.util.logging.Level; From 3df69fd48b70eab57082e3928180e1d2e5cf6d5a Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Wed, 24 Apr 2013 21:10:00 +0200 Subject: [PATCH 02/16] Removed hardcoded localization array Added localization directory parsing (May need some refactoring) --- .../com/pahimar/ee3/EquivalentExchange3.java | 4 +-- .../core/handlers/LocalizationHandler.java | 5 ++- .../com/pahimar/ee3/lib/Localizations.java | 32 ++++++++++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java index 020f7850..ab86cf30 100644 --- a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java +++ b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3; +package com.pahimar.ee3; import java.io.File; import java.util.logging.Level; @@ -90,7 +90,7 @@ public class EquivalentExchange3 { // Initialize the log helper LogHelper.init(); - + // Load the localization files into the LanguageRegistry LocalizationHandler.loadLanguages(); diff --git a/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java index edacd001..f7680d60 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java @@ -20,7 +20,10 @@ public class LocalizationHandler { * Loads in all the localization files from the Localizations library class */ public static void loadLanguages() { - + + // Parse Localization directory + Localizations.parseDir(); + // For every file specified in the Localization library class, load them into the Language Registry for (String localizationFile : Localizations.localeFiles) { LanguageRegistry.instance().loadLocalization(localizationFile, LocalizationHelper.getLocaleFromFileName(localizationFile), LocalizationHelper.isXMLLanguageFile(localizationFile)); diff --git a/ee3_common/com/pahimar/ee3/lib/Localizations.java b/ee3_common/com/pahimar/ee3/lib/Localizations.java index 0466f8c5..eaad3ad2 100644 --- a/ee3_common/com/pahimar/ee3/lib/Localizations.java +++ b/ee3_common/com/pahimar/ee3/lib/Localizations.java @@ -1,5 +1,10 @@ package com.pahimar.ee3.lib; +import java.io.File; +import java.util.logging.Level; + +import com.pahimar.ee3.core.helper.LogHelper; + /** * Equivalent-Exchange-3 * @@ -13,6 +18,31 @@ public class Localizations { private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/"; - public static String[] localeFiles = { LANG_RESOURCE_LOCATION + "cs_CZ.xml", LANG_RESOURCE_LOCATION + "cy_GB.xml", LANG_RESOURCE_LOCATION + "da_DK.xml", LANG_RESOURCE_LOCATION + "de_DE.xml", LANG_RESOURCE_LOCATION + "en_US.xml", LANG_RESOURCE_LOCATION + "es_ES.xml", LANG_RESOURCE_LOCATION + "fi_FI.xml", LANG_RESOURCE_LOCATION + "fr_FR.xml", LANG_RESOURCE_LOCATION + "it_IT.xml", LANG_RESOURCE_LOCATION + "ja_JP.xml", LANG_RESOURCE_LOCATION + "la_IT.xml", LANG_RESOURCE_LOCATION + "nl_NL.xml", LANG_RESOURCE_LOCATION + "nb_NO.xml", LANG_RESOURCE_LOCATION + "pl_PL.xml", LANG_RESOURCE_LOCATION + "pt_BR.xml", LANG_RESOURCE_LOCATION + "pt_PT.xml", LANG_RESOURCE_LOCATION + "ru_RU.xml", LANG_RESOURCE_LOCATION + "sk_SK.xml", LANG_RESOURCE_LOCATION + "sr_RS.xml", LANG_RESOURCE_LOCATION + "sv_SE.xml", LANG_RESOURCE_LOCATION + "tr_TR.xml", LANG_RESOURCE_LOCATION + "zh_CN.xml", LANG_RESOURCE_LOCATION + "zh_TW.xml" }; + public static String[] localeFiles; + + /** + * parseDir + * + * Parses LANG_RESOURCE_LOCATION for any localizations and loads them into localeFiles + * + * @author Robotic-Brain + * + */ + public static void parseDir() { + try { + File resourceFolder = new File(Localizations.class.getResource(LANG_RESOURCE_LOCATION).toURI()); + File[] files = resourceFolder.listFiles(); + + localeFiles = new String[files.length]; + + int i = 0; + for (File resource : files) { + localeFiles[i++] = LANG_RESOURCE_LOCATION + resource.getName(); + LogHelper.log(Level.INFO, "Added localization file: " + resource.getName()); + } + } catch (Exception e) { + LogHelper.log(Level.WARNING, "Unable to load language files!"); + } + } } From a76dda6444d471e37de2a3cf75b28b2d84edcd6c Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Wed, 24 Apr 2013 21:23:26 +0200 Subject: [PATCH 03/16] Derped commit message the last commit fixes #317 --- ee3_common/com/pahimar/ee3/lib/Localizations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee3_common/com/pahimar/ee3/lib/Localizations.java b/ee3_common/com/pahimar/ee3/lib/Localizations.java index eaad3ad2..cd376f76 100644 --- a/ee3_common/com/pahimar/ee3/lib/Localizations.java +++ b/ee3_common/com/pahimar/ee3/lib/Localizations.java @@ -17,7 +17,7 @@ import com.pahimar.ee3.core.helper.LogHelper; public class Localizations { private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/"; - + public static String[] localeFiles; /** From 21121e6f9661105aa8f0da8479373e5ce496b11d Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Thu, 25 Apr 2013 23:13:06 +0200 Subject: [PATCH 04/16] Fixed language loading from Jar not working --- .../com/pahimar/ee3/lib/Localizations.java | 96 +++++++++++++++++-- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/ee3_common/com/pahimar/ee3/lib/Localizations.java b/ee3_common/com/pahimar/ee3/lib/Localizations.java index cd376f76..9f058d6c 100644 --- a/ee3_common/com/pahimar/ee3/lib/Localizations.java +++ b/ee3_common/com/pahimar/ee3/lib/Localizations.java @@ -1,6 +1,16 @@ package com.pahimar.ee3.lib; import java.io.File; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; import java.util.logging.Level; import com.pahimar.ee3.core.helper.LogHelper; @@ -17,6 +27,7 @@ import com.pahimar.ee3.core.helper.LogHelper; public class Localizations { private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/"; + private static final String JAR_SUBDIRECTORY = "mods/ee3/lang/"; public static String[] localeFiles; @@ -30,19 +41,86 @@ public class Localizations { */ public static void parseDir() { try { - File resourceFolder = new File(Localizations.class.getResource(LANG_RESOURCE_LOCATION).toURI()); - File[] files = resourceFolder.listFiles(); + URL resourceURL = Localizations.class.getResource(LANG_RESOURCE_LOCATION); - localeFiles = new String[files.length]; - - int i = 0; - for (File resource : files) { - localeFiles[i++] = LANG_RESOURCE_LOCATION + resource.getName(); - LogHelper.log(Level.INFO, "Added localization file: " + resource.getName()); + if (resourceURL == null) { + throw new Exception("NULL POINTER!"); } + + if (resourceURL.getProtocol().equals("file")) { + parseNormalDirectory(resourceURL); + + } else if (resourceURL.getProtocol().equals("jar")) { + parseJarFile(resourceURL); + } + + LogHelper.log(Level.INFO, "Loaded " + localeFiles.length + " localizations"); } catch (Exception e) { - LogHelper.log(Level.WARNING, "Unable to load language files!"); + LogHelper.log(Level.SEVERE, "Unable to load language files!"); + e.printStackTrace(System.err); } } + + /** + * parseNormalDirectory + * + * Parses a normal Directory on the filesystem into localeFiles + * @author Robotic-Brain + * + * @param resourceURL Parent directory URL + * @throws URISyntaxException + */ + private static void parseNormalDirectory(URL resourceURL) throws URISyntaxException { + LogHelper.log(Level.INFO, "Loading FILE"); + + File resourceFolder = new File(resourceURL.toURI()); + File[] files = resourceFolder.listFiles(); + + localeFiles = new String[files.length]; + + int i = 0; + for (File resource : files) { + localeFiles[i++] = LANG_RESOURCE_LOCATION + resource.getName(); + LogHelper.log(Level.INFO, "Added localization file: " + resource.getName()); + } + } + + + /** + * parseJarFile + * + * Walks a jar file and ads all files in given "subdirectory" (JAR_SUBDIRECTORY) to localeFiles + * @author Robotic-Brain + * + * @param resourceURL + * @throws UnsupportedEncodingException + * @throws IOException + */ + private static void parseJarFile(URL resourceURL) throws UnsupportedEncodingException, IOException { + LogHelper.log(Level.INFO, "Loading JAR"); + + // Getting Jar file Object + String jarFileString = resourceURL.getPath().substring(5, resourceURL.getPath().indexOf("!")); + JarFile jarFile = new JarFile(URLDecoder.decode(jarFileString, "UTF-8")); + + // Iterate over entries + ArrayList files = new ArrayList(); + Enumeration entries = jarFile.entries(); + while (entries.hasMoreElements()) { + String jarSubPath = entries.nextElement().getName(); + + // Only search specific Directory + if (jarSubPath.startsWith(JAR_SUBDIRECTORY)) { + jarSubPath = jarSubPath.substring(JAR_SUBDIRECTORY.length()); + if (!jarSubPath.trim().isEmpty() && jarSubPath.indexOf("/") < 0) { + // If file and not dir add to list + files.add(LANG_RESOURCE_LOCATION + jarSubPath); + LogHelper.log(Level.INFO, "Added localization file: " + jarSubPath); + } + } + } + + localeFiles = files.toArray(new String[files.size()]); + } } From cd07292149341414f79bde85d85915033f95335c Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Fri, 2 Aug 2013 04:17:44 +0200 Subject: [PATCH 05/16] Reset to 2c35d3adca0310448e5dc8aee8fb483bfb8656e4 --- README.md | 59 +- build_number.properties | 4 +- .../com/pahimar/ee3/EquivalentExchange3.java | 191 ++++--- .../pahimar/ee3/block/BlockAludelBase.java | 42 +- ee3_common/com/pahimar/ee3/block/BlockEE.java | 11 +- .../com/pahimar/ee3/block/BlockGlassBell.java | 119 +++- .../com/pahimar/ee3/block/ModBlocks.java | 19 +- .../ee3/client/audio/SoundHandler.java | 8 +- .../gui/inventory/GuiAlchemicalBag.java | 73 +-- .../gui/inventory/GuiAlchemicalChest.java | 5 +- .../ee3/client/gui/inventory/GuiAludel.java | 2 +- .../client/gui/inventory/GuiCalcinator.java | 5 +- .../client/gui/inventory/GuiGlassBell.java | 2 +- .../gui/inventory/GuiPortableCrafting.java | 4 +- .../inventory/GuiPortableTransmutation.java | 5 +- .../ee3/client/renderer/RenderUtils.java | 11 +- .../item/ItemAlchemicalChestRenderer.java | 6 +- .../renderer/item/ItemAludelRenderer.java | 6 +- .../renderer/item/ItemCalcinatorRenderer.java | 6 +- .../renderer/item/ItemGlassBellRenderer.java | 6 +- .../TileEntityAlchemicalChestRenderer.java | 5 +- .../tileentity/TileEntityAludelRenderer.java | 93 +++- .../TileEntityCalcinatorRenderer.java | 5 +- .../TileEntityGlassBellRenderer.java | 209 ++++++- .../com/pahimar/ee3/command/CommandEE.java | 6 + .../pahimar/ee3/command/CommandOverlay.java | 32 +- .../pahimar/ee3/command/CommandParticles.java | 7 +- .../pahimar/ee3/command/CommandSounds.java | 9 +- .../pahimar/ee3/command/CommandVersion.java | 5 +- .../configuration/ConfigurationHandler.java | 2 +- .../ee3/core/addons/AddonRedPower2.java | 47 -- .../ee3/core/handlers/AddonHandler.java | 3 - .../ee3/core/handlers/CraftingHandler.java | 3 +- .../handlers/DrawBlockHighlightHandler.java | 24 +- .../core/handlers/EntityLivingHandler.java | 6 +- .../ee3/core/handlers/EquivalencyHandler.java | 5 +- .../core/handlers/InterModCommsHandler.java | 98 ++++ .../ee3/core/handlers/ItemEventHandler.java | 2 +- .../ee3/core/handlers/KeyBindingHandler.java | 6 +- .../core/handlers/LocalizationHandler.java | 9 +- .../TransmutationTargetOverlayHandler.java | 15 +- .../handlers/VersionCheckTickHandler.java | 2 +- .../handlers/WorldTransmutationHandler.java | 2 +- .../ee3/core/helper/ItemDropHelper.java | 32 -- .../pahimar/ee3/core/helper/LogHelper.java | 33 -- .../pahimar/ee3/core/helper/NBTHelper.java | 198 ------- .../pahimar/ee3/core/helper/RecipeHelper.java | 174 ------ .../pahimar/ee3/core/proxy/ClientProxy.java | 44 +- .../pahimar/ee3/core/proxy/CommonProxy.java | 4 + .../pahimar/ee3/core/util/EnergyStack.java | 49 ++ .../core/{helper => util}/GeneralHelper.java | 6 +- .../com/pahimar/ee3/core/util/ItemUtil.java | 204 +++++++ .../KeyBindingUtil.java} | 4 +- .../LocalizationUtil.java} | 4 +- .../com/pahimar/ee3/core/util/LogHelper.java | 72 +++ .../com/pahimar/ee3/core/util/OreStack.java | 97 ++++ .../core/{helper => util}/QualityHelper.java | 2 +- .../pahimar/ee3/core/util/RecipeHelper.java | 175 ++++++ .../ee3/core/util/ResourceLocationHelper.java | 13 + .../{helper => util}/TransmutationHelper.java | 18 +- .../core/{helper => util}/VersionHelper.java | 15 +- .../ee3/creativetab/CreativeTabEE3.java | 22 +- ee3_common/com/pahimar/ee3/emc/DynEMC.java | 161 ++++++ ee3_common/com/pahimar/ee3/emc/EMCEntry.java | 109 ---- .../com/pahimar/ee3/emc/EMCRegistry.java | 108 ---- ee3_common/com/pahimar/ee3/emc/EMCType.java | 14 - .../com/pahimar/ee3/emc/EmcBlackList.java | 119 ++++ .../com/pahimar/ee3/emc/EmcComponent.java | 46 ++ .../com/pahimar/ee3/emc/EmcDefaultValues.java | 15 + ee3_common/com/pahimar/ee3/emc/EmcMap.java | 37 ++ ee3_common/com/pahimar/ee3/emc/EmcType.java | 5 + ee3_common/com/pahimar/ee3/emc/EmcValue.java | 161 ++++++ .../com/pahimar/ee3/emc/EquivalencyGroup.java | 113 ++++ .../ee3/emc/graph/WeightedDirectedGraph.java | 272 ++++++++++ .../pahimar/ee3/emc/graph/WeightedEdge.java | 55 ++ .../ee3/inventory/ContainerAlchemicalBag.java | 48 +- .../inventory/ContainerAlchemicalChest.java | 6 +- .../ee3/inventory/ContainerAludel.java | 67 ++- .../ee3/inventory/ContainerCalcinator.java | 92 ++-- .../ee3/inventory/ContainerGlassBell.java | 32 +- .../inventory/ContainerPortableCrafting.java | 6 +- .../ContainerPortableTransmutation.java | 6 +- .../ee3/inventory/WorldSavedDataEE.java | 2 +- .../pahimar/ee3/item/CustomWrappedStack.java | 290 ++++++++++ .../pahimar/ee3/item/ItemAlchemicalBag.java | 32 +- .../com/pahimar/ee3/item/ItemMiniumStone.java | 16 +- .../ee3/item/ItemPhilosophersStone.java | 13 +- .../ee3/item/crafting/RecipeRegistry.java | 301 +++++++++++ .../crafting/RecipesAlchemicalBagDyes.java | 4 +- .../ee3/item/crafting/RecipesPotions.java | 292 ++++++++++ .../ee3/item/crafting/RecipesSmelting.java | 48 ++ .../ee3/item/crafting/RecipesVanilla.java | 49 ++ .../item/crafting/TransmutationManager.java | 4 +- ee3_common/com/pahimar/ee3/lib/BlockIds.java | 4 +- .../com/pahimar/ee3/lib/InterModComms.java | 14 + .../com/pahimar/ee3/lib/Localizations.java | 114 +--- ee3_common/com/pahimar/ee3/lib/Models.java | 2 +- ee3_common/com/pahimar/ee3/lib/Reference.java | 2 + ee3_common/com/pahimar/ee3/lib/Sounds.java | 4 +- ee3_common/com/pahimar/ee3/lib/Strings.java | 17 +- ee3_common/com/pahimar/ee3/lib/Textures.java | 44 +- ee3_common/com/pahimar/ee3/nbt/NBTHelper.java | 508 ++++++++++++++++++ .../ee3/network/PacketTypeHandler.java | 11 +- .../packet/PacketTileWithItemUpdate.java | 78 +++ .../ee3/recipe/RecipesTransmutationStone.java | 215 -------- .../ee3/tileentity/TileAlchemicalChest.java | 29 +- .../pahimar/ee3/tileentity/TileAludel.java | 60 ++- .../ee3/tileentity/TileCalcinator.java | 31 +- .../com/pahimar/ee3/tileentity/TileEE.java | 16 +- .../pahimar/ee3/tileentity/TileGlassBell.java | 50 +- resources/{mods => assets}/ee3/lang/cs_CZ.xml | 102 ++-- resources/{mods => assets}/ee3/lang/cy_GB.xml | 0 resources/{mods => assets}/ee3/lang/da_DK.xml | 0 resources/{mods => assets}/ee3/lang/de_DE.xml | 20 +- resources/assets/ee3/lang/el_GR.xml | 54 ++ resources/{mods => assets}/ee3/lang/en_US.xml | 0 resources/{mods => assets}/ee3/lang/es_ES.xml | 20 +- resources/{mods => assets}/ee3/lang/fi_FI.xml | 18 +- resources/{mods => assets}/ee3/lang/fr_FR.xml | 12 +- resources/{mods => assets}/ee3/lang/it_IT.xml | 0 resources/{mods => assets}/ee3/lang/ja_JP.xml | 72 +-- resources/{mods => assets}/ee3/lang/la_IT.xml | 0 resources/{mods => assets}/ee3/lang/nb_NO.xml | 0 resources/{mods => assets}/ee3/lang/nl_NL.xml | 3 +- resources/assets/ee3/lang/pl_PL.xml | 54 ++ resources/assets/ee3/lang/pt_BR.xml | 54 ++ resources/{mods => assets}/ee3/lang/pt_PT.xml | 34 +- resources/{mods => assets}/ee3/lang/ru_RU.xml | 106 ++-- resources/{mods => assets}/ee3/lang/sk_SK.xml | 0 resources/assets/ee3/lang/sl_SI.xml | 54 ++ resources/assets/ee3/lang/sr_SP.xml | 54 ++ resources/{mods => assets}/ee3/lang/sv_SE.xml | 0 resources/{mods => assets}/ee3/lang/tr_TR.xml | 0 resources/{mods => assets}/ee3/lang/zh_CN.xml | 108 ++-- resources/{mods => assets}/ee3/lang/zh_TW.xml | 106 ++-- .../{mods => assets}/ee3/models/aludel.obj | 0 .../ee3/models/calcinator.obj | 0 .../{mods => assets}/ee3/sound/chargeDown.ogg | Bin .../{mods => assets}/ee3/sound/chargeUp.ogg | Bin .../{mods => assets}/ee3/sound/destruct.ogg | Bin resources/{mods => assets}/ee3/sound/fail.ogg | Bin resources/{mods => assets}/ee3/sound/gust.ogg | Bin resources/{mods => assets}/ee3/sound/heal.ogg | Bin .../{mods => assets}/ee3/sound/kinesis.ogg | Bin .../{mods => assets}/ee3/sound/launch.ogg | Bin resources/{mods => assets}/ee3/sound/nova.ogg | Bin .../{mods => assets}/ee3/sound/philball.ogg | Bin resources/{mods => assets}/ee3/sound/tock.ogg | Bin .../{mods => assets}/ee3/sound/transmute.ogg | Bin resources/{mods => assets}/ee3/sound/wall.ogg | Bin .../{mods => assets}/ee3/sound/waterball.ogg | Bin resources/{mods => assets}/ee3/sound/wind.ogg | Bin .../ee3/textures/blocks/alchemicalChest.png | Bin .../ee3/textures/blocks/aludel.png | Bin .../ee3/textures/blocks/calcinator.png | Bin .../ee3/textures/blocks/glassBell.png | Bin .../ee3/textures/effects/noise.png | Bin .../ee3/textures/gui/alchemicalStorage.png | Bin .../ee3/textures/gui/aludel.png | Bin .../ee3/textures/gui/calcinator.png | Bin .../ee3/textures/gui/glassBell.png | Bin resources/assets/ee3/textures/gui/ocarina.png | Bin 0 -> 6080 bytes .../textures/gui/portableTransmutation.png | Bin .../textures/gui/sharedAlchemicalStorage.png | Bin .../textures/items/alchemicalBagClosed.png | Bin .../items/alchemicalBagClosedDrawString.png | Bin .../ee3/textures/items/alchemicalBagOpen.png | Bin .../items/alchemicalBagOpenDrawString.png | Bin .../items/alchemicalDustAmaranthine.png | Bin .../ee3/textures/items/alchemicalDustAsh.png | Bin .../textures/items/alchemicalDustAzure.png | Bin .../items/alchemicalDustIridescent.png | Bin .../textures/items/alchemicalDustMinium.png | Bin .../textures/items/alchemicalDustVerdant.png | Bin .../ee3/textures/items/algotGeneric.png | Bin .../ee3/textures/items/chalk.png | Bin .../ee3/textures/items/diviningRod.png | Bin .../textures/items/diviningRodEffectGlow.png | Bin resources/assets/ee3/textures/items/kunai.png | Bin 0 -> 576 bytes .../ee3/textures/items/ocarina.png | Bin .../assets/ee3/textures/items/shardMinium.png | Bin 0 -> 1326 bytes .../ee3/textures/items/spear1.png | Bin .../ee3/textures/items/spear2.png | Bin .../ee3/textures/items/spear3.png | Bin .../ee3/textures/items/spear4.png | Bin .../ee3/textures/items/staff1.png | Bin .../ee3/textures/items/staff2.png | Bin .../ee3/textures/items/staff3.png | Bin .../ee3/textures/items/staff4.png | Bin .../ee3/textures/items/staff5.png | Bin .../ee3/textures/items/staff6.png | Bin .../ee3/textures/items/stoneEffectFlame.png | Bin .../ee3/textures/items/stoneInert.png | Bin .../ee3/textures/items/stoneMinium.png | Bin .../ee3/textures/items/stonePhilosophers.png | Bin .../ee3/textures/logo/logo.png | Bin .../ee3/textures/models/alchemicalChest.png | Bin .../ee3/textures/models/aludel.png | Bin .../ee3/textures/models/calcinator.png | Bin .../textures/xcf/blocks/alchemicalChest.xcf | Bin .../ee3/textures/xcf/blocks/aludel.xcf | Bin .../ee3/textures/xcf/blocks/calcinator.xcf | Bin .../ee3/textures/xcf/blocks/glassBell.xcf | Bin .../ee3/textures/xcf/effects/noise.xcf | Bin .../textures/xcf/gui/alchemicalStorage.xcf | Bin .../ee3/textures/xcf/gui/aludel.xcf | Bin 45139 -> 45718 bytes .../ee3/textures/xcf/gui/base_gui.xcf | Bin .../ee3/textures/xcf/gui/calcinator.xcf | Bin .../ee3/textures/xcf/gui/glassBell.xcf | Bin .../assets/ee3/textures/xcf/gui/ocarina.xcf | Bin 0 -> 15138 bytes .../xcf/gui/portableTransmutation.xcf | Bin .../xcf/gui/sharedAlchemicalStorage.xcf | Bin .../xcf/items/alchemicalBagClosed.xcf | Bin .../items/alchemicalBagClosedDrawString.xcf | Bin .../textures/xcf/items/alchemicalBagOpen.xcf | Bin .../xcf/items/alchemicalBagOpenDrawString.xcf | Bin .../ee3/textures/xcf/items/algotGeneric.xcf | Bin .../ee3/textures/xcf/items/chalk.xcf | Bin .../ee3/textures/xcf/items/diviningRod.xcf | Bin .../xcf/items/diviningRodEffectGlow.xcf | Bin .../xcf/items/dustAlchemicalAmaranthine.xcf | Bin .../textures/xcf/items/dustAlchemicalAsh.xcf | Bin .../xcf/items/dustAlchemicalAzure.xcf | Bin .../xcf/items/dustAlchemicalIridescent.xcf | Bin .../xcf/items/dustAlchemicalMinium.xcf | Bin .../xcf/items/dustAlchemicalVerdant.xcf | Bin .../assets/ee3/textures/xcf/items/kunai.xcf | Bin 0 -> 1627 bytes .../ee3/textures/xcf/items/ocarina.xcf | Bin .../ee3/textures/xcf/items/shardMinium.xcf | Bin .../ee3/textures/xcf/items/spear1.xcf | Bin .../ee3/textures/xcf/items/spear2.xcf | Bin .../ee3/textures/xcf/items/spear3.xcf | Bin .../ee3/textures/xcf/items/spear4.xcf | Bin .../ee3/textures/xcf/items/staff1.xcf | Bin .../ee3/textures/xcf/items/staff2.xcf | Bin .../ee3/textures/xcf/items/staff3.xcf | Bin .../ee3/textures/xcf/items/staff4.xcf | Bin .../ee3/textures/xcf/items/staff5.xcf | Bin .../ee3/textures/xcf/items/staff6.xcf | Bin .../textures/xcf/items/stoneEffectFlame.xcf | Bin .../ee3/textures/xcf/items/stoneInert.xcf | Bin .../ee3/textures/xcf/items/stoneMinium.xcf | Bin .../textures/xcf/items/stonePhilosophers.xcf | Bin .../ee3/textures/xcf/logo/logo.xcf | Bin .../textures/xcf/models/alchemicalChest.xcf | Bin .../ee3/textures/xcf/models/aludel.xcf | Bin .../ee3/textures/xcf/models/calcinator.xcf | Bin resources/mods/ee3/lang/pl_PL.xml | 32 -- resources/mods/ee3/lang/pt_BR.xml | 31 -- resources/mods/ee3/lang/sr_RS.xml | 31 -- .../mods/ee3/textures/items/shardMinium.png | Bin 404 -> 0 bytes version.xml | 1 + 252 files changed, 5136 insertions(+), 1897 deletions(-) delete mode 100644 ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java create mode 100644 ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java delete mode 100644 ee3_common/com/pahimar/ee3/core/helper/ItemDropHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/helper/LogHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java create mode 100644 ee3_common/com/pahimar/ee3/core/util/EnergyStack.java rename ee3_common/com/pahimar/ee3/core/{helper => util}/GeneralHelper.java (89%) create mode 100644 ee3_common/com/pahimar/ee3/core/util/ItemUtil.java rename ee3_common/com/pahimar/ee3/core/{helper/KeyBindingHelper.java => util/KeyBindingUtil.java} (95%) rename ee3_common/com/pahimar/ee3/core/{helper/LocalizationHelper.java => util/LocalizationUtil.java} (94%) create mode 100644 ee3_common/com/pahimar/ee3/core/util/LogHelper.java create mode 100644 ee3_common/com/pahimar/ee3/core/util/OreStack.java rename ee3_common/com/pahimar/ee3/core/{helper => util}/QualityHelper.java (96%) create mode 100644 ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java create mode 100644 ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java rename ee3_common/com/pahimar/ee3/core/{helper => util}/TransmutationHelper.java (89%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/VersionHelper.java (95%) create mode 100644 ee3_common/com/pahimar/ee3/emc/DynEMC.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EMCEntry.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EMCRegistry.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EMCType.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EmcBlackList.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EmcComponent.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EmcMap.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EmcType.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EmcValue.java create mode 100644 ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java create mode 100644 ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java create mode 100644 ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java create mode 100644 ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java create mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java create mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java create mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java create mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java create mode 100644 ee3_common/com/pahimar/ee3/lib/InterModComms.java create mode 100644 ee3_common/com/pahimar/ee3/nbt/NBTHelper.java create mode 100644 ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java delete mode 100644 ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java rename resources/{mods => assets}/ee3/lang/cs_CZ.xml (98%) rename resources/{mods => assets}/ee3/lang/cy_GB.xml (100%) rename resources/{mods => assets}/ee3/lang/da_DK.xml (100%) rename resources/{mods => assets}/ee3/lang/de_DE.xml (86%) create mode 100644 resources/assets/ee3/lang/el_GR.xml rename resources/{mods => assets}/ee3/lang/en_US.xml (100%) rename resources/{mods => assets}/ee3/lang/es_ES.xml (87%) rename resources/{mods => assets}/ee3/lang/fi_FI.xml (84%) rename resources/{mods => assets}/ee3/lang/fr_FR.xml (87%) rename resources/{mods => assets}/ee3/lang/it_IT.xml (100%) rename resources/{mods => assets}/ee3/lang/ja_JP.xml (94%) rename resources/{mods => assets}/ee3/lang/la_IT.xml (100%) rename resources/{mods => assets}/ee3/lang/nb_NO.xml (100%) rename resources/{mods => assets}/ee3/lang/nl_NL.xml (97%) create mode 100644 resources/assets/ee3/lang/pl_PL.xml create mode 100644 resources/assets/ee3/lang/pt_BR.xml rename resources/{mods => assets}/ee3/lang/pt_PT.xml (73%) rename resources/{mods => assets}/ee3/lang/ru_RU.xml (83%) rename resources/{mods => assets}/ee3/lang/sk_SK.xml (100%) create mode 100644 resources/assets/ee3/lang/sl_SI.xml create mode 100644 resources/assets/ee3/lang/sr_SP.xml rename resources/{mods => assets}/ee3/lang/sv_SE.xml (100%) rename resources/{mods => assets}/ee3/lang/tr_TR.xml (100%) rename resources/{mods => assets}/ee3/lang/zh_CN.xml (94%) rename resources/{mods => assets}/ee3/lang/zh_TW.xml (97%) rename resources/{mods => assets}/ee3/models/aludel.obj (100%) rename resources/{mods => assets}/ee3/models/calcinator.obj (100%) rename resources/{mods => assets}/ee3/sound/chargeDown.ogg (100%) rename resources/{mods => assets}/ee3/sound/chargeUp.ogg (100%) rename resources/{mods => assets}/ee3/sound/destruct.ogg (100%) rename resources/{mods => assets}/ee3/sound/fail.ogg (100%) rename resources/{mods => assets}/ee3/sound/gust.ogg (100%) rename resources/{mods => assets}/ee3/sound/heal.ogg (100%) rename resources/{mods => assets}/ee3/sound/kinesis.ogg (100%) rename resources/{mods => assets}/ee3/sound/launch.ogg (100%) rename resources/{mods => assets}/ee3/sound/nova.ogg (100%) rename resources/{mods => assets}/ee3/sound/philball.ogg (100%) rename resources/{mods => assets}/ee3/sound/tock.ogg (100%) rename resources/{mods => assets}/ee3/sound/transmute.ogg (100%) rename resources/{mods => assets}/ee3/sound/wall.ogg (100%) rename resources/{mods => assets}/ee3/sound/waterball.ogg (100%) rename resources/{mods => assets}/ee3/sound/wind.ogg (100%) rename resources/{mods => assets}/ee3/textures/blocks/alchemicalChest.png (100%) rename resources/{mods => assets}/ee3/textures/blocks/aludel.png (100%) rename resources/{mods => assets}/ee3/textures/blocks/calcinator.png (100%) rename resources/{mods => assets}/ee3/textures/blocks/glassBell.png (100%) rename resources/{mods => assets}/ee3/textures/effects/noise.png (100%) rename resources/{mods => assets}/ee3/textures/gui/alchemicalStorage.png (100%) rename resources/{mods => assets}/ee3/textures/gui/aludel.png (100%) rename resources/{mods => assets}/ee3/textures/gui/calcinator.png (100%) rename resources/{mods => assets}/ee3/textures/gui/glassBell.png (100%) create mode 100644 resources/assets/ee3/textures/gui/ocarina.png rename resources/{mods => assets}/ee3/textures/gui/portableTransmutation.png (100%) rename resources/{mods => assets}/ee3/textures/gui/sharedAlchemicalStorage.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalBagClosed.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalBagClosedDrawString.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalBagOpen.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalBagOpenDrawString.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalDustAmaranthine.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalDustAsh.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalDustAzure.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalDustIridescent.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalDustMinium.png (100%) rename resources/{mods => assets}/ee3/textures/items/alchemicalDustVerdant.png (100%) rename resources/{mods => assets}/ee3/textures/items/algotGeneric.png (100%) rename resources/{mods => assets}/ee3/textures/items/chalk.png (100%) rename resources/{mods => assets}/ee3/textures/items/diviningRod.png (100%) rename resources/{mods => assets}/ee3/textures/items/diviningRodEffectGlow.png (100%) create mode 100644 resources/assets/ee3/textures/items/kunai.png rename resources/{mods => assets}/ee3/textures/items/ocarina.png (100%) create mode 100644 resources/assets/ee3/textures/items/shardMinium.png rename resources/{mods => assets}/ee3/textures/items/spear1.png (100%) rename resources/{mods => assets}/ee3/textures/items/spear2.png (100%) rename resources/{mods => assets}/ee3/textures/items/spear3.png (100%) rename resources/{mods => assets}/ee3/textures/items/spear4.png (100%) rename resources/{mods => assets}/ee3/textures/items/staff1.png (100%) rename resources/{mods => assets}/ee3/textures/items/staff2.png (100%) rename resources/{mods => assets}/ee3/textures/items/staff3.png (100%) rename resources/{mods => assets}/ee3/textures/items/staff4.png (100%) rename resources/{mods => assets}/ee3/textures/items/staff5.png (100%) rename resources/{mods => assets}/ee3/textures/items/staff6.png (100%) rename resources/{mods => assets}/ee3/textures/items/stoneEffectFlame.png (100%) rename resources/{mods => assets}/ee3/textures/items/stoneInert.png (100%) rename resources/{mods => assets}/ee3/textures/items/stoneMinium.png (100%) rename resources/{mods => assets}/ee3/textures/items/stonePhilosophers.png (100%) rename resources/{mods => assets}/ee3/textures/logo/logo.png (100%) rename resources/{mods => assets}/ee3/textures/models/alchemicalChest.png (100%) rename resources/{mods => assets}/ee3/textures/models/aludel.png (100%) rename resources/{mods => assets}/ee3/textures/models/calcinator.png (100%) rename resources/{mods => assets}/ee3/textures/xcf/blocks/alchemicalChest.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/blocks/aludel.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/blocks/calcinator.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/blocks/glassBell.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/effects/noise.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/gui/alchemicalStorage.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/gui/aludel.xcf (91%) rename resources/{mods => assets}/ee3/textures/xcf/gui/base_gui.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/gui/calcinator.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/gui/glassBell.xcf (100%) create mode 100644 resources/assets/ee3/textures/xcf/gui/ocarina.xcf rename resources/{mods => assets}/ee3/textures/xcf/gui/portableTransmutation.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/gui/sharedAlchemicalStorage.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/alchemicalBagClosed.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/alchemicalBagClosedDrawString.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/alchemicalBagOpen.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/alchemicalBagOpenDrawString.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/algotGeneric.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/chalk.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/diviningRod.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/diviningRodEffectGlow.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/dustAlchemicalAmaranthine.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/dustAlchemicalAsh.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/dustAlchemicalAzure.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/dustAlchemicalIridescent.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/dustAlchemicalMinium.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/dustAlchemicalVerdant.xcf (100%) create mode 100644 resources/assets/ee3/textures/xcf/items/kunai.xcf rename resources/{mods => assets}/ee3/textures/xcf/items/ocarina.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/shardMinium.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/spear1.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/spear2.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/spear3.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/spear4.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/staff1.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/staff2.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/staff3.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/staff4.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/staff5.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/staff6.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/stoneEffectFlame.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/stoneInert.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/stoneMinium.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/items/stonePhilosophers.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/logo/logo.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/models/alchemicalChest.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/models/aludel.xcf (100%) rename resources/{mods => assets}/ee3/textures/xcf/models/calcinator.xcf (100%) delete mode 100644 resources/mods/ee3/lang/pl_PL.xml delete mode 100644 resources/mods/ee3/lang/pt_BR.xml delete mode 100644 resources/mods/ee3/lang/sr_RS.xml delete mode 100644 resources/mods/ee3/textures/items/shardMinium.png diff --git a/README.md b/README.md index af7262fa..18b9529d 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,50 @@ ## Welcome to Equivalent Exchange 3! -**LATEST OFFICIAL VERSION**: [EE3 pre1g for 1.5.1] (http://adf.ly/Mj3ZL) +**LATEST OFFICIAL VERSION**: [EE3 pre1h for 1.5.1/1.5.2](http://adf.ly/PdBNy) -[Minecraft Forums page] (http://www.minecraftforum.net/topic/1540010-equivalent-exchange-3) +[Minecraft Forums page](http://www.minecraftforum.net/topic/1540010-equivalent-exchange-3) -[Compiling EE3] (https://github.com/pahimar/Equivalent-Exchange-3#compiling-equivalent-exchange-3) - For those that want the latest unreleased features. +[Compiling EE3](https://github.com/pahimar/Equivalent-Exchange-3#compiling-equivalent-exchange-3) - For those that want the latest unreleased features. -[Contributing] (https://github.com/pahimar/Equivalent-Exchange-3#contributing) - For those that want to help out. +[Contributing](https://github.com/pahimar/Equivalent-Exchange-3#contributing) - For those that want to help out. ### Compiling Equivalent Exchange 3 -IMPORTANT: This is not guaranteed to work as it has not been tested extensively (Linux and Windows tested). +IMPORTANT: Please report any issues you have, there might be some problems with the documentation! *** -#### Prerequisites (Tested for Windows ONLY!) +#### Prerequisites 1. **WARNING: Make sure you know EXACTLY what you're doing! It's not any of our faults if your OS crashes, becomes corrupted, etc.** -2. Download and install the Java JDK [here] (http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html). Scroll down, accept the `Oracle Binary Code License Agreement for Java SE`, and download the one pertaining to your OS (necessary for MCP). +2. Download and install the Java JDK [here](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html). Scroll down, accept the `Oracle Binary Code License Agreement for Java SE`, and download the one pertaining to your OS (necessary for MCP). * Go to `Control Panel\System and Security\System`, and click on `Advanced System Settings` on the left-hand side. * Click on `Environment Variables`. * Under `System Variables`, click `New`. * For `Variable Name`, input `JAVA_HOME`. - * For `Variable Value`, input something similar to `;C:\Program Files (x86)\Java\jdk1.7.0_15` exactly as shown to the end (or wherever your Java JDK installation is), and click `Ok`. + * For `Variable Value`, input something similar to `;C:\Program Files (x86)\Java\jdk1.7.0_25` exactly as shown to the end (or wherever your Java JDK installation is), and click `Ok`. * Scroll down to a variable named `Path`, and double-click on it. - * Append `;C:\Program Files (x86)\Java\jdk1.7.0_15\bin` (or your Java JDK installation directory\bin), and click `Ok`. -3. Download Apache Ant [here] (http://ant.apache.org). + * Append `;C:\Program Files (x86)\Java\jdk1.7.0_25\bin` (or your Java JDK installation directory\bin), and click `Ok`. +3. Download Apache Ant [here](http://ant.apache.org). * Unzip the files anywhere you want, eg `C:\Program Files (x86)\Ant`. * Again, go to `Environment Variables` just like you did for the Java JDK. * Under `System Variables`, click `New`. * For `Variable Name`, input `ANT_HOME`. * For `Variable Value`, input `C:\Ant\apache-ant-1.9.0` (or your Ant directory\apache-ant-1.9.0). * Scroll down to `Path`, and double-click on it. - * Append `;C:\Ant\apache-ant-1.8.4\bin` exactly as shown to the end (or your Ant directory\apache-ant-1.9.0\bin). -4. Download and install Github [here] (http://windows.github.com/) (Windows) or [here] (http://mac.github.com/) (Mac OS X 10.7+). For Linux, you could download it as a .zip/tarball and unzip it. + * Append `;C:\Ant\apache-ant-1.9.0\bin` exactly as shown to the end (or your Ant directory\apache-ant-1.9.0\bin). +4. Download and install Github [here](http://windows.github.com/) (Windows) or [here](http://mac.github.com/) (Mac OS X 10.7+). For Linux, you can use a different Git application. NOTE: Github For Windows/Mac is OPTIONAL. You can use your own Git application. * Create an account. - * Scroll to the top of this page, login at the top-right, and then click `Clone to Windows/Mac` near the top-left of the page. + * Scroll to the top of this page, login at the top-right, and then click `Clone to Windows/Mac` at the bottom of the right-hand toolbar. * You should see Github flash and `pahimar/Equivalent-Exchange-3` appear. (The local repository on Windows defaults to `C:\Users\(username)\Documents\GitHub\Equivalent-Exchange-3`, you can change it if you want but then you have to find it again on Github). 5. Create an empty directory for EE3 development. This directory is refernced as `mcdev` from now on. It can be where you cloned EE3, but it'll be a little messy. -#### Setup MCP (Tested on Linux and Windows) -1. Download the latest version of MCP from [here] (http://mcp.ocean-labs.de/index.php/MCP_Releases), e.g. mcp744.zip. Install MCP dependencies as listed on the website if neccessary. +#### Setup MCP +1. Download the latest version of MCP from [here] (http://mcp.ocean-labs.de/download.php?list.2), e.g. mcp751.zip. 2. Inside `mcdev`, create a directory named `mcp` and unzip the MCP .zip file into it. * To verify, check if a file named `CHANGELOG` exists inside `mcp`. -3. Download the latest forge **source** for Minecraft 1.5.1 and unzip it into `mcp`. You need at least Forge 7.7.1.500, best way is to get it from [here] (http://files.minecraftforge.net/). +3. Download the latest Forge **source** for Minecraft 1.5.1/1.5.2 and unzip it into `mcp`. You need at least Forge 7.7.1.500 (Forge 7.8.0.684 if using 1.5.2), the best way is to get it from [here] (http://files.minecraftforge.net/). * To verify, check if a application named `install.sh` exists. -4. Execute `install.sh` (Linux and Mac) or `install.cmd` (Windows), both found in `mcdev\mcp\forge`. On Linux you might have to `chmod +x install.sh` before you can execute it. On some system configurations you need to execute `install.sh` from within the `forge` directory whereas on others it doesn't matter. Just check the output for error messages to find out what you need to do. +4. Execute `install.sh` (Linux and Mac) or `install.cmd` (Windows), both found in `mcdev\mcp\forge`. On Linux you might have to `chmod +x install.sh` before you can execute it. + * This will take some time, be patient. -#### Setup EE3 (Some tested for Linux, tested fully for Windows) +#### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. 3. Right now, you should have a directory that looks something like: @@ -64,14 +65,14 @@ IMPORTANT: This is not guaranteed to work as it has not been tested extensively * Open it up with any text editor, and type into it the following (fully customizable except for `dir.development`): * `dir.development=../../` * `dir.release=Releases` - * `release.minecraft.version=1.5.1` + * `release.minecraft.version=1.5.2` * `release.mod.version=pre2` 5. Open up your OS's command line (Command Prompt in Windows, Terminal in Linux and Mac). 6. Navigate to `mcdev\source\Equivalent-Exchange-3` by executing `cd mcdev's location\source\Equivalent-Exchange-3`. -7. Execute `ant release`. This will generally take around 5-15 minutes, depending on your computer. If you've done everything right, `BUILD SUCCESSFUL` is displayed after it finishes. +7. Execute `ant build`. This will generally take around 5-15 minutes, depending on your computer. If you've done everything right, `BUILD SUCCESSFUL` is displayed after it finishes. * If you see `BUILD FAILED`, check the error output (it should be right around `BUILD FAILED`), fix everything, and try again. -8. Go to `mcdev\source\Equivalent-Exchange-3\Releases\1.5\pre2`. - * You should see a .jar named `ee3-universal-pre2.jar`. +8. Go to `mcdev\source\Equivalent-Exchange-3\Releases\1.5.2\pre2`. + * You should see a `.jar` file named `ee3-universal-pre2.jar`. 9. Copy the jar into your Minecraft mods folder, and play Minecraft! #### Updating Your Repo (For Windows/Mac) @@ -87,19 +88,19 @@ IMPORTANT: This is not guaranteed to work as it has not been tested extensively #### Submitting a PR So you found a bug in pahimar's code? Think you can make it more efficient? Want to help in general? Great! -1. **IMPORTANT: PAHIMAR DOES *NOT* WANT ANY** `build.xml` **CHANGES, UNLESS it fixes up something broken** (See [Pull Request #90] (https://github.com/pahimar/Equivalent-Exchange-3/pull/90)). +1. **IMPORTANT: PAHIMAR DOES *NOT* WANT ANY** `build.xml` **CHANGES, UNLESS it fixes up something broken** (See [Pull Request #90](https://github.com/pahimar/Equivalent-Exchange-3/pull/90)). 2. If you haven't already, create a Github account. -3. Click the little branch/plus icon at the top-right of this page (below your username). +3. Click the `Fork` icon at the top-right of this page (below your username). 4. Make the changes that you want to. -5. Click `Pull Request` at the top-middle of the page (left of your fork's name, to the right of `Watch` and `Fork`). -6. Enter your PR's title, and create a detailed description telling pahimar what you changed. +5. Click `Pull Request` at the right-hand side of the gray bar directly below your fork's name. +6. Click `Click to create a pull request for this comparison`, enter your PR's title, and create a detailed description telling pahimar what you changed. 7. Click `Send pull request`, and you're done! #### Creating an Issue EE3 crashes every time? Have a suggestion? Found a bug? Create an issue now! 1. Please, please don't make any frivolous issues! If it's a crash, try asking the people in IRC or MCF before creating an issue. If it's a bug/suggestion, make sure it hasn't been reported/suggested already. Thanks! :smile: -2. Go to [the issues page] (http://github.com/pahimar/Equivalent-Exchange-3/issues). -3. Click `New Issue` right below `Graphs`. +2. Go to [the issues page](http://github.com/pahimar/Equivalent-Exchange-3/issues). +3. Click `New Issue` right below `Star` and `Fork`. 4. Enter your Issue's title (something that summarizes your issue), and then create a detailed description ("Hey pahimar, could you add/change xxx?" or "Hey, found an exploit: stuff"). -5. Click `Submit new issue`, and you're done! \ No newline at end of file +5. Click `Submit new issue`, and you're done! diff --git a/build_number.properties b/build_number.properties index beff438a..4c77f071 100644 --- a/build_number.properties +++ b/build_number.properties @@ -1,3 +1,3 @@ -#Tue, 16 Apr 2013 14:01:55 -0400 +#Mon, 27 May 2013 09:17:55 -0400 -build_number=6 +build_number=17 diff --git a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java index ab86cf30..e7cd13cf 100644 --- a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java +++ b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java @@ -1,9 +1,11 @@ package com.pahimar.ee3; import java.io.File; -import java.util.logging.Level; +import java.util.Arrays; +import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import net.minecraft.item.crafting.CraftingManager; import net.minecraftforge.common.MinecraftForge; @@ -15,32 +17,33 @@ import com.pahimar.ee3.core.handlers.AddonHandler; import com.pahimar.ee3.core.handlers.CraftingHandler; import com.pahimar.ee3.core.handlers.EntityLivingHandler; import com.pahimar.ee3.core.handlers.FuelHandler; +import com.pahimar.ee3.core.handlers.InterModCommsHandler; import com.pahimar.ee3.core.handlers.ItemEventHandler; import com.pahimar.ee3.core.handlers.LocalizationHandler; import com.pahimar.ee3.core.handlers.PlayerDestroyItemHandler; import com.pahimar.ee3.core.handlers.VersionCheckTickHandler; import com.pahimar.ee3.core.handlers.WorldTransmutationHandler; -import com.pahimar.ee3.core.helper.LogHelper; -import com.pahimar.ee3.core.helper.VersionHelper; import com.pahimar.ee3.core.proxy.CommonProxy; +import com.pahimar.ee3.core.util.LogHelper; +import com.pahimar.ee3.core.util.VersionHelper; import com.pahimar.ee3.creativetab.CreativeTabEE3; +import com.pahimar.ee3.emc.DynEMC; import com.pahimar.ee3.item.ModItems; import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes; +import com.pahimar.ee3.lib.InterModComms; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; import com.pahimar.ee3.network.PacketHandler; -import com.pahimar.ee3.recipe.RecipesTransmutationStone; import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.FingerprintWarning; -import cpw.mods.fml.common.Mod.Init; +import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.Mod.PostInit; -import cpw.mods.fml.common.Mod.PreInit; -import cpw.mods.fml.common.Mod.ServerStarting; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLFingerprintViolationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; @@ -63,108 +66,136 @@ import cpw.mods.fml.relauncher.Side; @NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) public class EquivalentExchange3 { - @Instance(Reference.MOD_ID) - public static EquivalentExchange3 instance; + @Instance(Reference.MOD_ID) + public static EquivalentExchange3 instance; - @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) - public static CommonProxy proxy; + @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) + public static CommonProxy proxy; - public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID); + public static CreativeTabs tabsEE3 = new CreativeTabEE3( + CreativeTabs.getNextID(), Reference.MOD_ID); - @FingerprintWarning - public void invalidFingerprint(FMLFingerprintViolationEvent event) { + @EventHandler + public void invalidFingerprint(FMLFingerprintViolationEvent event) { - // Report (log) to the user that the version of Equivalent Exchange 3 they are using has been changed/tampered with - LogHelper.log(Level.SEVERE, Strings.INVALID_FINGERPRINT_MESSAGE); - } + // Report (log) to the user that the version of Equivalent Exchange 3 + // they are using has been changed/tampered with + LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE); + } - @ServerStarting - public void serverStarting(FMLServerStartingEvent event) { + @EventHandler + public void serverStarting(FMLServerStartingEvent event) { - // Initialize the custom commands - CommandHandler.initCommands(event); - } + // Initialize the custom commands + CommandHandler.initCommands(event); + } - @PreInit - public void preInit(FMLPreInitializationEvent event) { + @EventHandler + public void preInit(FMLPreInitializationEvent event) { - // Initialize the log helper - LogHelper.init(); - - // Load the localization files into the LanguageRegistry - LocalizationHandler.loadLanguages(); + // Initialize the log helper + LogHelper.init(); - // Initialize the configuration - ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME + File.separator + Reference.MOD_ID + ".cfg")); + // Load the localization files into the LanguageRegistry + LocalizationHandler.loadLanguages(); - // Conduct the version check and log the result - VersionHelper.execute(); + // Initialize the configuration + ConfigurationHandler.init(new File(event.getModConfigurationDirectory() + .getAbsolutePath() + + File.separator + + Reference.CHANNEL_NAME + + File.separator + Reference.MOD_ID + ".cfg")); - // Initialize the Version Check Tick Handler (Client only) - TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT); + // Conduct the version check and log the result + VersionHelper.execute(); - // Initialize the Render Tick Handler (Client only) - proxy.registerRenderTickHandler(); + // Initialize the Version Check Tick Handler (Client only) + TickRegistry.registerTickHandler(new VersionCheckTickHandler(), + Side.CLIENT); - // Register the KeyBinding Handler (Client only) - proxy.registerKeyBindingHandler(); + // Initialize the Render Tick Handler (Client only) + proxy.registerRenderTickHandler(); - // Register the Sound Handler (Client only) - proxy.registerSoundHandler(); + // Register the KeyBinding Handler (Client only) + proxy.registerKeyBindingHandler(); - // Initialize mod blocks - ModBlocks.init(); + // Register the Sound Handler (Client only) + proxy.registerSoundHandler(); - // Initialize mod items - ModItems.init(); - } + // Initialize mod blocks + ModBlocks.init(); - @SuppressWarnings("unchecked") - @Init - public void load(FMLInitializationEvent event) { + // Initialize mod items + ModItems.init(); + } - // Register the GUI Handler - NetworkRegistry.instance().registerGuiHandler(instance, proxy); + @EventHandler + @SuppressWarnings("unchecked") + public void load(FMLInitializationEvent event) { - // Register the PlayerDestroyItem Handler - MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler()); + // Register the GUI Handler + NetworkRegistry.instance().registerGuiHandler(instance, proxy); - // Register the Item Pickup Handler - MinecraftForge.EVENT_BUS.register(new ItemEventHandler()); + // Register the PlayerDestroyItem Handler + MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler()); - // Register the EntityLiving Handler - MinecraftForge.EVENT_BUS.register(new EntityLivingHandler()); + // Register the Item Pickup Handler + MinecraftForge.EVENT_BUS.register(new ItemEventHandler()); - MinecraftForge.EVENT_BUS.register(new ActionRequestHandler()); + // Register the EntityLiving Handler + MinecraftForge.EVENT_BUS.register(new EntityLivingHandler()); - MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler()); + MinecraftForge.EVENT_BUS.register(new ActionRequestHandler()); - GameRegistry.registerCraftingHandler(new CraftingHandler()); + MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler()); - // Register the DrawBlockHighlight Handler - proxy.registerDrawBlockHighlightHandler(); + GameRegistry.registerCraftingHandler(new CraftingHandler()); - // Initialize mod tile entities - proxy.registerTileEntities(); + // Register the DrawBlockHighlight Handler + proxy.registerDrawBlockHighlightHandler(); - // Initialize custom rendering and pre-load textures (Client only) - proxy.initRenderingAndTextures(); + // Initialize mod tile entities + proxy.registerTileEntities(); - // Load the Transmutation Stone recipes - RecipesTransmutationStone.init(); + // Initialize custom rendering and pre-load textures (Client only) + proxy.initRenderingAndTextures(); - // Add in the ability to dye Alchemical Bags - CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes()); + // Add in the ability to dye Alchemical Bags + CraftingManager.getInstance().getRecipeList() + .add(new RecipesAlchemicalBagDyes()); - // Register the Fuel Handler - GameRegistry.registerFuelHandler(new FuelHandler()); + // Register the Fuel Handler + GameRegistry.registerFuelHandler(new FuelHandler()); - } + // Quick test to see that sending an encoded recipe to be added to the + // recipe registry works + FMLInterModComms.sendMessage( + Reference.MOD_ID, + InterModComms.ADD_RECIPE, + NBTHelper.encodeRecipeAsNBT(Item.bucketWater, + Arrays.asList(Item.bucketEmpty, Block.waterStill))); + FMLInterModComms.sendMessage( + Reference.MOD_ID, + InterModComms.ADD_RECIPE, + NBTHelper.encodeRecipeAsNBT(Item.bucketLava, + Arrays.asList(Item.bucketEmpty, Block.lavaStill))); + } - @PostInit - public void modsLoaded(FMLPostInitializationEvent event) { + @EventHandler + public void modsLoaded(FMLPostInitializationEvent event) { - // Initialize the Addon Handler - AddonHandler.init(); - } + // Initialize the Addon Handler + AddonHandler.init(); + + // Initialize the DynEMC system + // TODO Seems like this happens earlier than it should now, investigate + // where this should go + DynEMC dynEMC = DynEMC.getInstance(); + } + + @EventHandler + public void handleIMCMessages(IMCEvent event) { + + InterModCommsHandler.processIMCMessages(event); + } } diff --git a/ee3_common/com/pahimar/ee3/block/BlockAludelBase.java b/ee3_common/com/pahimar/ee3/block/BlockAludelBase.java index 4847c2e9..e122cddf 100644 --- a/ee3_common/com/pahimar/ee3/block/BlockAludelBase.java +++ b/ee3_common/com/pahimar/ee3/block/BlockAludelBase.java @@ -3,19 +3,23 @@ package com.pahimar.ee3.block; import java.util.Random; import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.RenderIds; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.tileentity.TileAludel; +import com.pahimar.ee3.tileentity.TileGlassBell; /** * Equivalent-Exchange-3 @@ -36,7 +40,7 @@ public class BlockAludelBase extends BlockEE { public BlockAludelBase(int id) { - super(id, Material.rock); + super(id, Material.anvil); this.setUnlocalizedName(Strings.ALUDEL_NAME); this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F); @@ -71,6 +75,12 @@ public class BlockAludelBase extends BlockEE { public void breakBlock(World world, int x, int y, int z, int id, int meta) { dropInventory(world, x, y, z); + + if (world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) { + world.markBlockForUpdate(x, y + 1, z); + world.updateAllLightTypes(x, y + 1, z); + } + super.breakBlock(world, x, y, z, id, meta); } @@ -92,6 +102,36 @@ public class BlockAludelBase extends BlockEE { } } + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) { + + super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack); + + if (world.getBlockTileEntity(x, y + 1, z) != null && world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) { + + TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y + 1, z); + + tileGlassBell.setOrientation(ForgeDirection.UP); + + if (world.getBlockTileEntity(x, y, z) != null && world.getBlockTileEntity(x, y, z) instanceof TileAludel) { + + TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z); + + ItemStack itemStackGlassBell = tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX); + + tileGlassBell.setInventorySlotContents(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, null); + + tileAludel.setInventorySlotContents(TileAludel.INPUT_INVENTORY_INDEX, itemStackGlassBell); + } + } + } + + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + + return 0; + } + private void dropInventory(World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); diff --git a/ee3_common/com/pahimar/ee3/block/BlockEE.java b/ee3_common/com/pahimar/ee3/block/BlockEE.java index db52fc33..1b4eafa3 100644 --- a/ee3_common/com/pahimar/ee3/block/BlockEE.java +++ b/ee3_common/com/pahimar/ee3/block/BlockEE.java @@ -3,7 +3,7 @@ package com.pahimar.ee3.block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -35,14 +35,19 @@ public abstract class BlockEE extends BlockContainer { @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { - blockIcon = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + this.getUnlocalizedName2()); + blockIcon = iconRegister.registerIcon(String.format("%s:%s", Reference.MOD_ID.toLowerCase(), getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); + } + + protected String getUnwrappedUnlocalizedName(String unlocalizedName) { + + return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } /** * Sets the direction of the block when placed */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) { int direction = 0; int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; diff --git a/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java b/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java index ae44646d..0262ff15 100644 --- a/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java +++ b/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java @@ -2,19 +2,27 @@ package com.pahimar.ee3.block; import java.util.Random; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.RenderIds; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.tileentity.TileAludel; +import com.pahimar.ee3.tileentity.TileEE; import com.pahimar.ee3.tileentity.TileGlassBell; public class BlockGlassBell extends BlockEE { @@ -30,7 +38,6 @@ public class BlockGlassBell extends BlockEE { super(id, Material.glass); this.setUnlocalizedName(Strings.GLASS_BELL_NAME); this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F); this.setHardness(1.0F); } @@ -72,9 +79,15 @@ public class BlockGlassBell extends BlockEE { return false; else { if (!world.isRemote) { - TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z); + TileEntity tileEntityGlassBell = world.getBlockTileEntity(x, y, z); + TileEntity tileEntityAludel = world.getBlockTileEntity(x, y - 1, z); - if (tileGlassBell != null) { + if (tileEntityAludel instanceof TileAludel && tileEntityGlassBell instanceof TileGlassBell) { + player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y - 1, z); + return true; + } + + if (tileEntityGlassBell != null) { player.openGui(EquivalentExchange3.instance, GuiIds.GLASS_BELL, world, x, y, z); } } @@ -83,6 +96,105 @@ public class BlockGlassBell extends BlockEE { } } + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) { + + if (itemStack.hasDisplayName()) { + ((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); + } + + if (world.getBlockTileEntity(x, y - 1, z) != null && world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) { + ((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(ForgeDirection.UP); + } + else { + ((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z)); + } + + world.setBlockMetadataWithNotify(x, y, z, 0, 3); + } + + @Override + public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData) { + + return sideHit; + } + + /** + * Ray traces through the blocks collision from start vector to end vector + * returning a ray trace hit. Args: world, x, y, z, startVec, endVec + */ + @Override + public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) { + + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + if (tileEntity != null) { + if (tileEntity instanceof TileGlassBell) { + + TileGlassBell tileGlassBell = (TileGlassBell) tileEntity; + + switch (tileGlassBell.getOrientation()) { + case DOWN: { + this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F); + break; + } + case UP: { + this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F); + break; + } + case NORTH: { + this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F); + break; + } + case SOUTH: { + this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F); + break; + } + case EAST: { + this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F); + break; + } + case WEST: { + this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F); + break; + } + case UNKNOWN: { + break; + } + } + } + } + + return super.collisionRayTrace(world, x, y, z, startVec, endVec); + } + + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + + ItemStack itemStack; + + if (world.getBlockTileEntity(x, y, z) instanceof TileGlassBell) { + + TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z); + + if (world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) { + TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y - 1, z); + + itemStack = tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX); + + if (itemStack != null && itemStack.itemID < 4096) + return Block.lightValue[itemStack.itemID]; + } + + itemStack = tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX); + + if (itemStack != null && itemStack.itemID < 4096) + return Block.lightValue[itemStack.itemID]; + } + + return 0; + } + private void dropInventory(World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); @@ -116,5 +228,4 @@ public class BlockGlassBell extends BlockEE { } } } - } diff --git a/ee3_common/com/pahimar/ee3/block/ModBlocks.java b/ee3_common/com/pahimar/ee3/block/ModBlocks.java index dec713c2..a5bc6905 100644 --- a/ee3_common/com/pahimar/ee3/block/ModBlocks.java +++ b/ee3_common/com/pahimar/ee3/block/ModBlocks.java @@ -1,6 +1,8 @@ package com.pahimar.ee3.block; import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import com.pahimar.ee3.lib.BlockIds; import com.pahimar.ee3.lib.Strings; @@ -20,7 +22,7 @@ public class ModBlocks { /* Mod block instances */ public static Block calcinator; - public static Block aludel; + public static Block aludelBase; public static Block alchemicalChest; public static Block glassBell; public static Block redWaterStill; @@ -29,32 +31,25 @@ public class ModBlocks { public static void init() { calcinator = new BlockCalcinator(BlockIds.CALCINATOR); - aludel = new BlockAludelBase(BlockIds.ALUDEL); + aludelBase = new BlockAludelBase(BlockIds.ALUDEL_BASE); alchemicalChest = new BlockAlchemicalChest(BlockIds.ALCHEMICAL_CHEST); glassBell = new BlockGlassBell(BlockIds.GLASS_BELL); redWaterStill = new BlockRedWaterStill(BlockIds.RED_WATER_STILL); redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL - 1); GameRegistry.registerBlock(calcinator, Strings.CALCINATOR_NAME); - GameRegistry.registerBlock(aludel, Strings.ALUDEL_NAME); + GameRegistry.registerBlock(aludelBase, Strings.ALUDEL_NAME); GameRegistry.registerBlock(alchemicalChest, Strings.ALCHEMICAL_CHEST_NAME); GameRegistry.registerBlock(glassBell, Strings.GLASS_BELL_NAME); //GameRegistry.registerBlock(redWaterStill, Strings.RED_WATER_STILL_NAME); //GameRegistry.registerBlock(redWaterFlowing, Strings.RED_WATER_FLOWING_NAME); initBlockRecipes(); - } private static void initBlockRecipes() { - // Calcinator Recipe - /* - * Temporarily disabled for pre-release 1, as it is not completely - * functional GameRegistry.addRecipe(new ItemStack(calcinator), new - * Object[] {"i i","iii","sfs", Character.valueOf('i'), Item.ingotIron, - * Character.valueOf('s'), Block.stone, Character.valueOf('f'), - * Item.flintAndSteel }); - */ + GameRegistry.addRecipe(new ItemStack(glassBell), new Object[] { "iii", "i i", "i i", Character.valueOf('i'), Block.glass }); + GameRegistry.addRecipe(new ItemStack(aludelBase), new Object[] { "iii", "sis", "iii", Character.valueOf('i'), Item.ingotIron, Character.valueOf('s'), Block.stone }); } } diff --git a/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java b/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java index c4a142a5..df51d2f0 100644 --- a/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java +++ b/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java @@ -1,11 +1,9 @@ package com.pahimar.ee3.client.audio; -import java.util.logging.Level; - import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; -import com.pahimar.ee3.core.helper.LogHelper; +import com.pahimar.ee3.core.util.LogHelper; import com.pahimar.ee3.lib.Sounds; /** @@ -26,11 +24,11 @@ public class SoundHandler { for (String soundFile : Sounds.soundFiles) { // Try to add the custom sound file to the pool of sounds try { - event.manager.soundPoolSounds.addSound(soundFile, this.getClass().getResource("/" + soundFile)); + event.manager.addSound(soundFile); } // If we cannot add the custom sound file to the pool, log the exception catch (Exception e) { - LogHelper.log(Level.WARNING, "Failed loading sound file: " + soundFile); + LogHelper.warning("Failed loading sound file: " + soundFile); } } } diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java index fbc6eb39..afe61336 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java @@ -7,10 +7,10 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.inventory.ContainerAlchemicalBag; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Textures; +import com.pahimar.ee3.nbt.NBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -27,43 +27,52 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiAlchemicalBag extends GuiContainer { - public GuiAlchemicalBag(InventoryPlayer inventoryPlayer) { + public GuiAlchemicalBag(InventoryPlayer inventoryPlayer) { - super(new ContainerAlchemicalBag(inventoryPlayer)); - xSize = 248; - ySize = 186; - } + super(new ContainerAlchemicalBag(inventoryPlayer)); + xSize = 248; + ySize = 186; + } - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) { + @Override + protected void drawGuiContainerForegroundLayer(int x, int y) { - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 44, ySize - 96 + 2, 4210752); - } + fontRenderer.drawString(StatCollector + .translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6, + 4210752); + fontRenderer.drawString( + StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), + 44, ySize - 96 + 2, 4210752); + } - @Override - protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { + @Override + protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_ALCHEMICAL_STORAGE); - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - @Override - public void onGuiClosed() { + // this.mc.getTextureManager().bindTexture(...) + this.mc.func_110434_K().func_110577_a(Textures.GUI_ALCHEMICAL_STORAGE); - super.onGuiClosed(); + int xStart = (width - xSize) / 2; + int yStart = (height - ySize) / 2; + this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); + } - if (mc.thePlayer != null) { - for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) { - if (itemStack != null) { - if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) { - NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); - } - } - } - } - } + @Override + public void onGuiClosed() { + + super.onGuiClosed(); + + if (mc.thePlayer != null) { + for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) { + if (itemStack != null) { + if (NBTHelper.hasTag(itemStack, + Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) { + NBTHelper.removeTag(itemStack, + Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); + } + } + } + } + } } diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java index f4d14fe1..1d242505 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java @@ -47,7 +47,10 @@ public class GuiAlchemicalChest extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_ALCHEMICAL_STORAGE); + + // this.mc.getTextureManager().bindTexture(...) + this.mc.func_110434_K().func_110577_a(Textures.GUI_ALCHEMICAL_STORAGE); + int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAludel.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAludel.java index 72c23bbb..91e75b79 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAludel.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAludel.java @@ -48,7 +48,7 @@ public class GuiAludel extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_ALUDEL); + this.mc.func_110434_K().func_110577_a(Textures.GUI_ALUDEL); int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java index f08f4de8..d3116d18 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java @@ -47,7 +47,10 @@ public class GuiCalcinator extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_CALCINATOR); + + //this.mc.getTextureManager().bindTexture(...) + this.mc.func_110434_K().func_110577_a(Textures.GUI_CALCINATOR); + int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java index 1333a49b..b689e9b9 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java @@ -48,7 +48,7 @@ public class GuiGlassBell extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_GLASS_BELL); + this.mc.func_110434_K().func_110577_a(Textures.GUI_GLASS_BELL); int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java index 0098e85e..540623a8 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java @@ -8,10 +8,10 @@ import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.inventory.ContainerPortableCrafting; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Textures; +import com.pahimar.ee3.nbt.NBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -52,7 +52,7 @@ public class GuiPortableCrafting extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_PORTABLE_CRAFTING); + this.mc.func_110434_K().func_110577_a(Textures.GUI_PORTABLE_CRAFTING); int var5 = (width - xSize) / 2; int var6 = (height - ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize); diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java index e98c728b..84e2ddbc 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java @@ -3,12 +3,11 @@ package com.pahimar.ee3.client.gui.inventory; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; - import org.lwjgl.opengl.GL11; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Textures; +import com.pahimar.ee3.nbt.NBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -35,7 +34,7 @@ public class GuiPortableTransmutation extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.GUI_PORTABLE_TRANSMUTATION); + this.mc.func_110434_K().func_110577_a(Textures.GUI_PORTABLE_TRANSMUTATION); int var5 = (width - xSize) / 2; int var6 = (height - ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/RenderUtils.java b/ee3_common/com/pahimar/ee3/client/renderer/RenderUtils.java index 2a209f92..40eca4da 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/RenderUtils.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/RenderUtils.java @@ -3,7 +3,6 @@ package com.pahimar.ee3.client.renderer; import net.minecraft.block.Block; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.RenderEngine; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -13,6 +12,8 @@ import org.lwjgl.opengl.GL11; import com.pahimar.ee3.lib.Textures; +import cpw.mods.fml.client.FMLClientHandler; + /** * Equivalent-Exchange-3 * @@ -26,12 +27,12 @@ public class RenderUtils { private static int rotationAngle = 0; - public static void renderRotatingBlockIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack stack, int x, int y, float zLevel, float scale) { + public static void renderRotatingBlockIntoGUI(FontRenderer fontRenderer, ItemStack stack, int x, int y, float zLevel, float scale) { RenderBlocks renderBlocks = new RenderBlocks(); Block block = Block.blocksList[stack.itemID]; - renderEngine.bindTexture(Textures.VANILLA_BLOCK_TEXTURE_SHEET); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.VANILLA_BLOCK_TEXTURE_SHEET); GL11.glPushMatrix(); GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); @@ -55,11 +56,11 @@ public class RenderUtils { GL11.glPopMatrix(); } - public static void renderItemIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack itemStack, int x, int y, float opacity, float scale) { + public static void renderItemIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y, float opacity, float scale) { Icon icon = itemStack.getIconIndex(); GL11.glDisable(GL11.GL_LIGHTING); - renderEngine.bindTexture(Textures.VANILLA_ITEM_TEXTURE_SHEET); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.VANILLA_ITEM_TEXTURE_SHEET); int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0); float red = (overlayColour >> 16 & 255) / 255.0F; float green = (overlayColour >> 8 & 255) / 255.0F; diff --git a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java index 937f370e..d4f641e1 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java @@ -55,6 +55,10 @@ public class ItemAlchemicalChestRenderer implements IItemRenderer { renderAlchemicalChest(1.0F, 1.0F, 1.0F); break; } + case EQUIPPED_FIRST_PERSON: { + renderAlchemicalChest(1.0F, 1.0F, 1.0F); + break; + } case INVENTORY: { renderAlchemicalChest(0.0F, 0.075F, 0.0F); break; @@ -66,7 +70,7 @@ public class ItemAlchemicalChestRenderer implements IItemRenderer { private void renderAlchemicalChest(float x, float y, float z) { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALCHEMICAL_CHEST); GL11.glPushMatrix(); //start GL11.glTranslatef(x, y, z); //size GL11.glRotatef(180, 1, 0, 0); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java index 21085560..91b33275 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java @@ -55,6 +55,10 @@ public class ItemAludelRenderer implements IItemRenderer { renderAludel(0.0F, 0.0F, 1.0F, 1.0F); return; } + case EQUIPPED_FIRST_PERSON: { + renderAludel(0.0F, 0.0F, 1.0F, 1.0F); + return; + } case INVENTORY: { renderAludel(-1.0F, -0.9F, 0.0F, 1.0F); return; @@ -75,7 +79,7 @@ public class ItemAludelRenderer implements IItemRenderer { GL11.glRotatef(-90F, 1F, 0, 0); // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALUDEL); // Render modelAludel.render(); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java index 9d9b037b..2a253900 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java @@ -55,6 +55,10 @@ public class ItemCalcinatorRenderer implements IItemRenderer { renderCalcinator(0.0F, 0.0F, 1.0F, 1.0F); return; } + case EQUIPPED_FIRST_PERSON: { + renderCalcinator(0.0F, 0.0F, 1.0F, 1.0F); + return; + } case INVENTORY: { renderCalcinator(0.0F, -0.1F, 1.0F, 1.0F); return; @@ -75,7 +79,7 @@ public class ItemCalcinatorRenderer implements IItemRenderer { GL11.glRotatef(-90F, 1F, 0, 0); // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_CALCINATOR); // Render modelCalcinator.render(); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java index 4ef73dba..b90f926f 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java @@ -55,6 +55,10 @@ public class ItemGlassBellRenderer implements IItemRenderer { renderGlassBell(-0.2F, -0.85F, 0.8F, 1.4F); return; } + case EQUIPPED_FIRST_PERSON: { + renderGlassBell(-0.2F, -0.85F, 0.8F, 1.4F); + return; + } case INVENTORY: { renderGlassBell(-1.0F, -1.675F, 0.0F, 1.4F); return; @@ -75,7 +79,7 @@ public class ItemGlassBellRenderer implements IItemRenderer { GL11.glRotatef(-90F, 1F, 0, 0); // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_GLASS_BELL); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_GLASS_BELL); // Render modelGlassBell.render(); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java index dff09bba..953186d4 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java @@ -25,7 +25,8 @@ import cpw.mods.fml.relauncher.SideOnly; * */ @SideOnly(Side.CLIENT) -public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer { +public class TileEntityAlchemicalChestRenderer extends + TileEntitySpecialRenderer { private ModelChest modelChest = new ModelChest(); @@ -41,7 +42,7 @@ public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer direction = ForgeDirection.getOrientation(tileAlchemicalChest.getBlockMetadata()); } - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALCHEMICAL_CHEST); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java index 5459f843..105feffa 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java @@ -1,6 +1,11 @@ package com.pahimar.ee3.client.renderer.tileentity; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; @@ -9,6 +14,7 @@ import org.lwjgl.opengl.GL11; import com.pahimar.ee3.client.model.ModelAludel; import com.pahimar.ee3.lib.Textures; import com.pahimar.ee3.tileentity.TileAludel; +import com.pahimar.ee3.tileentity.TileGlassBell; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; @@ -27,6 +33,21 @@ import cpw.mods.fml.relauncher.SideOnly; public class TileEntityAludelRenderer extends TileEntitySpecialRenderer { private ModelAludel modelAludel = new ModelAludel(); + private final RenderItem customRenderItem; + + public TileEntityAludelRenderer() { + + customRenderItem = new RenderItem() { + + @Override + public boolean shouldBob() { + + return false; + }; + }; + + customRenderItem.setRenderManager(RenderManager.instance); + } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { @@ -42,13 +63,41 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer { scaleTranslateRotate(x, y, z, tileAludel.getOrientation()); // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALUDEL); // Render modelAludel.render(); - GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); + + /** + * Render the ghost item inside of the Aludel, slowly spinning + */ + GL11.glPushMatrix(); + + TileEntity tileGlassBell = tileAludel.worldObj.getBlockTileEntity(tileAludel.xCoord, tileAludel.yCoord + 1, tileAludel.zCoord); + + if (tileGlassBell instanceof TileGlassBell) { + if (tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX) != null) { + + float scaleFactor = getGhostItemScaleFactor(tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX)); + float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); + + EntityItem ghostEntityItem = new EntityItem(tileAludel.worldObj); + ghostEntityItem.hoverStart = 0.0F; + ghostEntityItem.setEntityItemStack(tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX)); + + GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F); + GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); + GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); + + customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0); + } + } + + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_LIGHTING); } } @@ -75,4 +124,44 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer { GL11.glRotatef(-90F, 1F, 0F, 0F); } } + + private float getGhostItemScaleFactor(ItemStack itemStack) { + + float scaleFactor = 1.0F; + + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack)) { + case 1: + return 0.90F; + case 2: + return 0.90F; + case 3: + return 0.90F; + case 4: + return 0.90F; + case 5: + return 0.80F; + default: + return 0.90F; + } + } + else { + switch (customRenderItem.getMiniItemCount(itemStack)) { + case 1: + return 0.65F; + case 2: + return 0.65F; + case 3: + return 0.65F; + case 4: + return 0.65F; + default: + return 0.65F; + } + } + } + + return scaleFactor; + } } diff --git a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java index f8770e88..dba7b9bc 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java @@ -2,7 +2,6 @@ package com.pahimar.ee3.client.renderer.tileentity; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; import com.pahimar.ee3.client.model.ModelCalcinator; @@ -43,12 +42,12 @@ public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer { GL11.glRotatef(-90F, 1F, 0F, 0F); // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_CALCINATOR); // Render modelCalcinator.renderPart("Calcinator"); - if (tileCalcinator.getStackInSlot(TileCalcinator.DUST_INVENTORY_INDEX) != null) { + if (tileCalcinator.getStackInSlot(TileCalcinator.OUTPUT_INVENTORY_INDEX) != null) { modelCalcinator.renderPart("Dust"); } diff --git a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java index 045c5b61..9491daf2 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java @@ -4,7 +4,10 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -30,12 +33,9 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { private ModelGlassBell modelGlassBell = new ModelGlassBell(); private final RenderItem customRenderItem; - private EntityItem ghostEntityItem; public TileEntityGlassBellRenderer() { - ghostEntityItem = null; - customRenderItem = new RenderItem() { @Override @@ -57,48 +57,209 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); + /** + * Render the Glass Bell + */ GL11.glPushMatrix(); // Scale, Translate, Rotate - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 0.5F, (float) y + -1.0F, (float) z + 1.2F); - GL11.glRotatef(45F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); + renderGlassBellByOrientation(x, y, z, tileGlassBell.getOrientation()); // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_GLASS_BELL); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_GLASS_BELL); - // Render modelGlassBell.render(); GL11.glPopMatrix(); + /** + * Render the ghost item inside of the Glass Bell, slowly spinning + */ GL11.glPushMatrix(); - for (int i = 0; i < tileGlassBell.getSizeInventory(); i++) { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.1F, (float) z + 0.5F); - GL11.glScalef(0.5F, 0.5F, 0.5F); + if (tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX) != null) { - if (ghostEntityItem == null) { - ghostEntityItem = new EntityItem(tileGlassBell.worldObj, tileGlassBell.xCoord, tileGlassBell.yCoord, tileGlassBell.zCoord); - } + float scaleFactor = getGhostItemScaleFactor(tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX)); + float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); - if (tileGlassBell.getStackInSlot(i) != null) { + EntityItem ghostEntityItem = new EntityItem(tileGlassBell.worldObj); + ghostEntityItem.hoverStart = 0.0F; + ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX)); - ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(i)); - - if (ghostEntityItem.getEntityItem() != null) { - ghostEntityItem.onUpdate(); - customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0); - } - } + translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation()); + GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); + GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); + customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0); } + GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); - } } + + private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection) { + + switch (forgeDirection) { + case DOWN: { + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x + 0.0F, (float) y + 2.0F, (float) z + 0.0F); + GL11.glRotatef(90F, 1F, 0F, 0F); + return; + } + case UP: { + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x + 0.0F, (float) y + -1.0F, (float) z + 1.0F); + GL11.glRotatef(-90F, 1F, 0F, 0F); + return; + } + case NORTH: { + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x + 1.0F, (float) y + 0.0F, (float) z + 2.0F); + GL11.glRotatef(180F, 0F, 1F, 0F); + return; + } + case SOUTH: { + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x + 0.0F, (float) y + 0.0F, (float) z + -1.0F); + return; + } + case EAST: { + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x + -1.0F, (float) y + 1.0F, (float) z + 1.0F); + GL11.glRotatef(-90F, 0F, 0F, 1F); + GL11.glRotatef(-90F, 1F, 0F, 0F); + return; + } + case WEST: { + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x + 2.0F, (float) y + 0.0F, (float) z + 1.0F); + GL11.glRotatef(90F, 0F, 0F, 1F); + GL11.glRotatef(-90F, 1F, 0F, 0F); + return; + } + case UNKNOWN: { + return; + } + default: { + return; + } + } + } + + private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { + + if (ghostItemStack != null) { + if (ghostItemStack.getItem() instanceof ItemBlock) { + switch (forgeDirection) { + case DOWN: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.7F, (float) z + 0.5F); + return; + } + case UP: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); + return; + } + case NORTH: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); + return; + } + case SOUTH: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); + return; + } + case EAST: { + GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); + return; + } + case WEST: { + GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); + return; + } + case UNKNOWN: { + return; + } + default: { + return; + } + } + } + else { + switch (forgeDirection) { + case DOWN: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); + return; + } + case UP: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); + return; + } + case NORTH: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); + return; + } + case SOUTH: { + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); + return; + } + case EAST: { + GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); + return; + } + case WEST: { + GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); + return; + } + case UNKNOWN: { + return; + } + default: { + return; + } + } + } + } + } + + private float getGhostItemScaleFactor(ItemStack itemStack) { + + float scaleFactor = 1.0F; + + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack)) { + case 1: + return 0.90F; + case 2: + return 0.90F; + case 3: + return 0.90F; + case 4: + return 0.90F; + case 5: + return 0.80F; + default: + return 0.90F; + } + } + else { + switch (customRenderItem.getMiniItemCount(itemStack)) { + case 1: + return 0.65F; + case 2: + return 0.65F; + case 3: + return 0.65F; + case 4: + return 0.65F; + default: + return 0.65F; + } + } + } + + return scaleFactor; + } } diff --git a/ee3_common/com/pahimar/ee3/command/CommandEE.java b/ee3_common/com/pahimar/ee3/command/CommandEE.java index a1a12e44..da68bbb2 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandEE.java +++ b/ee3_common/com/pahimar/ee3/command/CommandEE.java @@ -94,4 +94,10 @@ public class CommandEE extends CommandBase { else throw new WrongUsageException(Commands.COMMAND_EE3_USAGE, new Object[0]); } + + @Override + public String getCommandUsage(ICommandSender icommandsender) { + // TODO Auto-generated method stub + return null; + } } diff --git a/ee3_common/com/pahimar/ee3/command/CommandOverlay.java b/ee3_common/com/pahimar/ee3/command/CommandOverlay.java index 786d4fab..564be6b1 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandOverlay.java +++ b/ee3_common/com/pahimar/ee3/command/CommandOverlay.java @@ -2,11 +2,11 @@ package com.pahimar.ee3.command; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; +import net.minecraft.util.ChatMessageComponent; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.LocalizationHelper; -import com.pahimar.ee3.lib.Colours; +import com.pahimar.ee3.core.util.LocalizationUtil; import com.pahimar.ee3.lib.Commands; import com.pahimar.ee3.lib.Strings; @@ -52,14 +52,14 @@ public class CommandOverlay { ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = true; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, Strings.TRUE); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_TURNED_ON)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_TURNED_ON)); } private static void processOffCommand(ICommandSender commandSender) { ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = false; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, Strings.FALSE); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_TURNED_OFF)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_TURNED_OFF)); } private static void processScaleCommand(ICommandSender commandSender, String[] args) { @@ -69,19 +69,19 @@ public class CommandOverlay { float scale = Float.parseFloat(args[1]); if (scale <= 0F) - throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]); + throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]); else { ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = scale; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, args[1]); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_UPDATED)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_SCALE_UPDATED)); } } catch (Exception e) { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]); + throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]); } } else - throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]); + throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]); } private static void processOpacityCommand(ICommandSender commandSender, String[] args) { @@ -91,19 +91,19 @@ public class CommandOverlay { float opacity = Float.parseFloat(args[1]); if (opacity < 0F || opacity > 1F) - throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]); + throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]); else { ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = opacity; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, args[1]); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_UPDATED)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_OPACITY_UPDATED)); } } catch (Exception e) { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]); + throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]); } } else - throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]); + throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]); } private static void processPositionCommand(ICommandSender commandSender, String[] args) { @@ -117,22 +117,22 @@ public class CommandOverlay { if (yPosition.equalsIgnoreCase(Commands.COMMAND_TOP) && xPosition.equalsIgnoreCase(Commands.COMMAND_LEFT)) { ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 0; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "0"); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_POSITION_TOP_LEFT)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_TOP_LEFT)); } else if (yPosition.equalsIgnoreCase(Commands.COMMAND_TOP) && xPosition.equalsIgnoreCase(Commands.COMMAND_RIGHT)) { ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 1; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "1"); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_POSITION_TOP_RIGHT)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_TOP_RIGHT)); } else if (yPosition.equalsIgnoreCase(Commands.COMMAND_BOTTOM) && xPosition.equalsIgnoreCase(Commands.COMMAND_LEFT)) { ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 2; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "2"); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_LEFT)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_LEFT)); } else if (yPosition.equalsIgnoreCase(Commands.COMMAND_BOTTOM) && xPosition.equalsIgnoreCase(Commands.COMMAND_RIGHT)) { ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 3; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "3"); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_RIGHT)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_RIGHT)); } else throw new WrongUsageException(Commands.COMMAND_OVERLAY_POSITION_USAGE, new Object[0]); diff --git a/ee3_common/com/pahimar/ee3/command/CommandParticles.java b/ee3_common/com/pahimar/ee3/command/CommandParticles.java index ee6db178..06a2852a 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandParticles.java +++ b/ee3_common/com/pahimar/ee3/command/CommandParticles.java @@ -2,11 +2,10 @@ package com.pahimar.ee3.command; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; +import net.minecraft.util.ChatMessageComponent; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.LocalizationHelper; -import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.Commands; import com.pahimar.ee3.lib.Strings; @@ -45,13 +44,13 @@ public class CommandParticles { ConfigurationSettings.ENABLE_PARTICLE_FX = true; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, Strings.TRUE); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_PARTICLES_TURNED_ON)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_PARTICLES_TURNED_ON)); } private static void processOffCommand(ICommandSender commandSender) { ConfigurationSettings.ENABLE_PARTICLE_FX = false; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, Strings.FALSE); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_PARTICLES_TURNED_OFF)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_PARTICLES_TURNED_OFF)); } } diff --git a/ee3_common/com/pahimar/ee3/command/CommandSounds.java b/ee3_common/com/pahimar/ee3/command/CommandSounds.java index f4fd5799..0c486680 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandSounds.java +++ b/ee3_common/com/pahimar/ee3/command/CommandSounds.java @@ -2,11 +2,10 @@ package com.pahimar.ee3.command; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; +import net.minecraft.util.ChatMessageComponent; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.LocalizationHelper; -import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.Commands; /** @@ -47,20 +46,20 @@ public class CommandSounds { ConfigurationSettings.ENABLE_SOUNDS = Commands.ALL; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.ALL); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_SOUNDS_SET_TO_ALL)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_SOUNDS_SET_TO_ALL)); } private static void processSelfCommand(ICommandSender commandSender) { ConfigurationSettings.ENABLE_SOUNDS = Commands.SELF; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.SELF); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_SOUNDS_SET_TO_SELF)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_SOUNDS_SET_TO_SELF)); } private static void processOffCommand(ICommandSender commandSender) { ConfigurationSettings.ENABLE_SOUNDS = Commands.OFF; ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.OFF); - commandSender.sendChatToPlayer(Colours.TEXT_COLOUR_PREFIX_GRAY + LocalizationHelper.getLocalizedString(Commands.COMMAND_SOUNDS_TURNED_OFF)); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_SOUNDS_TURNED_OFF)); } } diff --git a/ee3_common/com/pahimar/ee3/command/CommandVersion.java b/ee3_common/com/pahimar/ee3/command/CommandVersion.java index 8c9b8169..3f52f2c1 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandVersion.java +++ b/ee3_common/com/pahimar/ee3/command/CommandVersion.java @@ -2,8 +2,9 @@ package com.pahimar.ee3.command; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; +import net.minecraft.util.ChatMessageComponent; -import com.pahimar.ee3.core.helper.VersionHelper; +import com.pahimar.ee3.core.util.VersionHelper; import com.pahimar.ee3.lib.Commands; /** @@ -39,7 +40,7 @@ public class CommandVersion { private static void processVersionCommand(ICommandSender commandSender) { - commandSender.sendChatToPlayer(VersionHelper.getResultMessage()); + commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(VersionHelper.getResultMessage())); } private static void processChangelogCommand(ICommandSender commandSender) { diff --git a/ee3_common/com/pahimar/ee3/configuration/ConfigurationHandler.java b/ee3_common/com/pahimar/ee3/configuration/ConfigurationHandler.java index f4a04043..4b1a52e2 100644 --- a/ee3_common/com/pahimar/ee3/configuration/ConfigurationHandler.java +++ b/ee3_common/com/pahimar/ee3/configuration/ConfigurationHandler.java @@ -78,7 +78,7 @@ public class ConfigurationHandler { /* Block configs */ BlockIds.CALCINATOR = configuration.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT).getInt(BlockIds.CALCINATOR_DEFAULT); - BlockIds.ALUDEL = configuration.getBlock(Strings.ALUDEL_NAME, BlockIds.ALUDEL_DEFAULT).getInt(BlockIds.ALUDEL_DEFAULT); + BlockIds.ALUDEL_BASE = configuration.getBlock(Strings.ALUDEL_NAME, BlockIds.ALUDEL_BASE_DEFAULT).getInt(BlockIds.ALUDEL_BASE_DEFAULT); BlockIds.ALCHEMICAL_CHEST = configuration.getBlock(Strings.ALCHEMICAL_CHEST_NAME, BlockIds.ALCHEMICAL_CHEST_DEFAULT).getInt(BlockIds.ALCHEMICAL_CHEST_DEFAULT); BlockIds.GLASS_BELL = configuration.getBlock(Strings.GLASS_BELL_NAME, BlockIds.GLASS_BELL_DEFAULT).getInt(BlockIds.GLASS_BELL_DEFAULT); BlockIds.RED_WATER_STILL = configuration.getBlock(Strings.RED_WATER_STILL_NAME, BlockIds.RED_WATER_STILL_DEFAULT).getInt(BlockIds.RED_WATER_STILL_DEFAULT); diff --git a/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java b/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java deleted file mode 100644 index 2c7149e4..00000000 --- a/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.pahimar.ee3.core.addons; - -import java.util.logging.Level; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - -import com.pahimar.ee3.core.helper.LogHelper; -import com.pahimar.ee3.core.helper.RecipeHelper; -import com.pahimar.ee3.recipe.RecipesTransmutationStone; - -import cpw.mods.fml.common.Loader; - -/** - * Equivalent-Exchange-3 - * - * AddonRedPower2 - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class AddonRedPower2 { - - public static Block rp2Stone = null; - - public static void initWorld() { - - if (Loader.isModLoaded("RedPowerWorld")) { - try { - rp2Stone = (Block) Class.forName("com.eloraam.redpower.RedPowerWorld").getField("blockStone").get(null); - - for (ItemStack stone : RecipesTransmutationStone.transmutationStones) { - // Extremely temporary recipe - RecipeHelper.addRecipe(new ItemStack(rp2Stone.blockID, 1, 3), stone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone); - } - - LogHelper.log(Level.INFO, "Loaded RP2 World addon"); - } - catch (Exception e) { - LogHelper.log(Level.SEVERE, "Could not load RP2 World addon"); - e.printStackTrace(System.err); - } - } - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/handlers/AddonHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/AddonHandler.java index abd911d9..439a16ba 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/AddonHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/AddonHandler.java @@ -1,7 +1,5 @@ package com.pahimar.ee3.core.handlers; -import com.pahimar.ee3.core.addons.AddonRedPower2; - /** * Equivalent-Exchange-3 * @@ -15,7 +13,6 @@ public class AddonHandler { public static void init() { - AddonRedPower2.initWorld(); } } diff --git a/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java index fea3fe7f..75d6b506 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java @@ -5,8 +5,8 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; import cpw.mods.fml.common.ICraftingHandler; @@ -26,7 +26,6 @@ public class CraftingHandler implements ICraftingHandler { if (player.worldObj.isRemote) { doPortableCrafting(player, craftMatrix); - System.out.println(item.toString()); } } diff --git a/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java index da759578..a817896e 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java @@ -1,7 +1,9 @@ package com.pahimar.ee3.core.handlers; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.EnumMovingObjectType; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.event.ForgeSubscribe; @@ -10,11 +12,15 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.item.IChargeable; import com.pahimar.ee3.item.ITransmutationStone; import com.pahimar.ee3.lib.Textures; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Equivalent-Exchange-3 * @@ -24,6 +30,7 @@ import com.pahimar.ee3.lib.Textures; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ +@SideOnly(Side.CLIENT) public class DrawBlockHighlightHandler { private static int pulse = 0; @@ -32,13 +39,17 @@ public class DrawBlockHighlightHandler { @ForgeSubscribe public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) { + Minecraft minecraft = FMLClientHandler.instance().getClient(); + if (event.currentItem != null) { if (event.currentItem.getItem() instanceof ITransmutationStone) { if (event.target.typeOfHit == EnumMovingObjectType.TILE) { TransmutationHelper.updateTargetBlock(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ); - if (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) { - drawInWorldTransmutationOverlay(event); + if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) { + if (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) { + drawInWorldTransmutationOverlay(event); + } } } } @@ -53,7 +64,6 @@ public class DrawBlockHighlightHandler { double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks; double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks; double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks; - int texture = event.context.renderEngine.getTexture(Textures.EFFECT_WORLD_TRANSMUTATION); float xScale = 1; float yScale = 1; @@ -133,7 +143,7 @@ public class DrawBlockHighlightHandler { GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ); GL11.glTranslated(0, 0, 0.5f * zCorrection); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); - renderPulsingQuad(texture, 0.75F); + renderPulsingQuad(Textures.EFFECT_WORLD_TRANSMUTATION, 0.75F); GL11.glPopMatrix(); } @@ -141,11 +151,11 @@ public class DrawBlockHighlightHandler { GL11.glDepthMask(true); } - public static void renderPulsingQuad(int texture, float maxTransparency) { + public static void renderPulsingQuad(ResourceLocation texture, float maxTransparency) { float pulseTransparency = getPulseValue() * maxTransparency / 3000f; - GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(texture); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); diff --git a/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java index 90d92095..f76dcc17 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java @@ -6,7 +6,7 @@ import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import com.pahimar.ee3.core.helper.ItemDropHelper; +import com.pahimar.ee3.core.util.ItemUtil; /** * Equivalent-Exchange-3 @@ -28,12 +28,12 @@ public class EntityLivingHandler { public void onEntityLivingDeath(LivingDeathEvent event) { if (event.source.getDamageType().equals("player")) { - ItemDropHelper.dropMiniumShard((EntityPlayer) event.source.getSourceOfDamage(), event.entityLiving); + ItemUtil.dropMiniumShard((EntityPlayer) event.source.getSourceOfDamage(), event.entityLiving); } if (event.source.getSourceOfDamage() instanceof EntityArrow) { if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity != null) { if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity instanceof EntityPlayer) { - ItemDropHelper.dropMiniumShard((EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity, event.entityLiving); + ItemUtil.dropMiniumShard((EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity, event.entityLiving); } } } diff --git a/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java index 2033a3f1..e7effecc 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java @@ -4,7 +4,8 @@ import java.util.ArrayList; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.GeneralHelper; +import com.pahimar.ee3.core.util.GeneralHelper; +import com.pahimar.ee3.core.util.LogHelper; /** * Equivalent-Exchange-3 @@ -246,7 +247,7 @@ public class EquivalencyHandler { int i = 0; for (ArrayList list : equivalencyList) { - System.out.println("equivalencyList[" + i + "]: " + list.toString()); + LogHelper.info("equivalencyList[" + i + "]: " + list.toString()); ++i; } } diff --git a/ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java new file mode 100644 index 00000000..4c137770 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java @@ -0,0 +1,98 @@ +package com.pahimar.ee3.core.handlers; + +import java.util.List; +import java.util.Map; + +import net.minecraft.nbt.NBTTagCompound; + +import com.pahimar.ee3.core.util.LogHelper; +import com.pahimar.ee3.emc.EmcBlackList; +import com.pahimar.ee3.item.CustomWrappedStack; +import com.pahimar.ee3.item.crafting.RecipeRegistry; +import com.pahimar.ee3.lib.InterModComms; +import com.pahimar.ee3.nbt.NBTHelper; + +import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; + +public class InterModCommsHandler { + + public static void processIMCMessages(IMCEvent event) { + + for (IMCMessage imcMessage : event.getMessages()) { + + if (imcMessage.getMessageType() == NBTTagCompound.class) { + + if (imcMessage.key.equalsIgnoreCase(InterModComms.ADD_RECIPE)) { + processAddRecipeMessage(imcMessage); + } + else if (imcMessage.key.equalsIgnoreCase(InterModComms.ADD_BLACKLIST_ENTRY)) { + processAddBlackListMessage(imcMessage); + } + else if (imcMessage.key.equalsIgnoreCase(InterModComms.REMOVE_BLACKLIST_ENTRY)) { + processRemoveBlackListMessage(imcMessage); + } + else if (imcMessage.key.equalsIgnoreCase(InterModComms.SET_EMC_VALUE)) { + processSetEmcValueMessage(imcMessage); + } + } + else { + LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' sent a message with key '" + imcMessage.key + "' with an invalid argument type (received " + imcMessage.getMessageType().getSimpleName() + ", expected NBTTagCompound)"); + } + } + } + + private static void processAddRecipeMessage(IMCMessage imcMessage) { + + NBTTagCompound encodedRecipe = imcMessage.getNBTValue(); + + Map> decodedRecipe = NBTHelper.decodeRecipeFromNBT(encodedRecipe); + + if (!decodedRecipe.isEmpty()) { + for (CustomWrappedStack key : decodedRecipe.keySet()) { + RecipeRegistry.getInstance().addRecipe(key, decodedRecipe.get(key)); + LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' added recipe with output '" + key.toString() + "' and inputs '" + decodedRecipe.get(key) + "'"); + } + } + else { + LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempting to add a NBT encoded recipe to the recipe registry, but the encoded recipe is invalid"); + } + } + + private static void processAddBlackListMessage(IMCMessage imcMessage) { + + NBTTagCompound encodedStack = imcMessage.getNBTValue(); + + CustomWrappedStack decodedStack = NBTHelper.decodeStackFromNBT(encodedStack); + + if (decodedStack != null) { + if (EmcBlackList.getInstance().add(decodedStack)) { + LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' added object '" + decodedStack.toString() + "' to the EMC blacklist"); + } + else { + LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempted to add an object to the EMC blacklist that already existed"); + } + } + } + + private static void processRemoveBlackListMessage(IMCMessage imcMessage) { + + NBTTagCompound encodedStack = imcMessage.getNBTValue(); + + CustomWrappedStack decodedStack = NBTHelper.decodeStackFromNBT(encodedStack); + + if (decodedStack != null) { + if (EmcBlackList.getInstance().remove(decodedStack)) { + LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' removed object '" + decodedStack.toString() + "' from the EMC blacklist"); + } + else { + LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempted to remove an object to the EMC blacklist that was not present"); + } + } + } + + private static void processSetEmcValueMessage(IMCMessage imcMessage) { + + // TODO Set an EMC Value via IMC + } +} diff --git a/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java index ccf3bcb2..1017f4a4 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java @@ -6,8 +6,8 @@ import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; /** * Equivalent-Exchange-3 diff --git a/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java index 19b69a81..2395cd88 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java @@ -6,7 +6,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.KeyBindingHelper; +import com.pahimar.ee3.core.util.KeyBindingUtil; import com.pahimar.ee3.item.IKeyBound; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.network.PacketTypeHandler; @@ -30,7 +30,7 @@ public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler { public KeyBindingHandler() { - super(KeyBindingHelper.gatherKeyBindings(), KeyBindingHelper.gatherIsRepeating()); + super(KeyBindingUtil.gatherKeyBindings(), KeyBindingUtil.gatherIsRepeating()); } @Override @@ -52,7 +52,7 @@ public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler { if (currentItem != null) { if (currentItem.getItem() instanceof IKeyBound) { - if (!KeyBindingHelper.isClientSided(kb.keyDescription)) { + if (!KeyBindingUtil.isClientSided(kb.keyDescription)) { PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketKeyPressed(kb.keyDescription))); } else { diff --git a/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java index f7680d60..90344d4a 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java @@ -1,6 +1,6 @@ package com.pahimar.ee3.core.handlers; -import com.pahimar.ee3.core.helper.LocalizationHelper; +import com.pahimar.ee3.core.util.LocalizationUtil; import com.pahimar.ee3.lib.Localizations; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -20,13 +20,10 @@ public class LocalizationHandler { * Loads in all the localization files from the Localizations library class */ public static void loadLanguages() { - - // Parse Localization directory - Localizations.parseDir(); - + // For every file specified in the Localization library class, load them into the Language Registry for (String localizationFile : Localizations.localeFiles) { - LanguageRegistry.instance().loadLocalization(localizationFile, LocalizationHelper.getLocaleFromFileName(localizationFile), LocalizationHelper.isXMLLanguageFile(localizationFile)); + LanguageRegistry.instance().loadLocalization(localizationFile, LocalizationUtil.getLocaleFromFileName(localizationFile), LocalizationUtil.isXMLLanguageFile(localizationFile)); } } diff --git a/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java index f6c55c39..11afbf0e 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java @@ -14,13 +14,15 @@ import org.lwjgl.opengl.GL12; import com.pahimar.ee3.client.renderer.RenderUtils; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.item.ITransmutationStone; import com.pahimar.ee3.lib.Reference; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; /** * Equivalent-Exchange-3 @@ -31,6 +33,7 @@ import cpw.mods.fml.common.TickType; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ +@SideOnly(Side.CLIENT) public class TransmutationTargetOverlayHandler implements ITickHandler { @Override @@ -49,8 +52,10 @@ public class TransmutationTargetOverlayHandler implements ITickHandler { if (player != null) { currentItemStack = player.inventory.getCurrentItem(); - if (currentItemStack != null && minecraft.inGameHasFocus && currentItemStack.getItem() instanceof ITransmutationStone && ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) { - renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]); + if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) { + if (currentItemStack != null && currentItemStack.getItem() instanceof ITransmutationStone && ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) { + renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]); + } } } } @@ -130,10 +135,10 @@ public class TransmutationTargetOverlayHandler implements ITickHandler { } } - RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, stack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale); + RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, stack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale); if (TransmutationHelper.targetBlockStack != null && TransmutationHelper.targetBlockStack.getItem() instanceof ItemBlock) { - RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, TransmutationHelper.targetBlockStack, hudBlockX, hudBlockY, -90, blockScale); + RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, TransmutationHelper.targetBlockStack, hudBlockX, hudBlockY, -90, blockScale); } GL11.glDisable(GL11.GL_LIGHTING); diff --git a/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java index 08ccb6ac..98c4b597 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java @@ -6,7 +6,7 @@ import net.minecraftforge.common.Configuration; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.VersionHelper; +import com.pahimar.ee3.core.util.VersionHelper; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Strings; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java index dfd8fe7a..24ae7635 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java @@ -9,7 +9,7 @@ import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.event.ActionEvent; import com.pahimar.ee3.event.ActionEvent.ActionResult; import com.pahimar.ee3.event.ActionRequestEvent; diff --git a/ee3_common/com/pahimar/ee3/core/helper/ItemDropHelper.java b/ee3_common/com/pahimar/ee3/core/helper/ItemDropHelper.java deleted file mode 100644 index 22c773dd..00000000 --- a/ee3_common/com/pahimar/ee3/core/helper/ItemDropHelper.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.pahimar.ee3.core.helper; - -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.player.EntityPlayer; - -import com.pahimar.ee3.item.ModItems; - -/** - * Equivalent-Exchange-3 - * - * ItemDropHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class ItemDropHelper { - - private static double rand; - - public static void dropMiniumShard(EntityPlayer player, EntityLiving entity) { - - if (GeneralHelper.isHostileEntity(entity)) { - rand = Math.random(); - - if (rand < 0.15d) { - entity.dropItem(ModItems.miniumShard.itemID, 1); - } - } - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/helper/LogHelper.java b/ee3_common/com/pahimar/ee3/core/helper/LogHelper.java deleted file mode 100644 index 1f230577..00000000 --- a/ee3_common/com/pahimar/ee3/core/helper/LogHelper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.pahimar.ee3.core.helper; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.pahimar.ee3.lib.Reference; - -import cpw.mods.fml.common.FMLLog; - -/** - * Equivalent-Exchange-3 - * - * LogHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class LogHelper { - - private static Logger eeLogger = Logger.getLogger(Reference.MOD_ID); - - public static void init() { - - eeLogger.setParent(FMLLog.getLogger()); - } - - public static void log(Level logLevel, String message) { - - eeLogger.log(logLevel, message); - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java b/ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java deleted file mode 100644 index 82fd4de7..00000000 --- a/ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.pahimar.ee3.core.helper; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Equivalent-Exchange-3 - * - * NBTHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class NBTHelper { - - /** - * Initializes the NBT Tag Compound for the given ItemStack if it is null - * - * @param itemStack - * The ItemStack for which its NBT Tag Compound is being checked - * for initialization - */ - private static void initNBTTagCompound(ItemStack itemStack) { - - if (itemStack.stackTagCompound == null) { - itemStack.setTagCompound(new NBTTagCompound()); - } - } - - public static boolean hasTag(ItemStack itemStack, String keyName) { - - if (itemStack.stackTagCompound != null) - return itemStack.stackTagCompound.hasKey(keyName); - - return false; - } - - public static void removeTag(ItemStack itemStack, String keyName) { - - if (itemStack.stackTagCompound != null) { - itemStack.stackTagCompound.removeTag(keyName); - } - } - - // String - public static String getString(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setString(itemStack, keyName, ""); - } - - return itemStack.stackTagCompound.getString(keyName); - } - - public static void setString(ItemStack itemStack, String keyName, String keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setString(keyName, keyValue); - } - - // boolean - public static boolean getBoolean(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setBoolean(itemStack, keyName, false); - } - - return itemStack.stackTagCompound.getBoolean(keyName); - } - - public static void setBoolean(ItemStack itemStack, String keyName, boolean keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setBoolean(keyName, keyValue); - } - - // byte - public static byte getByte(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setByte(itemStack, keyName, (byte) 0); - } - - return itemStack.stackTagCompound.getByte(keyName); - } - - public static void setByte(ItemStack itemStack, String keyName, byte keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setByte(keyName, keyValue); - } - - // short - public static short getShort(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setShort(itemStack, keyName, (short) 0); - } - - return itemStack.stackTagCompound.getShort(keyName); - } - - public static void setShort(ItemStack itemStack, String keyName, short keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setShort(keyName, keyValue); - } - - // int - public static int getInt(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setInteger(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getInteger(keyName); - } - - public static void setInteger(ItemStack itemStack, String keyName, int keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setInteger(keyName, keyValue); - } - - // long - public static long getLong(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setLong(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getLong(keyName); - } - - public static void setLong(ItemStack itemStack, String keyName, long keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setLong(keyName, keyValue); - } - - // float - public static float getFloat(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setFloat(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getFloat(keyName); - } - - public static void setFloat(ItemStack itemStack, String keyName, float keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setFloat(keyName, keyValue); - } - - // double - public static double getDouble(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setDouble(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getDouble(keyName); - } - - public static void setDouble(ItemStack itemStack, String keyName, double keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setDouble(keyName, keyValue); - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java b/ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java deleted file mode 100644 index 84f1b6ef..00000000 --- a/ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.pahimar.ee3.core.helper; - -import java.util.ArrayList; - -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; - -/** - * Equivalent-Exchange-3 - * - * RecipeHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class RecipeHelper { - - public static void addRecipe(ItemStack output, Object... input) { - - GameRegistry.addShapelessRecipe(output, input); - } - - public static void addRecipe(ItemStack output, ItemStack transmutationStone, Object... input) { - - Object[] inputs = new Object[input.length + 1]; - System.arraycopy(input, 0, inputs, 0, input.length); - inputs[input.length] = transmutationStone; - - addRecipe(output, inputs); - } - - public static void addRecipe(Block output, Object... input) { - - addRecipe(new ItemStack(output), input); - } - - public static void addRecipe(Block output, int count, Object... input) { - - addRecipe(new ItemStack(output, count), input); - } - - public static void addRecipe(Item output, Object... input) { - - addRecipe(new ItemStack(output), input); - } - - public static void addRecipe(Item output, int count, Object... input) { - - addRecipe(new ItemStack(output, count), input); - } - - public static Object[] getMetaCycle(Object input, int n) { - - ArrayList list = new ArrayList(); - - ItemStack stack; - - for (int i = 0; i < n; i++) { - stack = GeneralHelper.convertObjectToItemStack(input); - stack.setItemDamage(i); - list.add(stack); - } - - return list.toArray(); - } - - public static Object[] getMetaCycle(Object input, int n, int... excludedMeta) { - - ArrayList list = new ArrayList(); - - ItemStack stack; - int i = 0; - while (i < n) { - for (int j : excludedMeta) { - if (i == j) { - ++i; - } - } - - if (!(i < n)) { - break; - } - - stack = GeneralHelper.convertObjectToItemStack(input); - stack.setItemDamage(i); - list.add(stack); - ++i; - } - - return list.toArray(); - } - - /* - * Pass this a Block, Item or ItemStack and the maximum number of indexes, - * EXCLUDING zero - */ - protected static void addMetaCycleRecipe(Object input, ItemStack stone, int n) { - - int outputI; - - /* - * Makes a single item cycle through its meta values when it's crafted - * with a PStone - */ - for (int i = 0; i < n; i++) { - outputI = i == n - 1 ? 0 : i + 1; - - if (input instanceof Block) { - GameRegistry.addShapelessRecipe(new ItemStack((Block) input, 1, outputI), stone, new ItemStack((Block) input, 1, i)); - } - else if (input instanceof Item) { - GameRegistry.addShapelessRecipe(new ItemStack((Item) input, 1, outputI), stone, new ItemStack((Item) input, 1, i)); - } - else if (input instanceof ItemStack) { - GameRegistry.addShapelessRecipe(new ItemStack(((ItemStack) input).itemID, 1, outputI), stone, new ItemStack(((ItemStack) input).itemID, 1, i)); - } - } - } - - protected static void addMetaCycleRecipe(Object input, ItemStack stone, int n, int... excludedMeta) { - - int i = 0; - int outputI = 1; - while (i < n && outputI != 0) { - outputI = i == n - 1 ? 0 : i + 1; - - for (int j : excludedMeta) { - if (outputI == j) { - outputI = (outputI + 1) % 16; - } - } - - if (input instanceof Block) { - GameRegistry.addShapelessRecipe(new ItemStack((Block) input, 1, outputI), stone, new ItemStack((Block) input, 1, i)); - } - else if (input instanceof Item) { - GameRegistry.addShapelessRecipe(new ItemStack((Item) input, 1, outputI), stone, new ItemStack((Item) input, 1, i)); - } - else if (input instanceof ItemStack) { - GameRegistry.addShapelessRecipe(new ItemStack(((ItemStack) input).itemID, 1, outputI), stone, new ItemStack(((ItemStack) input).itemID, 1, i)); - } - - i = outputI; - } - } - - public static void addSmeltingRecipe(ItemStack input, ItemStack stone, ItemStack fuel) { - - ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(input); - - if (input == null || input.getItem() == null || result == null) - return; - - Object[] list = new Object[9]; - list[0] = stone; - list[1] = fuel; - - for (int i = 2; i < 9; i++) { - list[i] = new ItemStack(input.getItem(), 1, input.getItemDamage()); - } - - if (result.stackSize * 7 <= result.getItem().getItemStackLimit()) { - GameRegistry.addShapelessRecipe(new ItemStack(result.getItem(), result.stackSize * 7, result.getItemDamage()), list); - } - else { - GameRegistry.addShapelessRecipe(new ItemStack(result.getItem(), result.getItem().getItemStackLimit(), result.getItemDamage()), list); - } - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java b/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java index 63cb82cb..cebe571f 100644 --- a/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java +++ b/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java @@ -21,11 +21,13 @@ import com.pahimar.ee3.client.renderer.tileentity.TileEntityGlassBellRenderer; import com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler; import com.pahimar.ee3.core.handlers.KeyBindingHandler; import com.pahimar.ee3.core.handlers.TransmutationTargetOverlayHandler; -import com.pahimar.ee3.core.helper.KeyBindingHelper; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.ItemUtil; +import com.pahimar.ee3.core.util.KeyBindingUtil; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.item.IChargeable; import com.pahimar.ee3.lib.ActionTypes; import com.pahimar.ee3.lib.BlockIds; +import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.RenderIds; import com.pahimar.ee3.network.PacketTypeHandler; import com.pahimar.ee3.network.packet.PacketRequestEvent; @@ -75,8 +77,8 @@ public class ClientProxy extends CommonProxy { @Override public void setKeyBinding(String name, int value) { - KeyBindingHelper.addKeyBinding(name, value); - KeyBindingHelper.addIsRepeating(false); + KeyBindingUtil.addKeyBinding(name, value); + KeyBindingUtil.addIsRepeating(false); } @Override @@ -94,7 +96,7 @@ public class ClientProxy extends CommonProxy { RenderIds.glassBellId = RenderingRegistry.getNextAvailableRenderId(); MinecraftForgeClient.registerItemRenderer(BlockIds.CALCINATOR, new ItemCalcinatorRenderer()); - MinecraftForgeClient.registerItemRenderer(BlockIds.ALUDEL, new ItemAludelRenderer()); + MinecraftForgeClient.registerItemRenderer(BlockIds.ALUDEL_BASE, new ItemAludelRenderer()); MinecraftForgeClient.registerItemRenderer(BlockIds.ALCHEMICAL_CHEST, new ItemAlchemicalChestRenderer()); MinecraftForgeClient.registerItemRenderer(BlockIds.GLASS_BELL, new ItemGlassBellRenderer()); } @@ -130,6 +132,38 @@ public class ClientProxy extends CommonProxy { } } + @Override + public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { + + World world = FMLClientHandler.instance().getClient().theWorld; + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + this.handleTileEntityPacket(x, y, z, orientation, state, customName); + + if (tileEntity != null) { + if (tileEntity instanceof TileGlassBell) { + + ItemStack itemStack = new ItemStack(itemID, stackSize, metaData); + if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) { + ItemUtil.setColor(itemStack, color); + } + + ((TileGlassBell) tileEntity).setInventorySlotContents(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, itemStack); + world.updateAllLightTypes(x, y, z); + } + else if (tileEntity instanceof TileAludel) { + + ItemStack itemStack = new ItemStack(itemID, stackSize, metaData); + if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) { + ItemUtil.setColor(itemStack, color); + } + + ((TileAludel) tileEntity).setInventorySlotContents(TileAludel.INPUT_INVENTORY_INDEX, itemStack); + world.updateAllLightTypes(x, y, z); + } + } + } + @Override public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) { diff --git a/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java b/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java index 1d6d97cd..1a9ff867 100644 --- a/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java +++ b/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java @@ -84,6 +84,10 @@ public class CommonProxy implements IGuiHandler { } + public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { + + } + @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { diff --git a/ee3_common/com/pahimar/ee3/core/util/EnergyStack.java b/ee3_common/com/pahimar/ee3/core/util/EnergyStack.java new file mode 100644 index 00000000..dc1c46ff --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/EnergyStack.java @@ -0,0 +1,49 @@ +package com.pahimar.ee3.core.util; + +public class EnergyStack { + + public static final String VANILLA_SMELTING_ENERGY_NAME = "vanillaFuelValueUnits"; + public static final int VANILLA_SMELTING_ENERGY_THRESHOLD = 200; + + public String energyName; + public int stackSize; + + public EnergyStack(String energyName, int stackSize) { + + this.energyName = energyName; + this.stackSize = stackSize; + } + + public EnergyStack() { + + this("", 0); + } + + public EnergyStack(String energyName) { + + this(energyName, 1); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyName)); + + return stringBuilder.toString(); + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof EnergyStack)) { + return false; + } + + EnergyStack energyStack = (EnergyStack) object; + + return (this.stackSize == energyStack.stackSize && this.energyName.equalsIgnoreCase(energyStack.energyName)); + } + +} diff --git a/ee3_common/com/pahimar/ee3/core/helper/GeneralHelper.java b/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java similarity index 89% rename from ee3_common/com/pahimar/ee3/core/helper/GeneralHelper.java rename to ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java index 23edc26e..fc3cb7c0 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/GeneralHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java @@ -1,9 +1,9 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; import net.minecraft.block.Block; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.IMob; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -44,7 +44,7 @@ public class GeneralHelper { return list.toArray(); } - public static boolean isHostileEntity(EntityLiving entity) { + public static boolean isHostileEntity(EntityLivingBase entity) { if (entity instanceof IMob) return true; diff --git a/ee3_common/com/pahimar/ee3/core/util/ItemUtil.java b/ee3_common/com/pahimar/ee3/core/util/ItemUtil.java new file mode 100644 index 00000000..d9b4f22d --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/ItemUtil.java @@ -0,0 +1,204 @@ +package com.pahimar.ee3.core.util; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; + +import com.pahimar.ee3.item.ModItems; +import com.pahimar.ee3.lib.Colours; +import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; + +/** + * Equivalent-Exchange-3 + * + * ItemDropHelper + * + * @author pahimar + * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) + * + */ +public class ItemUtil { + + private static double rand; + + public static String toString(ItemStack itemStack) { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append("ItemStack("); + + if (itemStack != null) { + + stringBuilder.append(String.format("%s", encodeItemStackAsString(itemStack))); + + if (itemStack.hasTagCompound()) { + stringBuilder.append(String.format("%s%s", Strings.TOKEN_DELIMITER, NBTHelper.encodeNBTAsString((itemStack.getTagCompound())))); + } + } + else { + stringBuilder.append("null"); + } + + stringBuilder.append(")"); + + return stringBuilder.toString(); + } + + public static String encodeItemStackAsString(ItemStack itemStack) { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("%s%s%s", itemStack.itemID, Strings.TOKEN_DELIMITER, itemStack.getItemDamage())); + + return stringBuilder.toString(); + } + + public static ItemStack decodeItemStackFromString(String encodedItemStack) { + + ItemStack decodedItemStack = null; + + final int UNDEFINED = -1; + final int ERROR = -2; + + int itemId = UNDEFINED; + int meta = UNDEFINED; + + String[] splitString = encodedItemStack.split(Strings.TOKEN_DELIMITER); + + // Grab itemId + if (splitString.length >= 1) { + + try { + itemId = Integer.parseInt(splitString[0]); + } catch (NumberFormatException e) { + itemId = ERROR; + } + } + + // Grab meta + if (splitString.length >= 2) { + + try { + meta = Integer.parseInt(splitString[1]); + } catch (NumberFormatException e) { + meta = ERROR; + } + } + + if (meta == UNDEFINED) { + meta = OreDictionary.WILDCARD_VALUE; + } + + if (itemId != UNDEFINED && itemId != ERROR) { + if (meta != ERROR) { + decodedItemStack = new ItemStack(itemId, 1, meta); + } + } + + return decodedItemStack; + } + + /** + * Compares two ItemStacks for equality, testing itemID, metaData, + * stackSize, and their NBTTagCompounds (if they are present) + * + * @param first + * The first ItemStack being tested for equality + * @param second + * The second ItemStack being tested for equality + * @return true if the two ItemStacks are equivalent, false otherwise + */ + public static boolean compare(ItemStack first, ItemStack second) { + + // Check to see if either argument is null + if ((first != null) && (second != null)) { + // Check the item IDs + if (first.itemID == second.itemID) { + // Check the meta data + + if ((first.getItemDamage() == OreDictionary.WILDCARD_VALUE) || (second.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { + //return true; + } + + if (first.getItemDamage() == second.getItemDamage()) { + // Check the stack size + if (first.stackSize == second.stackSize) { + // If at least one of the ItemStacks has a NBTTagCompound, test for equality + if (first.hasTagCompound() || second.hasTagCompound()) { + + // If one of the stacks has a tag compound, but not both, they are not equal + if (!(first.hasTagCompound() && second.hasTagCompound())) { + return false; + } + // Otherwise, they both have tag compounds and we need to test them for equality + else { + return first.getTagCompound().equals(second.getTagCompound()); + } + } + // Otherwise, they must be equal if we have gotten this far (item IDs, meta data, and stack size all match) + else { + return true; + } + } + } + } + } + + return false; + } + + public static boolean hasColor(ItemStack itemStack) { + + return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR); + } + + public static int getColor(ItemStack itemStack) { + + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); + + if (nbtTagCompound == null) + return Integer.parseInt(Colours.PURE_WHITE, 16); + else { + + NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); + return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16); + } + } + + public static void setColor(ItemStack itemStack, int color) { + + if (itemStack != null) { + + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); + + if (nbtTagCompound == null) { + + nbtTagCompound = new NBTTagCompound(); + itemStack.setTagCompound(nbtTagCompound); + } + + NBTTagCompound colourTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); + + if (!nbtTagCompound.hasKey(Strings.NBT_ITEM_DISPLAY)) { + nbtTagCompound.setCompoundTag(Strings.NBT_ITEM_DISPLAY, colourTagCompound); + } + + colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color); + } + } + + public static void dropMiniumShard(EntityPlayer player, EntityLivingBase entity) { + + if (GeneralHelper.isHostileEntity(entity)) { + rand = Math.random(); + + if (rand < 0.15d) { + entity.dropItem(ModItems.miniumShard.itemID, 1); + } + } + } + +} diff --git a/ee3_common/com/pahimar/ee3/core/helper/KeyBindingHelper.java b/ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java similarity index 95% rename from ee3_common/com/pahimar/ee3/core/helper/KeyBindingHelper.java rename to ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java index a1aad84f..b4bbf975 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/KeyBindingHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; @@ -15,7 +15,7 @@ import com.pahimar.ee3.configuration.ConfigurationSettings; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ -public class KeyBindingHelper { +public class KeyBindingUtil { public static ArrayList keyBindingsList; public static ArrayList isRepeatingList; diff --git a/ee3_common/com/pahimar/ee3/core/helper/LocalizationHelper.java b/ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java similarity index 94% rename from ee3_common/com/pahimar/ee3/core/helper/LocalizationHelper.java rename to ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java index ec195981..44a840b8 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/LocalizationHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -11,7 +11,7 @@ import cpw.mods.fml.common.registry.LanguageRegistry; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ -public class LocalizationHelper { +public class LocalizationUtil { /*** * Simple test to determine if a specified file name represents a XML file diff --git a/ee3_common/com/pahimar/ee3/core/util/LogHelper.java b/ee3_common/com/pahimar/ee3/core/util/LogHelper.java new file mode 100644 index 00000000..7cb52574 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/LogHelper.java @@ -0,0 +1,72 @@ +package com.pahimar.ee3.core.util; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.pahimar.ee3.lib.Reference; + +import cpw.mods.fml.common.FMLLog; + +/** + * Equivalent-Exchange-3 + * + * LogHelper + * + * @author pahimar + * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) + * + */ +public class LogHelper { + + private static Logger eeLogger = Logger.getLogger(Reference.MOD_ID); + + public static void init() { + + eeLogger.setParent(FMLLog.getLogger()); + } + + public static void log(Level logLevel, String message) { + + eeLogger.log(logLevel, message); + } + + public static void severe(String message) { + + log(Level.SEVERE, message); + } + + public static void debug(String message) { + + log(Level.WARNING, "[DEBUG] " + message); + } + + public static void warning(String message) { + + log(Level.WARNING, message); + } + + public static void info(String message) { + + log(Level.INFO, message); + } + + public static void config(String message) { + + log(Level.CONFIG, message); + } + + public static void fine(String message) { + + log(Level.FINE, message); + } + + public static void finer(String message) { + + log(Level.FINER, message); + } + + public static void finest(String message) { + + log(Level.FINEST, message); + } +} diff --git a/ee3_common/com/pahimar/ee3/core/util/OreStack.java b/ee3_common/com/pahimar/ee3/core/util/OreStack.java new file mode 100644 index 00000000..da143c7e --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/OreStack.java @@ -0,0 +1,97 @@ +package com.pahimar.ee3.core.util; + +import java.util.ArrayList; +import java.util.Comparator; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class OreStack implements Comparator { + + public String oreName; + public int stackSize; + + public OreStack() { + + stackSize = 0; + oreName = null; + } + + public OreStack(String oreName, int stackSize) { + + this.oreName = oreName; + this.stackSize = stackSize; + } + + public OreStack(String oreName) { + + this(oreName, 1); + } + + public OreStack(int oreID) { + + this(OreDictionary.getOreName(oreID)); + } + + public OreStack(int oreID, int stackSize) { + + this(OreDictionary.getOreName(oreID), stackSize); + } + + public OreStack(ItemStack itemStack) { + + this(OreDictionary.getOreID(itemStack), itemStack.stackSize); + } + + public ArrayList getOres() { + + return OreDictionary.getOres(oreName); + } + + public int getOreID() { + + return OreDictionary.getOreID(oreName); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreName)); + + return stringBuilder.toString(); + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof OreStack)) + return false; + + OreStack oreStackObject = (OreStack) object; + + return stackSize == oreStackObject.stackSize && oreName.equals(oreStackObject.oreName); + } + + @Override + public int compare(OreStack oreStack1, OreStack oreStack2) { + + if (oreStack1 != null && oreStack2 != null) { + if (oreStack1.oreName.equals(oreStack2.oreName)) + return 0; + } + + return -1; + } + + public static boolean compareStacks(OreStack oreStack1, OreStack oreStack2) { + + return oreStack1.compareToStack(oreStack2); + } + + public boolean compareToStack(OreStack oreStack) { + + return compare(this, oreStack) == 0; + } +} diff --git a/ee3_common/com/pahimar/ee3/core/helper/QualityHelper.java b/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java similarity index 96% rename from ee3_common/com/pahimar/ee3/core/helper/QualityHelper.java rename to ee3_common/com/pahimar/ee3/core/util/QualityHelper.java index b8c9b859..72aab085 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/QualityHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import net.minecraft.item.ItemStack; diff --git a/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java b/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java new file mode 100644 index 00000000..8e616bf9 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java @@ -0,0 +1,175 @@ +package com.pahimar.ee3.core.util; + +import java.util.ArrayList; + +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; + +import com.pahimar.ee3.item.CustomWrappedStack; + +/** + * Equivalent-Exchange-3 + * + * RecipeHelper + * + * @author pahimar + * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) + * + */ +public class RecipeHelper { + + /** + * Discovers all instances of ItemStacks with wild card meta values in the + * vanilla Crafting Manager + * + * @return A list of CustomWrappedStacks that contains all wild card meta + * ItemStacks in the vanilla Crafting Manager + */ + public static ArrayList populateWildCards() { + + ArrayList wildCards = new ArrayList(); + + for (Object recipe : CraftingManager.getInstance().getRecipeList()) { + + if (recipe instanceof IRecipe) { + + if (((IRecipe) recipe).getRecipeOutput() instanceof ItemStack) { + + CustomWrappedStack recipeOutput = new CustomWrappedStack(((IRecipe) recipe).getRecipeOutput()); + ArrayList recipeInputs = RecipeHelper.getRecipeInputs((IRecipe) recipe); + ItemStack itemStack = null; + + if (recipeOutput.getWrappedStack() instanceof ItemStack) { + + itemStack = (ItemStack) recipeOutput.getWrappedStack(); + + if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !wildCards.contains(recipeOutput)) { + wildCards.add(recipeOutput); + } + } + + for (CustomWrappedStack inputStack : recipeInputs) { + + if (inputStack.getWrappedStack() instanceof ItemStack) { + + itemStack = (ItemStack) inputStack.getWrappedStack(); + + if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !wildCards.contains(inputStack)) { + wildCards.add(inputStack); + } + } + } + } + } + } + + return wildCards; + } + + /** + * Returns a list of elements that constitute the input in a crafting recipe + * + * @param recipe + * The IRecipe being examined + * @return List of elements that constitute the input of the given IRecipe. + * Could be an ItemStack or an Arraylist + */ + public static ArrayList getRecipeInputs(IRecipe recipe) { + + ArrayList recipeInputs = new ArrayList(); + + if (recipe instanceof ShapedRecipes) { + + ShapedRecipes shapedRecipe = (ShapedRecipes) recipe; + + for (int i = 0; i < shapedRecipe.recipeItems.length; i++) { + + if (shapedRecipe.recipeItems[i] instanceof ItemStack) { + + ItemStack itemStack = shapedRecipe.recipeItems[i].copy(); + + if (itemStack.stackSize > 1) { + itemStack.stackSize = 1; + } + + recipeInputs.add(new CustomWrappedStack(itemStack)); + } + } + } + else if (recipe instanceof ShapelessRecipes) { + + ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe; + + for (Object object : shapelessRecipe.recipeItems) { + + if (object instanceof ItemStack) { + + ItemStack itemStack = ((ItemStack) object).copy(); + + if (itemStack.stackSize > 1) { + itemStack.stackSize = 1; + } + + recipeInputs.add(new CustomWrappedStack(itemStack)); + } + } + } + else if (recipe instanceof ShapedOreRecipe) { + + ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe; + + for (int i = 0; i < shapedOreRecipe.getInput().length; i++) { + + /* + * If the element is a list, then it is an OreStack + */ + if (shapedOreRecipe.getInput()[i] instanceof ArrayList) { + CustomWrappedStack oreStack = new CustomWrappedStack(shapedOreRecipe.getInput()[i]); + + if (oreStack.getWrappedStack() instanceof OreStack) { + recipeInputs.add(new CustomWrappedStack(shapedOreRecipe.getInput()[i])); + } + } + else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) { + + ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy(); + + if (itemStack.stackSize > 1) { + itemStack.stackSize = 1; + } + + recipeInputs.add(new CustomWrappedStack(itemStack)); + } + } + } + else if (recipe instanceof ShapelessOreRecipe) { + + ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe; + + for (Object object : shapelessOreRecipe.getInput()) { + + if (object instanceof ArrayList) { + recipeInputs.add(new CustomWrappedStack(object)); + } + else if (object instanceof ItemStack) { + + ItemStack itemStack = ((ItemStack) object).copy(); + + if (itemStack.stackSize > 1) { + itemStack.stackSize = 1; + } + + recipeInputs.add(new CustomWrappedStack(itemStack)); + } + } + } + + return recipeInputs; + } +} diff --git a/ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java b/ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java new file mode 100644 index 00000000..148c51da --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java @@ -0,0 +1,13 @@ +package com.pahimar.ee3.core.util; + +import com.pahimar.ee3.lib.Reference; + +import net.minecraft.util.ResourceLocation; + +public class ResourceLocationHelper { + + public static ResourceLocation getResourceLocation(String path) { + + return new ResourceLocation(Reference.MOD_ID.toLowerCase(), path); + } +} diff --git a/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java b/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java similarity index 89% rename from ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java rename to ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java index 995cd44c..a62d2584 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; @@ -52,19 +52,19 @@ public class TransmutationHelper { if (currentBlock != null) { meta = currentBlock.damageDropped(meta); - } - currentBlockStack = new ItemStack(id, 1, meta); + currentBlockStack = new ItemStack(id, 1, meta); - if (previousBlockStack == null) { - previousBlockStack = currentBlockStack; - targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); - } - else { - if (!EquivalencyHandler.instance().areEquivalent(TransmutationHelper.previousBlockStack, currentBlockStack)) { + if (previousBlockStack == null) { previousBlockStack = currentBlockStack; targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); } + else { + if (!EquivalencyHandler.instance().areEquivalent(TransmutationHelper.previousBlockStack, currentBlockStack)) { + previousBlockStack = currentBlockStack; + targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); + } + } } } diff --git a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java b/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java similarity index 95% rename from ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java rename to ee3_common/com/pahimar/ee3/core/util/VersionHelper.java index 2728dd2e..1631b601 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java @@ -1,9 +1,8 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.io.InputStream; import java.net.URL; import java.util.Properties; -import java.util.logging.Level; import net.minecraftforge.common.Configuration; @@ -114,21 +113,19 @@ public class VersionHelper implements Runnable { String[] versionTokens = Reference.VERSION_NUMBER.split(" "); - if (versionTokens.length >= 1) { + if (versionTokens.length >= 1) return versionTokens[0]; - } - else { + else return Reference.VERSION_NUMBER; - } } public static void logResult() { if (result == CURRENT || result == OUTDATED) { - LogHelper.log(Level.INFO, getResultMessage()); + LogHelper.info(getResultMessage()); } else { - LogHelper.log(Level.WARNING, getResultMessage()); + LogHelper.warning(getResultMessage()); } } @@ -194,7 +191,7 @@ public class VersionHelper implements Runnable { int count = 0; - LogHelper.log(Level.INFO, LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE); + LogHelper.info(LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE); try { while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) { diff --git a/ee3_common/com/pahimar/ee3/creativetab/CreativeTabEE3.java b/ee3_common/com/pahimar/ee3/creativetab/CreativeTabEE3.java index 0d24956e..b8e27ccd 100644 --- a/ee3_common/com/pahimar/ee3/creativetab/CreativeTabEE3.java +++ b/ee3_common/com/pahimar/ee3/creativetab/CreativeTabEE3.java @@ -18,19 +18,19 @@ import cpw.mods.fml.relauncher.SideOnly; */ public class CreativeTabEE3 extends CreativeTabs { - public CreativeTabEE3(int par1, String par2Str) { + public CreativeTabEE3(int par1, String par2Str) { - super(par1, par2Str); - } + super(par1, par2Str); + } - @Override - @SideOnly(Side.CLIENT) - /** - * the itemID for the item to be displayed on the tab - */ - public int getTabIconItemIndex() { + @Override + @SideOnly(Side.CLIENT) + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() { - return ItemIds.MINIUM_SHARD; - } + return ItemIds.MINIUM_SHARD; + } } diff --git a/ee3_common/com/pahimar/ee3/emc/DynEMC.java b/ee3_common/com/pahimar/ee3/emc/DynEMC.java new file mode 100644 index 00000000..f5891f8d --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/DynEMC.java @@ -0,0 +1,161 @@ +package com.pahimar.ee3.emc; + +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Set; + +import com.google.common.collect.Multimap; +import com.pahimar.ee3.core.util.LogHelper; +import com.pahimar.ee3.emc.graph.WeightedDirectedGraph; +import com.pahimar.ee3.emc.graph.WeightedEdge; +import com.pahimar.ee3.item.CustomWrappedStack; +import com.pahimar.ee3.item.crafting.RecipeRegistry; + +public class DynEMC { + + private static DynEMC dynEMC = null; + + private RecipeRegistry recipeRegistry; + private WeightedDirectedGraph graph; + + private DynEMC() { + + recipeRegistry = RecipeRegistry.getInstance(); + graph = new WeightedDirectedGraph(); + + init(); + } + + public static DynEMC getInstance() { + + if (dynEMC == null) { + dynEMC = new DynEMC(); + } + + return dynEMC; + } + + private void init() { + + populateGraph(); + } + + private void populateGraph() { + + for (CustomWrappedStack discoveredStack : recipeRegistry.getDiscoveredStacks()) { + graph.addNode(discoveredStack); + } + + Multimap> recipeMappings = recipeRegistry.getRecipeMappings(); + + Set recipeKeySet = recipeMappings.keySet(); + Iterator recipeKeySetIterator = recipeKeySet.iterator(); + CustomWrappedStack recipeOutput = null; + + while (recipeKeySetIterator.hasNext()) { + recipeOutput = recipeKeySetIterator.next(); + + for (List recipeInputs : recipeMappings.get(recipeOutput)) { + + CustomWrappedStack unWrappedRecipeOutput = new CustomWrappedStack(recipeOutput.getWrappedStack()); + + if (graph.nodeExists(unWrappedRecipeOutput)) { + for (CustomWrappedStack recipeInput : recipeInputs) { + + // Unwrapped the wrapped stacks so that we actually find them in the graph + + CustomWrappedStack unWrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack()); + + if (graph.nodeExists(unWrappedRecipeInput)) { + if (recipeOutput.getStackSize() != 0) { + try { + graph.addEdge(unWrappedRecipeOutput, unWrappedRecipeInput, (recipeInput.getStackSize() * 1.0f) / recipeOutput.getStackSize()); + } catch (NoSuchElementException e) { + LogHelper.severe(e.getLocalizedMessage()); + } + } + } + else { + LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' exists in the crafting relationship graph"); + LogHelper.debug("Recipe input '" + unWrappedRecipeInput.toString() + "' does not exist in the crafting relationship graph"); + } + } + } + else { + LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' does not exist in the crafting relationship graph"); + } + } + } + } + + public List getCriticalNodes() { + + return graph.getCriticalNodes(); + } + + public int size() { + + return graph.size(); + } + + public void printDebugDump() { + + LogHelper.debug("Total node count: " + graph.getAllNodes().size()); + LogHelper.debug("Critical node count: " + graph.getCriticalNodes().size()); + LogHelper.debug("Orphan node count: " + graph.getOrphanNodes().size()); + + List critsMinusOrphans = graph.getCriticalNodes(); + critsMinusOrphans.removeAll(graph.getOrphanNodes()); + + LogHelper.debug("[Critical - Orphans] node count: " + critsMinusOrphans.size()); + + LogHelper.debug("***** START NODES *****"); + Iterator nodeIter = graph.iterator(); + while (nodeIter.hasNext()) { + CustomWrappedStack node = nodeIter.next(); + LogHelper.debug("Node: " + node); + } + LogHelper.debug("***** END NODES *****"); + + LogHelper.debug("***** START EDGES FROM *****"); + nodeIter = graph.iterator(); + while (nodeIter.hasNext()) { + CustomWrappedStack node = nodeIter.next(); + Set> edgesFrom = graph.edgesFrom(node); + for (WeightedEdge edge : edgesFrom) { + LogHelper.debug("Crafting Output: " + node); + LogHelper.debug("Crafting Input: " + edge.getTarget()); + LogHelper.debug("Weight: " + edge.getWeight()); + LogHelper.debug(""); + } + } + LogHelper.debug("***** END EDGES FROM *****"); + + LogHelper.debug("***** START EDGES TO *****"); + nodeIter = graph.iterator(); + while (nodeIter.hasNext()) { + CustomWrappedStack node = nodeIter.next(); + Set> edgesTo = graph.edgesTo(node); + Iterator> edgeIter = edgesTo.iterator(); + while (edgeIter.hasNext()) { + WeightedEdge edge = edgeIter.next(); + LogHelper.debug("From: " + node); + LogHelper.debug("To: " + edge.getTarget()); + LogHelper.debug("Weight: " + edge.getWeight()); + LogHelper.debug(""); + } + } + LogHelper.debug("***** END EDGES TO *****"); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("DynEMC Node Count: %s", graph.size())); + + return stringBuilder.toString(); + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/EMCEntry.java b/ee3_common/com/pahimar/ee3/emc/EMCEntry.java deleted file mode 100644 index 0c6cda86..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EMCEntry.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * Equivalent-Exchange-3 - * - * EMCEntry - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class EMCEntry { - - private float cost, recoveryPercentage; - private boolean learnable, recoverable; - private Map breakdown; - - public EMCEntry(float cost) { - - this.cost = cost; - recoveryPercentage = 1F; - learnable = true; - recoverable = true; - breakdown = Collections.synchronizedMap(new HashMap()); - } - - public EMCEntry(float cost, float recoveryPercentage, boolean learnable, boolean recoverable) { - - this.cost = cost; - this.recoveryPercentage = recoveryPercentage; - this.learnable = learnable; - this.recoverable = recoverable; - breakdown = Collections.synchronizedMap(new HashMap()); - } - - public float getCost() { - - return cost; - } - - public float getRecoveryPercentage() { - - return recoveryPercentage; - } - - public boolean isLearnable() { - - return learnable; - } - - public boolean isRecoverable() { - - return recoverable; - } - - public Map getEMCBreakDown() { - - return breakdown; - } - - public float getEMCBreakdownByType(EMCType emcType) { - - if (breakdown.containsKey(emcType)) { - if (breakdown.get(emcType) != null) - return breakdown.get(emcType).floatValue(); - } - - return -1F; - } - - public void setCost(float cost) { - - this.cost = cost; - } - - public void setRecoveryPercentage(float recoveryPercentage) { - - this.recoveryPercentage = recoveryPercentage; - } - - public void setLearnable(boolean learnable) { - - this.learnable = learnable; - } - - public void setRecoverable(boolean recoverable) { - - this.recoverable = recoverable; - } - - public void addEMCBreakDown(EMCType emcType, Float breakdownPercentage) { - - if (!breakdown.containsKey(emcType)) { - breakdown.put(emcType, breakdownPercentage); - } - } - - public void setEMCBreakDown(EMCType emcType, Float breakdownPercentage) { - - if (breakdown.containsKey(emcType)) { - breakdown.put(emcType, breakdownPercentage); - } - } - -} diff --git a/ee3_common/com/pahimar/ee3/emc/EMCRegistry.java b/ee3_common/com/pahimar/ee3/emc/EMCRegistry.java deleted file mode 100644 index bbf9d07a..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EMCRegistry.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - * - * EMCRegistry - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class EMCRegistry { - - private static final EMCRegistry emcRegistry = new EMCRegistry(); - - private HashMap> emcMap = new HashMap>(); - - public static EMCRegistry instance() { - - return emcRegistry; - } - - public EMCEntry getEMCValue(Block block) { - - if (block != null) - return getEMCValue(block.blockID, 0); - - return null; - } - - public EMCEntry getEMCValue(Item item) { - - if (item != null) - return getEMCValue(item.itemID, 0); - - return null; - } - - public EMCEntry getEMCValue(ItemStack itemStack) { - - if (itemStack != null) - return getEMCValue(itemStack.itemID, itemStack.getItemDamage()); - - return null; - } - - public EMCEntry getEMCValue(int id) { - - return getEMCValue(id, 0); - } - - public EMCEntry getEMCValue(int id, int meta) { - - if (emcMap.containsKey(id)) { - if (emcMap.get(id).containsKey(meta)) - return emcMap.get(id).get(meta); - } - - return null; - } - - public void addEMCValue(Block block, EMCEntry emcEntry) { - - addEMCValue(block.blockID, 0, emcEntry); - } - - public void addEMCValue(Block block, int meta, EMCEntry emcEntry) { - - addEMCValue(block.blockID, meta, emcEntry); - } - - public void addEMCValue(Item item, EMCEntry emcEntry) { - - addEMCValue(item.itemID, 0, emcEntry); - } - - public void addEMCValue(ItemStack itemStack, EMCEntry emcEntry) { - - addEMCValue(itemStack.itemID, itemStack.getItemDamage(), emcEntry); - } - - public void addEMCValue(int id, EMCEntry emcEntry) { - - addEMCValue(id, 0, emcEntry); - } - - public void addEMCValue(int id, int meta, EMCEntry emcEntry) { - - HashMap tempMap = new HashMap(); - - if (emcMap.containsKey(id)) { - tempMap = emcMap.get(id); - - if (tempMap.containsKey(meta)) - return; - } - - tempMap.put(meta, emcEntry); - emcMap.put(id, tempMap); - } - -} diff --git a/ee3_common/com/pahimar/ee3/emc/EMCType.java b/ee3_common/com/pahimar/ee3/emc/EMCType.java deleted file mode 100644 index a282b6e4..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EMCType.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pahimar.ee3.emc; - -/** - * Equivalent-Exchange-3 - * - * EMCType - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public enum EMCType { - CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID, OMNI; -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcBlackList.java b/ee3_common/com/pahimar/ee3/emc/EmcBlackList.java new file mode 100644 index 00000000..0e64eb56 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EmcBlackList.java @@ -0,0 +1,119 @@ +package com.pahimar.ee3.emc; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; + +import com.pahimar.ee3.item.CustomWrappedStack; + +public class EmcBlackList { + + private static EmcBlackList emcBlackList = null; + + private ArrayList stackBlackList = new ArrayList(); + + private EmcBlackList() { + + } + + public static EmcBlackList getInstance() { + + if (emcBlackList == null) { + + emcBlackList = new EmcBlackList(); + emcBlackList.init(); + } + + return emcBlackList; + } + + public List getBlackList() { + + return stackBlackList; + } + + public boolean add(Object object) { + + boolean wasAdded = false; + + if (CustomWrappedStack.canBeWrapped(object)) { + + CustomWrappedStack wrappedStack = new CustomWrappedStack(object); + wrappedStack.setStackSize(1); + + if (!stackBlackList.contains(wrappedStack)) { + stackBlackList.add(wrappedStack); + wasAdded = true; + } + } + + return wasAdded; + } + + public boolean contains(Object object) { + + if (CustomWrappedStack.canBeWrapped(object)) { + + CustomWrappedStack wrappedStack = new CustomWrappedStack(object); + wrappedStack.setStackSize(1); + + return stackBlackList.contains(wrappedStack); + } + + return false; + } + + public boolean remove(Object object) { + + boolean wasRemoved = false; + + if (CustomWrappedStack.canBeWrapped(object)) { + + CustomWrappedStack wrappedStack = new CustomWrappedStack(object); + wrappedStack.setStackSize(1); + + if (stackBlackList.contains(wrappedStack)) { + stackBlackList.remove(wrappedStack); + wasRemoved = true; + } + } + + return wasRemoved; + } + + private void init() { + + add(Block.bed); + add(Block.pistonExtension); + add(Block.pistonMoving); + add(Block.mobSpawner); + add(Block.redstoneWire); + add(Block.crops); + add(Block.furnaceBurning); + add(Block.signPost); + add(Block.doorWood); + add(Block.signWall); + add(Block.doorIron); + add(Block.torchRedstoneIdle); + add(Block.reed); + add(Block.portal); + add(Block.cake); + add(Block.redstoneRepeaterIdle); + add(Block.redstoneRepeaterActive); + add(Block.lockedChest); + add(Block.pumpkinStem); + add(Block.melonStem); + add(Block.netherStalk); + add(Block.brewingStand); + add(Block.cauldron); + add(Block.endPortal); + add(Block.redstoneLampActive); + add(Block.commandBlock); + add(Block.carrot); + add(Block.potato); + add(Block.skull); + add(Block.redstoneComparatorIdle); + add(Block.redstoneComparatorActive); + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcComponent.java b/ee3_common/com/pahimar/ee3/emc/EmcComponent.java new file mode 100644 index 00000000..13c6fc9b --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EmcComponent.java @@ -0,0 +1,46 @@ +package com.pahimar.ee3.emc; + +public class EmcComponent { + + private final EmcType emcType; + private final float percentage; + + public EmcComponent(EmcType emcType, float percentage) { + + this.emcType = emcType; + this.percentage = percentage; + } + + public EmcType getEmcType() { + + return emcType; + } + + public float getPercentage() { + + return percentage; + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof EmcComponent)) { + + return false; + } + + EmcComponent emcBreakDown = (EmcComponent) object; + + return ((this.emcType == emcBreakDown.emcType) && (this.percentage == emcBreakDown.percentage)); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("", emcType, (percentage * 100))); + + return stringBuilder.toString(); + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java b/ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java new file mode 100644 index 00000000..cac65ca2 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java @@ -0,0 +1,15 @@ +package com.pahimar.ee3.emc; + +import java.util.HashMap; +import java.util.List; + +import com.pahimar.ee3.item.CustomWrappedStack; + +public class EmcDefaultValues { + + private static HashMap> defaultEmcValues = new HashMap>(); + + public static void init() { + + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcMap.java b/ee3_common/com/pahimar/ee3/emc/EmcMap.java new file mode 100644 index 00000000..548ce166 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EmcMap.java @@ -0,0 +1,37 @@ +package com.pahimar.ee3.emc; + +import java.util.HashMap; + +import com.pahimar.ee3.item.CustomWrappedStack; + +public class EmcMap { + + private static EmcMap emcMap = null; + + private HashMap emcMappings; + + private EmcMap() { + + emcMappings = new HashMap(); + } + + public static EmcMap getInstance() { + + if (emcMap == null) { + emcMap = new EmcMap(); + } + + return emcMap; + } + + public EmcValue getEmcValue(Object object) { + + EmcValue emcValue = null; + + if (CustomWrappedStack.canBeWrapped(object)) { + return emcMappings.get(new CustomWrappedStack(object)); + } + + return emcValue; + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcType.java b/ee3_common/com/pahimar/ee3/emc/EmcType.java new file mode 100644 index 00000000..9630fe8c --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EmcType.java @@ -0,0 +1,5 @@ +package com.pahimar.ee3.emc; + +public enum EmcType { + CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID, OMNI; +} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcValue.java b/ee3_common/com/pahimar/ee3/emc/EmcValue.java new file mode 100644 index 00000000..19f02442 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EmcValue.java @@ -0,0 +1,161 @@ +package com.pahimar.ee3.emc; + +import java.util.ArrayList; +import java.util.List; + +import com.pahimar.ee3.lib.Strings; + +/** + * Equivalent-Exchange-3 + * + * EMCEntry + * + * @author pahimar + * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) + * + */ +public class EmcValue { + + private float value, recoveryPercentage; + private List emcComponents; + + public EmcValue() { + + value = 0F; + recoveryPercentage = 1F; + emcComponents = new ArrayList(); + } + + public EmcValue(float value) { + + this.value = value; + recoveryPercentage = 1F; + emcComponents = new ArrayList(); + } + + public EmcValue(float value, float recoveryPercentage) { + + this.value = value; + this.recoveryPercentage = recoveryPercentage; + emcComponents = new ArrayList(); + } + + public EmcValue(float value, float recoveryPercentage, List emcComponents) { + + this.value = value; + this.recoveryPercentage = recoveryPercentage; + this.emcComponents = emcComponents; + } + + public float getValue() { + + return value; + } + + public float getRecoveryPercentage() { + + return recoveryPercentage; + } + + public List getComponents() { + + return emcComponents; + } + + public EmcComponent getComponent(EmcType emcType) { + + for (EmcComponent emcComponent : emcComponents) { + if (emcComponent.getEmcType().equals(emcType)) { + return emcComponent; + } + } + + return null; + } + + public boolean containsEmcType(EmcType emcType) { + + for (EmcComponent emcComponent : emcComponents) { + if (emcComponent.getEmcType().equals(emcType)) { + return true; + } + } + + return false; + } + + public void setValue(float cost) { + + this.value = cost; + } + + public void setRecoveryPercentage(float recoveryPercentage) { + + this.recoveryPercentage = recoveryPercentage; + } + + public void addEmcComponent(EmcComponent emcComponent) { + + if (!containsEmcType(emcComponent.getEmcType())) { + emcComponents.add(emcComponent); + } + } + + public void addEmcComponent(EmcType emcType, float percentage) { + + addEmcComponent(new EmcComponent(emcType, percentage)); + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof EmcValue)) { + return false; + } + + EmcValue emcValue = (EmcValue) object; + + if (value == emcValue.value) { + if (recoveryPercentage == emcValue.recoveryPercentage) { + return emcComponents.equals(emcValue.getComponents()); + } + } + + return false; + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("V:%s", value)); + stringBuilder.append(Strings.TOKEN_DELIMITER); + stringBuilder.append(String.format("RP:%s", recoveryPercentage)); + stringBuilder.append(Strings.TOKEN_DELIMITER); + stringBuilder.append("["); + + for (int i = 0; i < emcComponents.size(); i++) { + if (i > 0) { + stringBuilder.append(Strings.TOKEN_DELIMITER); + } + stringBuilder.append(String.format("%s:%s", emcComponents.get(i).getEmcType(), emcComponents.get(i).getPercentage())); + } + + stringBuilder.append("]"); + + return stringBuilder.toString(); + } + + @Override + public int hashCode() { + + int hashCode = 1; + + hashCode = 37 * hashCode + Float.floatToIntBits(value); + hashCode = 37 * hashCode + Float.floatToIntBits(recoveryPercentage); + hashCode = 37 * hashCode + emcComponents.hashCode(); + + return hashCode; + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java b/ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java new file mode 100644 index 00000000..724988aa --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java @@ -0,0 +1,113 @@ +package com.pahimar.ee3.emc; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; + +import com.pahimar.ee3.item.CustomWrappedStack; + +public class EquivalencyGroup { + + private List equivalentItems; + + public EquivalencyGroup() { + + equivalentItems = new ArrayList(); + } + + public EquivalencyGroup(List equivalentItems) { + + this.equivalentItems = new ArrayList(); + + for (ItemStack itemStack : equivalentItems) { + this.equivalentItems.add(new CustomWrappedStack(itemStack)); + } + } + + public List getMembers() { + + return equivalentItems; + } + + public boolean containsMember(ItemStack itemStack) { + + return containsMember(new CustomWrappedStack(itemStack)); + } + + public boolean containsMember(CustomWrappedStack customWrappedStack) { + + return equivalentItems.contains(customWrappedStack); + } + + public void addMember(ItemStack itemStack) { + + this.addMember(new CustomWrappedStack(itemStack)); + } + + public void addMember(CustomWrappedStack customWrappedStack) { + + if (!containsMember(customWrappedStack)) { + equivalentItems.add(customWrappedStack); + } + } + + public void setEquivalentItems(List equivalentItems) { + + this.equivalentItems = equivalentItems; + } + + public void removeMember(ItemStack itemStack) { + + removeMember(new CustomWrappedStack(itemStack)); + } + + public void removeMember(CustomWrappedStack customWrappedStack) { + + while (containsMember(customWrappedStack)) { + equivalentItems.remove(customWrappedStack); + } + } + + public void clearMembers() { + + equivalentItems = new ArrayList(); + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof EquivalencyGroup)) { + return false; + } + + EquivalencyGroup equivalencyGroup = (EquivalencyGroup) object; + + return (equivalentItems.equals(equivalencyGroup.equivalentItems)); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append("Equivalent Group Members: "); + for (CustomWrappedStack customWrappedStack : equivalentItems) { + stringBuilder.append(String.format("%s ", customWrappedStack)); + } + + return stringBuilder.toString(); + } + + @Override + public int hashCode() { + + int hashCode = 1; + + for (CustomWrappedStack customWrappedStack : equivalentItems) { + hashCode = 37 * hashCode + customWrappedStack.hashCode(); + } + + return hashCode; + } +} diff --git a/ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java b/ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java new file mode 100644 index 00000000..59e39bce --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java @@ -0,0 +1,272 @@ +package com.pahimar.ee3.emc.graph; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.logging.Logger; + +import com.pahimar.ee3.core.util.LogHelper; + +public class WeightedDirectedGraph implements Iterable { + + private final Map>> graph = new HashMap>>(); + private List orderedNodes = new ArrayList(); + + public boolean addNode(T node) { + + // Ignore nodes already added + if (graph.containsKey(node)) + return false; + + orderedNodes.add(node); + graph.put(node, new TreeSet>(new Comparator>() { + + @Override + public int compare(WeightedEdge o1, WeightedEdge o2) { + + return orderedNodes.indexOf(o1.getTarget()) - orderedNodes.indexOf(o2.getTarget()); + } + })); + + return true; + } + + public void addEdge(T from, T to) { + + addEdge(from, to, 1); + } + + public void addEdge(T from, T to, float weight) { + + if (!(graph.containsKey(from) && graph.containsKey(to))) { + if (!graph.containsKey(from)) { + LogHelper.severe("From node doesn't exist: " + from.toString()); + LogHelper.severe("To node: " + to.toString()); + } + if (!graph.containsKey(to)) { + LogHelper.severe("From node: " + from.toString()); + LogHelper.severe("To node doesn't exist: " + to.toString()); + } + throw new NoSuchElementException("Missing nodes from graph"); + } + + // If a directed edge of the same weight doesn't already exist, add the new edge + if (!edgeExists(from, to, weight)) { + graph.get(from).add(new WeightedEdge(weight, to)); + } + } + + public boolean edgeExists(T from, T to) { + + if (!(graph.containsKey(from) && graph.containsKey(to))) + throw new NoSuchElementException("Missing nodes from graph"); + + Iterator> edgeIterator = graph.get(from).iterator(); + + while (edgeIterator.hasNext()) { + if (edgeIterator.next().getTarget().equals(to)) + return true; + } + + return false; + } + + public boolean edgeExists(T from, T to, float weight) { + + if (!(graph.containsKey(from) && graph.containsKey(to))) { + if (!graph.containsKey(from)) { + LOGGER.severe("From node doesn't exist: " + from.toString()); + LOGGER.severe("To node: " + to.toString()); + } + if (!graph.containsKey(to)) { + LOGGER.severe("To node doesn't exist: " + to.toString()); + LOGGER.severe("From node: " + from.toString()); + } + throw new NoSuchElementException("Missing nodes from graph"); + } + + return graph.get(from).contains(new WeightedEdge(weight, to)); + } + + public boolean nodeExists(T node) { + + return graph.containsKey(node); + } + + public Set> edgesFrom(T from) { + + if (!graph.containsKey(from)) + throw new NoSuchElementException("Missing node from graph"); + + return Collections.unmodifiableSortedSet(graph.get(from)); + } + + public Set> edgesTo(T to) { + + if (!graph.containsKey(to)) + throw new NoSuchElementException("Missing node from graph"); + + Set> edgesTo = new TreeSet>(new Comparator>() { + + @Override + public int compare(WeightedEdge o1, WeightedEdge o2) { + + return o1.hashCode() - o2.hashCode(); + } + }); + + for (T node : graph.keySet()) { + if (!node.equals(to)) { + Set> edgesFrom = edgesFrom(node); + + for (WeightedEdge fromEdge : edgesFrom) { + if (fromEdge.getTarget().equals(to)) { + edgesTo.add(new WeightedEdge(fromEdge.getWeight(), node)); + } + } + } + } + + return Collections.unmodifiableSet(edgesTo); + } + + public void removeNode(T node) { + + if (!graph.containsKey(node)) + throw new NoSuchElementException("Missing node from graph"); + + // Remove all edges from and to the node + removeAllEdgesFrom(node); + removeAllEdgesTo(node); + + // Remove the node + graph.remove(node); + } + + public void removeEdge(T from, T to) { + + removeEdge(from, to, 1); + } + + public void removeEdge(T from, T to, float weight) { + + if (!(graph.containsKey(from) && graph.containsKey(to))) + throw new NoSuchElementException("Missing nodes from graph"); + + graph.get(from).remove(new WeightedEdge(weight, to)); + } + + public void removeAllEdgesFrom(T node) { + + if (!graph.containsKey(node)) + throw new NoSuchElementException("Missing node from graph"); + + graph.get(node).clear(); + } + + public void removeAllEdgesTo(T node) { + + if (!graph.containsKey(node)) + throw new NoSuchElementException("Missing node from graph"); + + for (T aNode : graph.keySet()) { + Set> edgesFrom = edgesFrom(aNode); + + for (WeightedEdge fromEdge : edgesFrom) { + if (fromEdge.getTarget().equals(node)) { + graph.get(aNode).remove(fromEdge); + } + } + } + } + + public void removeAllEdgesBetween(T firstNode, T secondNode) { + + if (!(graph.containsKey(firstNode) && graph.containsKey(secondNode))) + throw new NoSuchElementException("Missing nodes from graph"); + + for (WeightedEdge edgeFrom : edgesFrom(firstNode)) { + if (edgeFrom.getTarget().equals(secondNode)) { + graph.get(firstNode).remove(edgeFrom); + } + } + + for (WeightedEdge edgeFrom : edgesFrom(secondNode)) { + if (edgeFrom.getTarget().equals(firstNode)) { + graph.get(secondNode).remove(edgeFrom); + } + } + } + + public List getAllNodes() { + + return orderedNodes; + } + + public List getCriticalNodes() { + + ArrayList criticalNodes = new ArrayList(); + + Iterator nodeIter = orderedNodes.iterator(); + + while (nodeIter.hasNext()) { + T currentNode = nodeIter.next(); + + if (this.edgesFrom(currentNode).size() == 0) { + criticalNodes.add(currentNode); + } + } + + return criticalNodes; + } + + public List getOrphanNodes() { + + ArrayList orphanedNodes = new ArrayList(); + + Iterator nodeIter = orderedNodes.iterator(); + + while (nodeIter.hasNext()) { + T currentNode = nodeIter.next(); + + if (this.edgesFrom(currentNode).size() == 0 && this.edgesTo(currentNode).size() == 0) { + orphanedNodes.add(currentNode); + } + } + + return orphanedNodes; + } + + @Override + public Iterator iterator() { + + return orderedNodes.iterator(); + } + + public int size() { + + return graph.size(); + } + + public boolean isEmpty() { + + return graph.isEmpty(); + } + + @Override + public String toString() { + + return graph.toString(); + } + + private static final Logger LOGGER = Logger.getLogger(WeightedDirectedGraph.class.getName()); + +} diff --git a/ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java b/ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java new file mode 100644 index 00000000..9b7d97ed --- /dev/null +++ b/ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java @@ -0,0 +1,55 @@ +package com.pahimar.ee3.emc.graph; + +public class WeightedEdge { + + private float weight; + private T target; + + public WeightedEdge(float weight, T target) { + + this.weight = weight; + this.target = target; + } + + public float getWeight() { + + return weight; + } + + public T getTarget() { + + return target; + } + + public void setWeight(float weight) { + + this.weight = weight; + } + + public void setTarget(T target) { + + this.target = target; + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof WeightedEdge)) { + return false; + } + + WeightedEdge edge = (WeightedEdge) object; + + return ((this.weight == edge.weight) && (target.equals(edge.target))); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("Weight: %s, Target: %s ", weight, target)); + + return stringBuilder.toString(); + } +} diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java b/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java index bf67f9ab..04a8f51c 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java @@ -6,8 +6,8 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; /** * Equivalent-Exchange-3 @@ -20,17 +20,23 @@ import com.pahimar.ee3.lib.Strings; */ public class ContainerAlchemicalBag extends Container { + private final int BAG_INVENTORY_ROWS = 4; + private final int BAG_INVENTORY_COLUMNS = 13; + + private final int PLAYER_INVENTORY_ROWS = 3; + private final int PLAYER_INVENTORY_COLUMNS = 9; + public ContainerAlchemicalBag(InventoryPlayer inventoryPlayer) { // Add the player's inventory slots to the container - for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) { - for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18)); + for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) { + for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) { + this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * PLAYER_INVENTORY_COLUMNS + PLAYER_INVENTORY_COLUMNS, 44 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18)); } } // Add the player's action bar slots to the container - for (int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) { + for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) { this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 162)); } } @@ -42,9 +48,9 @@ public class ContainerAlchemicalBag extends Container { } @Override - public void onCraftGuiClosed(EntityPlayer player) { + public void onContainerClosed(EntityPlayer player) { - super.onCraftGuiClosed(player); + super.onContainerClosed(player); if (!player.worldObj.isRemote) { InventoryPlayer invPlayer = player.inventory; @@ -57,4 +63,32 @@ public class ContainerAlchemicalBag extends Container { } } } + + @Override + public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) { + + ItemStack newItemStack = null; + Slot slot = (Slot) inventorySlots.get(slotIndex); + + if (slot != null && slot.getHasStack()) { + ItemStack itemStack = slot.getStack(); + newItemStack = itemStack.copy(); + + if (slotIndex < BAG_INVENTORY_ROWS * BAG_INVENTORY_COLUMNS) { + if (!this.mergeItemStack(itemStack, BAG_INVENTORY_ROWS * BAG_INVENTORY_COLUMNS, inventorySlots.size(), false)) + return null; + } + else if (!this.mergeItemStack(itemStack, 0, BAG_INVENTORY_ROWS * BAG_INVENTORY_COLUMNS, false)) + return null; + + if (itemStack.stackSize == 0) { + slot.putStack((ItemStack) null); + } + else { + slot.onSlotChanged(); + } + } + + return newItemStack; + } } diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java b/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java index 75758c6c..9f8d690f 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java @@ -63,9 +63,9 @@ public class ContainerAlchemicalChest extends Container { * Callback for when the crafting gui is closed. */ @Override - public void onCraftGuiClosed(EntityPlayer entityPlayer) { + public void onContainerClosed(EntityPlayer entityPlayer) { - super.onCraftGuiClosed(entityPlayer); + super.onContainerClosed(entityPlayer); tileAlchemicalChest.closeChest(); } @@ -80,7 +80,7 @@ public class ContainerAlchemicalChest extends Container { newItemStack = itemStack.copy(); if (slotIndex < CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS) { - if (!this.mergeItemStack(itemStack, CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS, inventorySlots.size(), true)) + if (!this.mergeItemStack(itemStack, CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS, inventorySlots.size(), false)) return null; } else if (!this.mergeItemStack(itemStack, 0, CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS, false)) diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerAludel.java b/ee3_common/com/pahimar/ee3/inventory/ContainerAludel.java index 08a569ea..8d410a94 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerAludel.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerAludel.java @@ -5,7 +5,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; +import com.pahimar.ee3.item.ItemAlchemicalDust; import com.pahimar.ee3.tileentity.TileAludel; /** @@ -24,9 +26,9 @@ public class ContainerAludel extends Container { public ContainerAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) { + this.addSlotToContainer(new Slot(tileAludel, TileAludel.FUEL_INVENTORY_INDEX, 44, 74)); this.addSlotToContainer(new Slot(tileAludel, TileAludel.INPUT_INVENTORY_INDEX, 44, 18)); this.addSlotToContainer(new Slot(tileAludel, TileAludel.DUST_INVENTORY_INDEX, 44, 39)); - this.addSlotToContainer(new Slot(tileAludel, TileAludel.FUEL_INVENTORY_INDEX, 44, 74)); this.addSlotToContainer(new Slot(tileAludel, TileAludel.OUTPUT_INVENTORY_INDEX, 120, 39)); // Add the player's inventory slots to the container @@ -51,6 +53,67 @@ public class ContainerAludel extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) { - return null; + ItemStack itemStack = null; + Slot slot = (Slot) inventorySlots.get(slotIndex); + + if (slot != null && slot.getHasStack()) { + + ItemStack slotItemStack = slot.getStack(); + itemStack = slotItemStack.copy(); + + /** + * If we are shift-clicking an item out of the Aludel's container, + * attempt to put it in the first available slot in the player's + * inventory + */ + if (slotIndex < TileAludel.INVENTORY_SIZE) { + + if (!this.mergeItemStack(slotItemStack, TileAludel.INVENTORY_SIZE, inventorySlots.size(), false)) { + return null; + } + } + else { + + /** + * If the stack being shift-clicked into the Aludel's container + * is a fuel, first try to put it in the fuel slot. If it cannot + * be merged into the fuel slot, try to put it in the input + * slot. + */ + if (TileEntityFurnace.isItemFuel(slotItemStack)) { + if (!this.mergeItemStack(slotItemStack, TileAludel.FUEL_INVENTORY_INDEX, TileAludel.INPUT_INVENTORY_INDEX, false)) { + return null; + } + } + + /** + * If the stack being shift-clicked into the Aludel's container + * is a dust, first try to put it in the dust slot. If it cannot + * be merged into the dust slot, try to put it in the input + * slot. + */ + else if (slotItemStack.getItem() instanceof ItemAlchemicalDust) { + if (!this.mergeItemStack(slotItemStack, TileAludel.DUST_INVENTORY_INDEX, TileAludel.OUTPUT_INVENTORY_INDEX, false)) { + return null; + } + } + + /** + * Finally, attempt to put stack into the input slot + */ + else if (!this.mergeItemStack(slotItemStack, TileAludel.INPUT_INVENTORY_INDEX, TileAludel.DUST_INVENTORY_INDEX, false)) { + return null; + } + } + + if (slotItemStack.stackSize == 0) { + slot.putStack((ItemStack) null); + } + else { + slot.onSlotChanged(); + } + } + + return itemStack; } } diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerCalcinator.java b/ee3_common/com/pahimar/ee3/inventory/ContainerCalcinator.java index 6ec364fd..550c4b50 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerCalcinator.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerCalcinator.java @@ -5,7 +5,6 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntityFurnace; import com.pahimar.ee3.tileentity.TileCalcinator; @@ -23,14 +22,14 @@ public class ContainerCalcinator extends Container { public ContainerCalcinator(InventoryPlayer inventoryPlayer, TileCalcinator calcinator) { - // Add the calcinator "to be calcined" slot to the container - this.addSlotToContainer(new Slot(calcinator, 0, 56, 17)); + // Add the fuel slot to the container + this.addSlotToContainer(new Slot(calcinator, TileCalcinator.FUEL_INVENTORY_INDEX, 56, 62)); - // Add the calcinator fuel slot to the container - this.addSlotToContainer(new Slot(calcinator, 1, 56, 62)); + // Add the input slot to the container + this.addSlotToContainer(new Slot(calcinator, TileCalcinator.INPUT_INVENTORY_INDEX, 56, 17)); - // Add the calcined results slot to the container - this.addSlotToContainer(new SlotCalcinator(calcinator, 2, 116, 35)); + // Add the output results slot to the container + this.addSlotToContainer(new SlotCalcinator(calcinator, TileCalcinator.OUTPUT_INVENTORY_INDEX, 116, 35)); // Add the player's inventory slots to the container for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) { @@ -51,56 +50,59 @@ public class ContainerCalcinator extends Container { return true; } - // TODO Write our own version - this is taken from ContainerFurnace @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { + public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) { - ItemStack var3 = null; - Slot var4 = (Slot) inventorySlots.get(par2); + ItemStack itemStack = null; + Slot slot = (Slot) inventorySlots.get(slotIndex); - if (var4 != null && var4.getHasStack()) { - ItemStack var5 = var4.getStack(); - var3 = var5.copy(); + if (slot != null && slot.getHasStack()) { - if (par2 == 2) { - if (!this.mergeItemStack(var5, 3, 39, true)) + ItemStack slotItemStack = slot.getStack(); + itemStack = slotItemStack.copy(); + + /** + * If we are shift-clicking an item out of the Aludel's container, + * attempt to put it in the first available slot in the player's + * inventory + */ + if (slotIndex < TileCalcinator.INVENTORY_SIZE) { + + if (!this.mergeItemStack(slotItemStack, TileCalcinator.INVENTORY_SIZE, inventorySlots.size(), false)) { return null; - - var4.onSlotChange(var5, var3); - } - else if (par2 != 1 && par2 != 0) { - if (FurnaceRecipes.smelting().getSmeltingResult(var5) != null) { - if (!this.mergeItemStack(var5, 0, 1, false)) - return null; } - else if (TileEntityFurnace.isItemFuel(var5)) { - if (!this.mergeItemStack(var5, 1, 2, false)) - return null; - } - else if (par2 >= 3 && par2 < 30) { - if (!this.mergeItemStack(var5, 30, 39, false)) - return null; - } - else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) - return null; - } - else if (!this.mergeItemStack(var5, 3, 39, false)) - return null; - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); } else { - var4.onSlotChanged(); + + /** + * If the stack being shift-clicked into the Aludel's container + * is a fuel, first try to put it in the fuel slot. If it cannot + * be merged into the fuel slot, try to put it in the input + * slot. + */ + if (TileEntityFurnace.isItemFuel(slotItemStack)) { + if (!this.mergeItemStack(slotItemStack, TileCalcinator.FUEL_INVENTORY_INDEX, TileCalcinator.OUTPUT_INVENTORY_INDEX, false)) { + return null; + } + } + + /** + * Finally, attempt to put stack into the input slot + */ + else if (!this.mergeItemStack(slotItemStack, TileCalcinator.INPUT_INVENTORY_INDEX, TileCalcinator.OUTPUT_INVENTORY_INDEX, false)) { + return null; + } } - if (var5.stackSize == var3.stackSize) - return null; - - var4.onPickupFromSlot(par1EntityPlayer, var5); + if (slotItemStack.stackSize == 0) { + slot.putStack((ItemStack) null); + } + else { + slot.onSlotChanged(); + } } - return var3; + return itemStack; } } diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerGlassBell.java b/ee3_common/com/pahimar/ee3/inventory/ContainerGlassBell.java index cf28ead6..603e2f2c 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerGlassBell.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerGlassBell.java @@ -6,7 +6,6 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.tileentity.TileAludel; import com.pahimar.ee3.tileentity.TileGlassBell; /** @@ -25,7 +24,7 @@ public class ContainerGlassBell extends Container { public ContainerGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) { - this.addSlotToContainer(new Slot(tileGlassBell, TileAludel.INPUT_INVENTORY_INDEX, 80, 22)); + this.addSlotToContainer(new Slot(tileGlassBell, TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, 80, 22)); // Add the player's inventory slots to the container for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) { @@ -49,6 +48,33 @@ public class ContainerGlassBell extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) { - return null; + ItemStack itemStack = null; + Slot slot = (Slot) inventorySlots.get(slotIndex); + + if (slot != null && slot.getHasStack()) { + ItemStack slotItemStack = slot.getStack(); + itemStack = slotItemStack.copy(); + + if (slotIndex < TileGlassBell.INVENTORY_SIZE) { + + if (!this.mergeItemStack(slotItemStack, 1, inventorySlots.size(), true)) { + return null; + } + } + else { + if (!this.mergeItemStack(slotItemStack, 0, TileGlassBell.INVENTORY_SIZE, false)) { + return null; + } + } + + if (slotItemStack.stackSize == 0) { + slot.putStack((ItemStack) null); + } + else { + slot.onSlotChanged(); + } + } + + return itemStack; } } diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java index 3677a6e9..b41fab2c 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java @@ -6,8 +6,8 @@ import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; /** * Equivalent-Exchange-3 @@ -32,9 +32,9 @@ public class ContainerPortableCrafting extends ContainerWorkbench { } @Override - public void onCraftGuiClosed(EntityPlayer player) { + public void onContainerClosed(EntityPlayer player) { - super.onCraftGuiClosed(player); + super.onContainerClosed(player); if (!player.worldObj.isRemote) { InventoryPlayer invPlayer = player.inventory; diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java index cb060f5d..da0f957b 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java @@ -5,8 +5,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; /** * Equivalent-Exchange-3 @@ -27,9 +27,9 @@ public class ContainerPortableTransmutation extends Container { } @Override - public void onCraftGuiClosed(EntityPlayer player) { + public void onContainerClosed(EntityPlayer player) { - super.onCraftGuiClosed(player); + super.onContainerClosed(player); if (!player.worldObj.isRemote) { InventoryPlayer invPlayer = player.inventory; diff --git a/ee3_common/com/pahimar/ee3/inventory/WorldSavedDataEE.java b/ee3_common/com/pahimar/ee3/inventory/WorldSavedDataEE.java index de1352d1..6b87da05 100644 --- a/ee3_common/com/pahimar/ee3/inventory/WorldSavedDataEE.java +++ b/ee3_common/com/pahimar/ee3/inventory/WorldSavedDataEE.java @@ -122,7 +122,7 @@ public class WorldSavedDataEE extends WorldSavedData implements IInventory { } @Override - public boolean isStackValidForSlot(int i, ItemStack itemstack) { + public boolean isItemValidForSlot(int i, ItemStack itemstack) { return false; } diff --git a/ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java b/ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java new file mode 100644 index 00000000..60923788 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java @@ -0,0 +1,290 @@ +package com.pahimar.ee3.item; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import com.pahimar.ee3.core.util.EnergyStack; +import com.pahimar.ee3.core.util.ItemUtil; +import com.pahimar.ee3.core.util.OreStack; +import com.pahimar.ee3.lib.Reference; + +public class CustomWrappedStack { + + private int stackSize; + private ItemStack itemStack; + private OreStack oreStack; + private EnergyStack energyStack; + + /** + * Creates a new CustomWrappedStack object which wraps the given input. + * Valid inputs would be ItemStacks or OreStacks. If something other than an + * ItemStack or an OreStack is used as input, nothing is wrapped and the + * size of the wrapped stack is set to -1 to indicate an invalid wrapped + * stack. + * + * @param object + * The newly created wrapped stack object + */ + public CustomWrappedStack(Object object) { + + /* + * If we are given an Item or a Block, convert it to an ItemStack for further inspection + */ + if (object instanceof Item) { + object = new ItemStack((Item) object); + } + else if (object instanceof Block) { + object = new ItemStack((Block) object); + } + + /* + * We are given an ItemStack to wrap + */ + if (object instanceof ItemStack) { + + ItemStack itemStack = (ItemStack) object; + + /* + * If the ItemStack does not exist in the OreDictionary, wrap it as + * an ItemStack + */ + if (OreDictionary.getOreID(itemStack) == Reference.ORE_DICTIONARY_NOT_FOUND) { + this.itemStack = itemStack.copy(); + oreStack = null; + energyStack = null; + stackSize = this.itemStack.stackSize; + this.itemStack.stackSize = 1; + } + /* + * Else the ItemStack exists in the OreDictionary, so wrap it as an + * OreStack instead of an ItemStack + */ + else { + this.itemStack = null; + oreStack = new OreStack(itemStack); + energyStack = null; + stackSize = oreStack.stackSize; + oreStack.stackSize = 1; + } + } + /* + * Or we are given an OreStack to wrap + */ + else if (object instanceof OreStack) { + + itemStack = null; + oreStack = (OreStack) object; + energyStack = null; + stackSize = oreStack.stackSize; + oreStack.stackSize = 1; + } + else if (object instanceof ArrayList) { + + itemStack = null; + + ArrayList objectList = (ArrayList) object; + + if (!objectList.isEmpty()) { + for (Object listElement : objectList) { + if (listElement instanceof ItemStack) { + ItemStack stack = (ItemStack) listElement; + + if (OreDictionary.getOreID(stack) != Reference.ORE_DICTIONARY_NOT_FOUND) { + oreStack = new OreStack(stack); + stackSize = oreStack.stackSize; + oreStack.stackSize = 1; + break; + } + } + } + } + + energyStack = null; + } + /* + * Or we are given an EnergyStack to wrap + */ + else if (object instanceof EnergyStack) { + itemStack = null; + oreStack = null; + energyStack = (EnergyStack) object; + stackSize = energyStack.stackSize; + energyStack.stackSize = 1; + } + else if (object instanceof CustomWrappedStack) { + CustomWrappedStack wrappedStack = (CustomWrappedStack) object; + + itemStack = wrappedStack.itemStack; + oreStack = wrappedStack.oreStack; + energyStack = wrappedStack.energyStack; + stackSize = wrappedStack.stackSize; + } + /* + * Else, we are given something we cannot wrap + */ + else { + stackSize = -1; + } + } + + /** + * Returns the stack size of the wrapped stack, or -1 if we wrapped an + * invalid input + * + * @return The size of the wrapped stack + */ + public int getStackSize() { + + return stackSize; + } + + /** + * Sets the size of the wrapped stack + * + * @param stackSize + * The new size of the wrapped stack + */ + public void setStackSize(int stackSize) { + + this.stackSize = stackSize; + } + + /** + * Returns the wrapped stack + * + * @return The wrapped ItemStack, OreStack, or EnergyStack, or null if + * something other than an ItemStack, OreStack, or EnergyStack was + * used to create this object + */ + public Object getWrappedStack() { + + if (itemStack != null) { + return itemStack; + } + else if (oreStack != null) { + return oreStack; + } + else if (energyStack != null) { + return energyStack; + } + + return null; + } + + @Override + public boolean equals(Object object) { + + if (!(object instanceof CustomWrappedStack)) + return false; + + CustomWrappedStack customWrappedStack = (CustomWrappedStack) object; + + if (itemStack != null) { + if (customWrappedStack.itemStack != null) + return ItemUtil.compare(itemStack, customWrappedStack.itemStack) && stackSize == customWrappedStack.itemStack.stackSize; + else if (customWrappedStack.oreStack != null) { + for (ItemStack oreDictItemStack : OreDictionary.getOres(customWrappedStack.oreStack.oreName)) { + if (ItemUtil.compare(itemStack, oreDictItemStack) && stackSize == customWrappedStack.stackSize) + return true; + } + } + } + else if (oreStack != null) { + if (customWrappedStack.itemStack != null) { + for (ItemStack oreDictItemStack : OreDictionary.getOres(oreStack.oreName)) { + if (ItemUtil.compare(customWrappedStack.itemStack, oreDictItemStack) && stackSize == customWrappedStack.stackSize) + return true; + } + } + else if (customWrappedStack.oreStack != null) + return oreStack.oreName.equalsIgnoreCase(customWrappedStack.oreStack.oreName) && stackSize == customWrappedStack.stackSize; + } + else if (energyStack != null) { + if (customWrappedStack.energyStack != null) { + return energyStack.energyName.equalsIgnoreCase(customWrappedStack.energyStack.energyName) && stackSize == customWrappedStack.stackSize; + } + } + + return false; + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + if (itemStack != null) { + stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", this.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getItemName(), itemStack.getItem().getClass().getCanonicalName())); + } + else if (oreStack != null) { + stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName)); + } + else if (energyStack != null) { + stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName)); + } + else { + stringBuilder.append("null"); + } + + return stringBuilder.toString(); + } + + public String encodeAsPropertyKey() { + + StringBuilder stringBuilder = new StringBuilder(); + + if (itemStack != null) { + stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", this.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getItemName(), itemStack.getItem().getClass().getCanonicalName())); + } + else if (oreStack != null) { + stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName)); + } + else if (energyStack != null) { + stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName)); + } + + return stringBuilder.toString(); + } + + @Override + public int hashCode() { + + int hashCode = 1; + + hashCode = 37 * hashCode + stackSize; + + if (itemStack != null) { + hashCode = 37 * hashCode + itemStack.itemID; + + if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + hashCode = 37 * hashCode; + } + else { + hashCode = 37 * hashCode + itemStack.getItemDamage(); + } + + try { + hashCode = 37 * hashCode + itemStack.getItemName().hashCode(); + } catch (ArrayIndexOutOfBoundsException e) { + + } + } + else if (oreStack != null) { + hashCode = 37 * hashCode + oreStack.oreName.hashCode(); + } + else if (energyStack != null) { + hashCode = 37 * hashCode + energyStack.energyName.hashCode(); + } + + return hashCode; + } + + public static boolean canBeWrapped(Object object) { + + return (object instanceof CustomWrappedStack || object instanceof ItemStack || object instanceof OreStack || object instanceof EnergyStack || object instanceof Item || object instanceof Block); + } +} diff --git a/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java b/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java index 66f26e6d..805d9ce4 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java +++ b/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java @@ -8,11 +8,12 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.ItemUtil; import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -113,20 +114,12 @@ public class ItemAlchemicalBag extends ItemEE { public boolean hasColor(ItemStack itemStack) { - return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR); + return ItemUtil.hasColor(itemStack); } public int getColor(ItemStack itemStack) { - NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); - - if (nbtTagCompound == null) - return Integer.parseInt(Colours.PURE_WHITE, 16); - else { - - NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); - return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16); - } + return ItemUtil.getColor(itemStack); } public void setColor(ItemStack itemStack, int color) { @@ -136,22 +129,7 @@ public class ItemAlchemicalBag extends ItemEE { // TODO Localize throw new UnsupportedOperationException("Can\'t dye non-bags!"); else { - - NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); - - if (nbtTagCompound == null) { - - nbtTagCompound = new NBTTagCompound(); - itemStack.setTagCompound(nbtTagCompound); - } - - NBTTagCompound colourTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); - - if (!nbtTagCompound.hasKey(Strings.NBT_ITEM_DISPLAY)) { - nbtTagCompound.setCompoundTag(Strings.NBT_ITEM_DISPLAY, colourTagCompound); - } - - colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color); + ItemUtil.setColor(itemStack, color); } } } diff --git a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java index f518a600..c19fd90c 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java @@ -7,10 +7,10 @@ import net.minecraft.world.World; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.NBTHelper; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -24,7 +24,8 @@ import cpw.mods.fml.relauncher.SideOnly; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ -public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKeyBound { +public class ItemMiniumStone extends ItemEE + implements ITransmutationStone, IKeyBound { public ItemMiniumStone(int id) { @@ -62,9 +63,14 @@ public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKey @Override public ItemStack getContainerItemStack(ItemStack itemStack) { - itemStack.setItemDamage(itemStack.getItemDamage() + 1); + ItemStack copiedStack = itemStack.copy(); - return itemStack; + copiedStack.setItemDamage(copiedStack.getItemDamage() + 1); + + // Hacky hacky hack hack + copiedStack.stackSize = 1; + + return copiedStack; } @Override diff --git a/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java b/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java index a9a6126f..4a8ac3e4 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java @@ -7,11 +7,11 @@ import net.minecraft.world.World; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.NBTHelper; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.Sounds; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.nbt.NBTHelper; import com.pahimar.ee3.network.PacketTypeHandler; import com.pahimar.ee3.network.packet.PacketSoundEvent; @@ -70,9 +70,14 @@ public class ItemPhilosophersStone extends ItemEE @Override public ItemStack getContainerItemStack(ItemStack itemStack) { - itemStack.setItemDamage(itemStack.getItemDamage() + 1); + ItemStack copiedStack = itemStack.copy(); - return itemStack; + copiedStack.setItemDamage(copiedStack.getItemDamage() + 1); + + // Hacky hacky hack hack + copiedStack.stackSize = 1; + + return copiedStack; } @Override diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java new file mode 100644 index 00000000..48079f93 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java @@ -0,0 +1,301 @@ +package com.pahimar.ee3.item.crafting; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.pahimar.ee3.core.util.EnergyStack; +import com.pahimar.ee3.core.util.ItemUtil; +import com.pahimar.ee3.core.util.OreStack; +import com.pahimar.ee3.core.util.RecipeHelper; +import com.pahimar.ee3.item.CustomWrappedStack; + +public class RecipeRegistry { + + private static RecipeRegistry recipeRegistry = null; + + private Multimap> recipeMap; + private ArrayList discoveredStacks; + private ArrayList recipelessStacks; + private List wildCardStacks; + + private RecipeRegistry() { + + recipeMap = HashMultimap.create(); + wildCardStacks = RecipeHelper.populateWildCards(); + discoveredStacks = new ArrayList(); + recipelessStacks = new ArrayList(); + } + + public static RecipeRegistry getInstance() { + + if (recipeRegistry == null) { + recipeRegistry = new RecipeRegistry(); + recipeRegistry.init(); + } + + return recipeRegistry; + } + + private void init() { + + Multimap> recipes = HashMultimap.create(); + + // Add potion recipes + recipes.putAll(RecipesPotions.getPotionRecipes()); + + // Add smelting recipes in the vanilla smelting manager + recipes.putAll(RecipesSmelting.getSmeltingRecipes()); + + // Add recipes in the vanilla crafting manager + recipes.putAll(RecipesVanilla.getVanillaRecipes()); + + // Add recipes gathered via IMC + // TODO Gather IMC recipes + + // Populate the discovered stacks list with all stacks that we are involved in a recipe we are aware of + discoverStacks(recipes); + + // Add items that have no recipe, using the list of discovered stacks to determine if it's in a recipe or not + for (CustomWrappedStack stack : recipelessStacks) { + recipes.put(stack, new ArrayList()); + } + + // Iterate through every recipe in the map, and add them to the registry + Set recipeKeySet = recipes.keySet(); + Iterator recipeKeySetIterator = recipeKeySet.iterator(); + CustomWrappedStack recipeOutput = null; + + while (recipeKeySetIterator.hasNext()) { + recipeOutput = recipeKeySetIterator.next(); + + for (List recipeInputs : recipes.get(recipeOutput)) { + addRecipe(recipeOutput, recipeInputs); + } + } + } + + private void discoverStacks(Multimap> recipes) { + + Set recipeKeySet = recipes.keySet(); + Iterator recipeKeySetIterator = recipeKeySet.iterator(); + CustomWrappedStack recipeOutput = null; + + // Discover all stacks involved in the recipes we know about + while (recipeKeySetIterator.hasNext()) { + recipeOutput = recipeKeySetIterator.next(); + + if (!discoveredStacks.contains(new CustomWrappedStack(recipeOutput.getWrappedStack())) && recipeOutput.getWrappedStack() != null) { + discoveredStacks.add(new CustomWrappedStack(recipeOutput.getWrappedStack())); + } + + for (List recipeInputs : recipes.get(recipeOutput)) { + for (CustomWrappedStack recipeInput : recipeInputs) { + + CustomWrappedStack unwrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack()); + + if (!discoveredStacks.contains(unwrappedRecipeInput) && recipeInput.getWrappedStack() != null) { + discoveredStacks.add(unwrappedRecipeInput); + } + } + } + } + + CustomWrappedStack customWrappedStack; + + // Discover all stacks from the vanilla Items array + for (int i = 0; i < Item.itemsList.length; i++) { + + if (Item.itemsList[i] != null) { + + if (Item.itemsList[i].getHasSubtypes()) { + + for (int meta = 0; meta < 16; meta++) { + + customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta)); + + if (!discoveredStacks.contains(customWrappedStack)) { + discoveredStacks.add(customWrappedStack); + } + } + } + else { + + customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i])); + + if (!discoveredStacks.contains(customWrappedStack)) { + discoveredStacks.add(customWrappedStack); + } + } + } + } + + /* + * For every stack we have discovered, check to see if we know a recipe for it. If we don't + * and we haven't already added it to the recipeless stack list, add it to the recipeless stack + * list + */ + for (CustomWrappedStack discoveredStack : discoveredStacks) { + + if (recipes.get(discoveredStack).size() == 0 && !recipelessStacks.contains(discoveredStack)) { + recipelessStacks.add(discoveredStack); + } + } + } + + public boolean hasRecipe(CustomWrappedStack customWrappedStack) { + + return recipeMap.containsKey(customWrappedStack); + } + + public boolean hasRecipe(ItemStack itemStack) { + + return hasRecipe(new CustomWrappedStack(itemStack)); + } + + public int countRecipesFor(CustomWrappedStack customWrappedStack) { + + Collection> keys = recipeMap.get(customWrappedStack); + + return keys.size(); + } + + public int countRecipesFor(ItemStack itemStack) { + + return countRecipesFor(new CustomWrappedStack(itemStack)); + } + + public Collection> getRecipesFor(CustomWrappedStack customWrappedStack) { + + return recipeMap.get(customWrappedStack); + } + + public Collection> getRecipesFor(ItemStack itemStack) { + + return getRecipesFor(new CustomWrappedStack(itemStack)); + } + + /* + * Item: Item (Output) <- { ... } + */ + public void addRecipe(CustomWrappedStack recipeOutput, List recipeInputs) { + + ArrayList collatedStacks = new ArrayList(); + + CustomWrappedStack wrappedInputStack = null; + boolean found = false; + + /** + * For every input in the input list, check to see if we have discovered + * it already - If we have, add it to the one we already have - If we + * have not, add it to the collection of discovered items + */ + for (Object object : recipeInputs) { + + if (object instanceof ItemStack || object instanceof OreStack) { + wrappedInputStack = new CustomWrappedStack(object); + } + else if (object instanceof CustomWrappedStack) { + wrappedInputStack = (CustomWrappedStack) object; + } + + if (wildCardStacks.contains(wrappedInputStack)) { + Iterator wildIter = wildCardStacks.iterator(); + while (wildIter.hasNext()) { + CustomWrappedStack wildCard = wildIter.next(); + if (wildCard.equals(wrappedInputStack)) { + wrappedInputStack = wildCard; + break; + } + } + } + + if (collatedStacks.size() == 0) { + collatedStacks.add(wrappedInputStack); + } + else { + found = false; + + for (int i = 0; i < collatedStacks.size(); i++) { + if (collatedStacks.get(i) != null) { + if (wrappedInputStack.getWrappedStack() instanceof ItemStack && collatedStacks.get(i).getWrappedStack() instanceof ItemStack) { + if (ItemUtil.compare((ItemStack) wrappedInputStack.getWrappedStack(), (ItemStack) collatedStacks.get(i).getWrappedStack())) { + collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + wrappedInputStack.getStackSize()); + found = true; + } + } + else if (wrappedInputStack.getWrappedStack() instanceof OreStack && collatedStacks.get(i).getWrappedStack() instanceof OreStack) { + if (OreStack.compareStacks((OreStack) wrappedInputStack.getWrappedStack(), (OreStack) collatedStacks.get(i).getWrappedStack())) { + collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + wrappedInputStack.getStackSize()); + found = true; + } + } + else if (wrappedInputStack.getWrappedStack() instanceof EnergyStack && collatedStacks.get(i).getWrappedStack() instanceof EnergyStack) { + if (((EnergyStack) wrappedInputStack.getWrappedStack()).energyName.equalsIgnoreCase(((EnergyStack) collatedStacks.get(i).getWrappedStack()).energyName)) { + collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + wrappedInputStack.getStackSize()); + found = true; + } + } + } + } + + if (!found) { + collatedStacks.add(wrappedInputStack); + } + } + } + + if (!recipeMap.containsEntry(recipeOutput, collatedStacks)) { + recipeMap.put(recipeOutput, collatedStacks); + } + } + + public int size() { + + return recipeMap.size(); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + for (CustomWrappedStack key : recipeMap.keySet()) { + + Collection> recipeMappings = recipeMap.get(key); + + for (List recipeList : recipeMappings) { + stringBuilder.append(String.format("Recipe Output: %s, Recipe Input: %s\n", key.toString(), recipeList.toString())); + } + } + + return stringBuilder.toString(); + } + + public Multimap> getRecipeMappings() { + + return recipeMap; + } + + public List getDiscoveredStacks() { + + return discoveredStacks; + } + + public List getRecipelessStacks() { + + return recipelessStacks; + } + + public List getWildCardStacks() { + + return wildCardStacks; + } +} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java index dc65b590..74d8adb2 100644 --- a/ee3_common/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java +++ b/ee3_common/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java @@ -2,7 +2,7 @@ package com.pahimar.ee3.item.crafting; import java.util.ArrayList; -import net.minecraft.block.BlockCloth; +import net.minecraft.block.BlockColored; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -101,7 +101,7 @@ public class RecipesAlchemicalBagDyes implements IRecipe { if (currentStack.itemID != Item.dyePowder.itemID) return null; - float[] dyeColorChannels = EntitySheep.fleeceColorTable[BlockCloth.getBlockFromDye(currentStack.getItemDamage())]; + float[] dyeColorChannels = EntitySheep.fleeceColorTable[BlockColored.getBlockFromDye(currentStack.getItemDamage())]; j1 = (int) (dyeColorChannels[0] * 255.0F); k1 = (int) (dyeColorChannels[1] * 255.0F); newColor = (int) (dyeColorChannels[2] * 255.0F); diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java new file mode 100644 index 00000000..c270bac9 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java @@ -0,0 +1,292 @@ +package com.pahimar.ee3.item.crafting; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.pahimar.ee3.item.CustomWrappedStack; + +public class RecipesPotions { + + private static Multimap> potionRecipes = null; + + private static CustomWrappedStack reagentWater = new CustomWrappedStack(new ItemStack(Block.waterStill)); + private static CustomWrappedStack reagentNetherWart = new CustomWrappedStack(new ItemStack(372, 1, 0)); + private static CustomWrappedStack reagentGlowstoneDust = new CustomWrappedStack(new ItemStack(Item.glowstone)); + private static CustomWrappedStack reagentRedstoneDust = new CustomWrappedStack(new ItemStack(331, 1, 0)); + private static CustomWrappedStack reagentGunpowder = new CustomWrappedStack(new ItemStack(Item.gunpowder)); + private static CustomWrappedStack reagentGoldenCarrot = new CustomWrappedStack(new ItemStack(Item.goldenCarrot)); + private static CustomWrappedStack reagentMagmaCream = new CustomWrappedStack(new ItemStack(Item.magmaCream)); + private static CustomWrappedStack reagentSugar = new CustomWrappedStack(new ItemStack(Item.sugar)); + private static CustomWrappedStack reagentGlisteringMelon = new CustomWrappedStack(new ItemStack(Item.speckledMelon)); + private static CustomWrappedStack reagentSpiderEye = new CustomWrappedStack(new ItemStack(Item.spiderEye)); + private static CustomWrappedStack reagentGhastTear = new CustomWrappedStack(new ItemStack(Item.ghastTear)); + private static CustomWrappedStack reagentFermentedSpiderEye = new CustomWrappedStack(new ItemStack(Item.fermentedSpiderEye)); + private static CustomWrappedStack reagentBlazePowder = new CustomWrappedStack(new ItemStack(Item.blazePowder)); + + private static CustomWrappedStack bottleWater = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 0)); + + private static CustomWrappedStack potionAwkward = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16)); + private static CustomWrappedStack potionThick = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 32)); + private static CustomWrappedStack potionMundane = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 128)); + private static CustomWrappedStack potionMundaneExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 64)); + private static CustomWrappedStack potionMundaneSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16512)); + private static CustomWrappedStack potionMundaneSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16448)); + + private static CustomWrappedStack potionRegeneration = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8193)); + private static CustomWrappedStack potionRegenerationEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8225)); + private static CustomWrappedStack potionRegenerationExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8257)); + private static CustomWrappedStack potionRegenerationSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16385)); + private static CustomWrappedStack potionRegenerationSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16417)); + private static CustomWrappedStack potionRegenerationSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16449)); + + private static CustomWrappedStack potionSwiftness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8194)); + private static CustomWrappedStack potionSwiftnessEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8226)); + private static CustomWrappedStack potionSwiftnessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8258)); + private static CustomWrappedStack potionSwiftnessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16386)); + private static CustomWrappedStack potionSwiftnessSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16418)); + private static CustomWrappedStack potionSwiftnessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16450)); + + private static CustomWrappedStack potionFireResist = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8195)); + private static CustomWrappedStack potionFireResistExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8259)); + private static CustomWrappedStack potionFireResistSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16387)); + private static CustomWrappedStack potionFireResistSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16451)); + + private static CustomWrappedStack potionPoison = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8196)); + private static CustomWrappedStack potionPoisonEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8228)); + private static CustomWrappedStack potionPoisonExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8260)); + private static CustomWrappedStack potionPoisonSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16388)); + private static CustomWrappedStack potionPoisonSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16420)); + private static CustomWrappedStack potionPoisonSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16452)); + + private static CustomWrappedStack potionHealing = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8197)); + private static CustomWrappedStack potionHealingEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8229)); + private static CustomWrappedStack potionHealingSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16389)); + private static CustomWrappedStack potionHealingSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16421)); + + private static CustomWrappedStack potionNightVision = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8198)); + private static CustomWrappedStack potionNightVisionExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8262)); + private static CustomWrappedStack potionNightVisionSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16390)); + private static CustomWrappedStack potionNightVisionSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16454)); + + private static CustomWrappedStack potionWeakness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8200)); + private static CustomWrappedStack potionWeaknessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8264)); + private static CustomWrappedStack potionWeaknessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16392)); + private static CustomWrappedStack potionWeaknessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16456)); + + private static CustomWrappedStack potionStrength = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8201)); + private static CustomWrappedStack potionStrengthEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8233)); + private static CustomWrappedStack potionStrengthExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8265)); + private static CustomWrappedStack potionStrengthSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16393)); + private static CustomWrappedStack potionStrengthSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16425)); + private static CustomWrappedStack potionStrengthSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16457)); + + private static CustomWrappedStack potionSlowness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8202)); + private static CustomWrappedStack potionSlownessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8266)); + private static CustomWrappedStack potionSlownessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16394)); + private static CustomWrappedStack potionSlownessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16458)); + + private static CustomWrappedStack potionHarming = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8204)); + private static CustomWrappedStack potionHarmingEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8236)); + private static CustomWrappedStack potionHarmingSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16396)); + private static CustomWrappedStack potionHarmingSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16428)); + + private static CustomWrappedStack potionInvisibility = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8206)); + private static CustomWrappedStack potionInvisibilityExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8270)); + private static CustomWrappedStack potionInvisibilitySplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16398)); + private static CustomWrappedStack potionInvisibilitySplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16462)); + + public static Multimap> getPotionRecipes() { + + if (potionRecipes == null) { + init(); + } + + return potionRecipes; + } + + private static void init() { + + potionRecipes = HashMultimap.create(); + + potionRecipes.put(bottleWater, Arrays.asList(reagentWater)); + + potionRecipes.put(potionAwkward, Arrays.asList(bottleWater, reagentNetherWart)); + + potionRecipes.put(potionNightVision, Arrays.asList(potionAwkward, reagentGoldenCarrot)); + potionRecipes.put(potionNightVision, Arrays.asList(potionNightVisionExtended, reagentGlowstoneDust)); + potionRecipes.put(potionNightVisionSplash, Arrays.asList(potionNightVisionSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionNightVisionSplash, Arrays.asList(potionNightVision, reagentGunpowder)); + + potionRecipes.put(potionNightVisionExtended, Arrays.asList(potionNightVision, reagentRedstoneDust)); + potionRecipes.put(potionNightVisionSplashExtended, Arrays.asList(potionNightVisionSplash, reagentRedstoneDust)); + potionRecipes.put(potionNightVisionSplashExtended, Arrays.asList(potionNightVisionExtended, reagentGunpowder)); + + potionRecipes.put(potionInvisibility, Arrays.asList(potionNightVision, reagentFermentedSpiderEye)); + potionRecipes.put(potionInvisibility, Arrays.asList(potionInvisibilityExtended, reagentGlowstoneDust)); + potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionNightVisionSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionInvisibilitySplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionInvisibility, reagentGunpowder)); + + potionRecipes.put(potionInvisibilityExtended, Arrays.asList(potionInvisibility, reagentRedstoneDust)); + potionRecipes.put(potionInvisibilityExtended, Arrays.asList(potionNightVisionExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionInvisibilitySplash, reagentRedstoneDust)); + potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionNightVisionSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionInvisibilityExtended, reagentGunpowder)); + + potionRecipes.put(potionFireResist, Arrays.asList(potionAwkward, reagentMagmaCream)); + potionRecipes.put(potionFireResist, Arrays.asList(potionFireResistExtended, reagentGlowstoneDust)); + potionRecipes.put(potionFireResistSplash, Arrays.asList(potionFireResistSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionFireResistSplash, Arrays.asList(potionFireResist, reagentGunpowder)); + + potionRecipes.put(potionFireResistExtended, Arrays.asList(potionFireResist, reagentRedstoneDust)); + potionRecipes.put(potionFireResistSplashExtended, Arrays.asList(potionFireResistSplash, reagentRedstoneDust)); + potionRecipes.put(potionFireResistSplashExtended, Arrays.asList(potionFireResistExtended, reagentGunpowder)); + + potionRecipes.put(potionSlowness, Arrays.asList(potionFireResist, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlowness, Arrays.asList(potionSlownessExtended, reagentGlowstoneDust)); + potionRecipes.put(potionSlowness, Arrays.asList(potionSwiftness, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlowness, Arrays.asList(potionSwiftnessExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplash, Arrays.asList(potionFireResistSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSlownessSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSwiftnessSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSwiftnessSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSlowness, reagentGunpowder)); + + potionRecipes.put(potionSlownessExtended, Arrays.asList(potionFireResistExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessExtended, Arrays.asList(potionSwiftnessEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionFireResistSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionSwiftnessSplashEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionSlownessExtended, reagentGunpowder)); + + potionRecipes.put(potionSwiftness, Arrays.asList(potionAwkward, reagentSugar)); + potionRecipes.put(potionSwiftnessSplash, Arrays.asList(potionSwiftness, reagentGunpowder)); + + potionRecipes.put(potionSwiftnessExtended, Arrays.asList(potionSwiftness, reagentRedstoneDust)); + potionRecipes.put(potionSwiftnessExtended, Arrays.asList(potionSwiftnessEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessSplash, reagentRedstoneDust)); + potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessSplashEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessExtended, reagentGunpowder)); + + potionRecipes.put(potionSwiftnessEnhanced, Arrays.asList(potionSwiftness, reagentGlowstoneDust)); + potionRecipes.put(potionSwiftnessEnhanced, Arrays.asList(potionSwiftnessExtended, reagentGlowstoneDust)); + potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessSplash, reagentGlowstoneDust)); + potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessEnhanced, reagentGunpowder)); + + potionRecipes.put(potionHealing, Arrays.asList(potionAwkward, reagentGlisteringMelon)); + potionRecipes.put(potionHealing, Arrays.asList(potionHealingEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionHealingSplash, Arrays.asList(potionHealingSplashEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionHealingSplash, Arrays.asList(potionHealing, reagentGunpowder)); + + potionRecipes.put(potionHealingEnhanced, Arrays.asList(potionHealing, reagentGlowstoneDust)); + potionRecipes.put(potionHealingSplashEnhanced, Arrays.asList(potionHealingSplash, reagentGlowstoneDust)); + potionRecipes.put(potionHealingSplashEnhanced, Arrays.asList(potionHealingEnhanced, reagentGunpowder)); + + potionRecipes.put(potionHarming, Arrays.asList(potionHealing, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarming, Arrays.asList(potionPoison, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarming, Arrays.asList(potionPoisonExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarming, Arrays.asList(potionHarmingEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHealingSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingSplash, Arrays.asList(potionPoisonSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingSplash, Arrays.asList(potionPoisonSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHarmingSplashEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHarming, reagentGunpowder)); + + potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionHealingEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionHarming, reagentGlowstoneDust)); + potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionPoisonEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHealingSplashEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHarmingSplash, reagentGlowstoneDust)); + potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionPoisonSplashEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHarmingEnhanced, reagentGunpowder)); + + potionRecipes.put(potionPoison, Arrays.asList(potionAwkward, reagentSpiderEye)); + potionRecipes.put(potionPoisonSplash, Arrays.asList(potionPoison, reagentGunpowder)); + + potionRecipes.put(potionPoisonExtended, Arrays.asList(potionPoisonExtended, reagentRedstoneDust)); + potionRecipes.put(potionPoisonExtended, Arrays.asList(potionPoisonEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonSplashExtended, reagentRedstoneDust)); + potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonSplashEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonExtended, reagentGunpowder)); + + potionRecipes.put(potionPoisonEnhanced, Arrays.asList(potionPoison, reagentGlowstoneDust)); + potionRecipes.put(potionPoisonEnhanced, Arrays.asList(potionPoisonExtended, reagentGlowstoneDust)); + potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonSplash, reagentGlowstoneDust)); + potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonEnhanced, reagentGunpowder)); + + potionRecipes.put(potionRegeneration, Arrays.asList(potionAwkward, reagentGhastTear)); + potionRecipes.put(potionRegenerationSplash, Arrays.asList(potionRegeneration, reagentGunpowder)); + + potionRecipes.put(potionRegenerationExtended, Arrays.asList(potionRegeneration, reagentRedstoneDust)); + potionRecipes.put(potionRegenerationExtended, Arrays.asList(potionRegenerationEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationSplash, reagentRedstoneDust)); + potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationSplashEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationExtended, reagentGunpowder)); + + potionRecipes.put(potionRegenerationEnhanced, Arrays.asList(potionRegeneration, reagentGlowstoneDust)); + potionRecipes.put(potionRegenerationEnhanced, Arrays.asList(potionRegenerationExtended, reagentGlowstoneDust)); + potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationSplash, reagentGlowstoneDust)); + potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationEnhanced, reagentGunpowder)); + + potionRecipes.put(potionWeakness, Arrays.asList(potionAwkward, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeakness, Arrays.asList(potionRegeneration, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeakness, Arrays.asList(potionRegenerationEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeakness, Arrays.asList(potionStrength, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeakness, Arrays.asList(potionStrengthEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeakness, Arrays.asList(potionMundane, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeakness, Arrays.asList(potionWeaknessExtended, reagentGlowstoneDust)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionRegenerationSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionRegenerationSplashEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionStrengthSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionStrengthSplashEnhanced, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionMundaneSplash, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionWeaknessSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionWeakness, reagentGunpowder)); + + potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionWeakness, reagentRedstoneDust)); + potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionRegenerationExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionStrengthExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionMundaneExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionWeaknessSplash, reagentRedstoneDust)); + potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionRegenerationSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionStrengthSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionMundaneSplashExtended, reagentFermentedSpiderEye)); + potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionWeaknessExtended, reagentGunpowder)); + + potionRecipes.put(potionStrength, Arrays.asList(potionAwkward, reagentBlazePowder)); + potionRecipes.put(potionStrengthSplash, Arrays.asList(potionStrength, reagentGunpowder)); + + potionRecipes.put(potionStrengthEnhanced, Arrays.asList(potionStrength, reagentGlowstoneDust)); + potionRecipes.put(potionStrengthEnhanced, Arrays.asList(potionStrengthExtended, reagentGlowstoneDust)); + potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthSplash, reagentGlowstoneDust)); + potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthSplashExtended, reagentGlowstoneDust)); + potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthEnhanced, reagentGunpowder)); + + potionRecipes.put(potionStrengthExtended, Arrays.asList(potionStrength, reagentRedstoneDust)); + potionRecipes.put(potionStrengthExtended, Arrays.asList(potionStrengthEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthSplash, reagentRedstoneDust)); + potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthSplashEnhanced, reagentRedstoneDust)); + potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthExtended, reagentGunpowder)); + + potionRecipes.put(potionThick, Arrays.asList(bottleWater, reagentGlowstoneDust)); + + potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentSugar)); + potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentGlisteringMelon)); + potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentSpiderEye)); + potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentBlazePowder)); + potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentMagmaCream)); + potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentGhastTear)); + potionRecipes.put(potionMundaneSplash, Arrays.asList(potionMundane, reagentGunpowder)); + + potionRecipes.put(potionMundaneExtended, Arrays.asList(bottleWater, reagentRedstoneDust)); + potionRecipes.put(potionMundaneSplashExtended, Arrays.asList(potionMundaneExtended, reagentGunpowder)); + } +} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java new file mode 100644 index 00000000..21f3e7c0 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java @@ -0,0 +1,48 @@ +package com.pahimar.ee3.item.crafting; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.pahimar.ee3.core.util.EnergyStack; +import com.pahimar.ee3.item.CustomWrappedStack; + +public class RecipesSmelting { + + private static Multimap> smeltingRecipes = null; + + private static final CustomWrappedStack smeltingEnergy = new CustomWrappedStack(new EnergyStack(EnergyStack.VANILLA_SMELTING_ENERGY_NAME, EnergyStack.VANILLA_SMELTING_ENERGY_THRESHOLD)); + + public static Multimap> getSmeltingRecipes() { + + if (smeltingRecipes == null) { + init(); + } + + return smeltingRecipes; + } + + private static void init() { + + smeltingRecipes = HashMultimap.create(); + + @SuppressWarnings("unchecked") + Map smeltingList = FurnaceRecipes.smelting().getSmeltingList(); + Map, ItemStack> metaSmeltingList = FurnaceRecipes.smelting().getMetaSmeltingList(); + + for (Integer i : smeltingList.keySet()) { + smeltingRecipes.put(new CustomWrappedStack(smeltingList.get(i)), Arrays.asList(smeltingEnergy, new CustomWrappedStack(new ItemStack(i, 1, 0)))); + } + + for (List idMetaPair : metaSmeltingList.keySet()) { + if (idMetaPair.size() == 2) { + smeltingRecipes.put(new CustomWrappedStack(metaSmeltingList.get(idMetaPair)), Arrays.asList(smeltingEnergy, new CustomWrappedStack(new ItemStack(idMetaPair.get(0), 1, idMetaPair.get(1))))); + } + } + } +} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java new file mode 100644 index 00000000..5b504acb --- /dev/null +++ b/ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java @@ -0,0 +1,49 @@ +package com.pahimar.ee3.item.crafting; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.pahimar.ee3.core.util.RecipeHelper; +import com.pahimar.ee3.item.CustomWrappedStack; + +public class RecipesVanilla { + + private static Multimap> vanillaRecipes = null; + + ArrayList discoveredItems = new ArrayList(); + + public static Multimap> getVanillaRecipes() { + + if (vanillaRecipes == null) { + init(); + } + + return vanillaRecipes; + } + + private static void init() { + + vanillaRecipes = HashMultimap.create(); + + for (Object recipeObject : CraftingManager.getInstance().getRecipeList()) { + + if (recipeObject instanceof IRecipe) { + + IRecipe recipe = (IRecipe) recipeObject; + ItemStack recipeOutput = recipe.getRecipeOutput(); + + if (recipeOutput != null) { + + ArrayList recipeInputs = RecipeHelper.getRecipeInputs(recipe); + vanillaRecipes.put(new CustomWrappedStack(recipeOutput), recipeInputs); + } + } + } + } +} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/TransmutationManager.java b/ee3_common/com/pahimar/ee3/item/crafting/TransmutationManager.java index 462205ed..9ec6d0f3 100644 --- a/ee3_common/com/pahimar/ee3/item/crafting/TransmutationManager.java +++ b/ee3_common/com/pahimar/ee3/item/crafting/TransmutationManager.java @@ -18,7 +18,7 @@ public class TransmutationManager { private static final TransmutationManager instance = new TransmutationManager(); /** A list of all the recipes added */ - private List recipes = new ArrayList(); + private List recipes = new ArrayList(); /** * Returns the static instance of this class @@ -35,7 +35,7 @@ public class TransmutationManager { /** * returns the List<> of all recipes */ - public List getRecipeList() { + public List getRecipeList() { return recipes; } diff --git a/ee3_common/com/pahimar/ee3/lib/BlockIds.java b/ee3_common/com/pahimar/ee3/lib/BlockIds.java index 74ae7a79..98958c07 100644 --- a/ee3_common/com/pahimar/ee3/lib/BlockIds.java +++ b/ee3_common/com/pahimar/ee3/lib/BlockIds.java @@ -14,13 +14,13 @@ public class BlockIds { /* Default block ids */ public static int CALCINATOR_DEFAULT = 2451; public static int RED_WATER_STILL_DEFAULT = 2453; - public static int ALUDEL_DEFAULT = 2454; + public static int ALUDEL_BASE_DEFAULT = 2454; public static int ALCHEMICAL_CHEST_DEFAULT = 2455; public static int GLASS_BELL_DEFAULT = 2456; /* Current block ids */ public static int CALCINATOR; - public static int ALUDEL; + public static int ALUDEL_BASE; public static int ALCHEMICAL_CHEST; public static int RED_WATER_STILL; public static int GLASS_BELL; diff --git a/ee3_common/com/pahimar/ee3/lib/InterModComms.java b/ee3_common/com/pahimar/ee3/lib/InterModComms.java new file mode 100644 index 00000000..c4133e50 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/lib/InterModComms.java @@ -0,0 +1,14 @@ +package com.pahimar.ee3.lib; + +public class InterModComms { + + // Interacting with the Recipe Registry + public static final String ADD_RECIPE = "add-recipe"; + + // Interacting with the EMC BlackList + public static final String ADD_BLACKLIST_ENTRY = "add-blacklist-entry"; + public static final String REMOVE_BLACKLIST_ENTRY = "remove-blacklist-entry"; + + // Interacting with the EMC value mappings + public static final String SET_EMC_VALUE = "set-emc-value"; +} diff --git a/ee3_common/com/pahimar/ee3/lib/Localizations.java b/ee3_common/com/pahimar/ee3/lib/Localizations.java index 9f058d6c..33a9c87e 100644 --- a/ee3_common/com/pahimar/ee3/lib/Localizations.java +++ b/ee3_common/com/pahimar/ee3/lib/Localizations.java @@ -1,20 +1,5 @@ package com.pahimar.ee3.lib; -import java.io.File; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.logging.Level; - -import com.pahimar.ee3.core.helper.LogHelper; - /** * Equivalent-Exchange-3 * @@ -26,101 +11,8 @@ import com.pahimar.ee3.core.helper.LogHelper; */ public class Localizations { - private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/"; - private static final String JAR_SUBDIRECTORY = "mods/ee3/lang/"; - - public static String[] localeFiles; - - /** - * parseDir - * - * Parses LANG_RESOURCE_LOCATION for any localizations and loads them into localeFiles - * - * @author Robotic-Brain - * - */ - public static void parseDir() { - try { - URL resourceURL = Localizations.class.getResource(LANG_RESOURCE_LOCATION); - - if (resourceURL == null) { - throw new Exception("NULL POINTER!"); - } - - if (resourceURL.getProtocol().equals("file")) { - parseNormalDirectory(resourceURL); - - } else if (resourceURL.getProtocol().equals("jar")) { - parseJarFile(resourceURL); - } - - LogHelper.log(Level.INFO, "Loaded " + localeFiles.length + " localizations"); - } catch (Exception e) { - LogHelper.log(Level.SEVERE, "Unable to load language files!"); - e.printStackTrace(System.err); - } - } - - /** - * parseNormalDirectory - * - * Parses a normal Directory on the filesystem into localeFiles - * @author Robotic-Brain - * - * @param resourceURL Parent directory URL - * @throws URISyntaxException - */ - private static void parseNormalDirectory(URL resourceURL) throws URISyntaxException { - LogHelper.log(Level.INFO, "Loading FILE"); - - File resourceFolder = new File(resourceURL.toURI()); - File[] files = resourceFolder.listFiles(); - - localeFiles = new String[files.length]; - - int i = 0; - for (File resource : files) { - localeFiles[i++] = LANG_RESOURCE_LOCATION + resource.getName(); - LogHelper.log(Level.INFO, "Added localization file: " + resource.getName()); - } - } - - - /** - * parseJarFile - * - * Walks a jar file and ads all files in given "subdirectory" (JAR_SUBDIRECTORY) to localeFiles - * @author Robotic-Brain - * - * @param resourceURL - * @throws UnsupportedEncodingException - * @throws IOException - */ - private static void parseJarFile(URL resourceURL) throws UnsupportedEncodingException, IOException { - LogHelper.log(Level.INFO, "Loading JAR"); - - // Getting Jar file Object - String jarFileString = resourceURL.getPath().substring(5, resourceURL.getPath().indexOf("!")); - JarFile jarFile = new JarFile(URLDecoder.decode(jarFileString, "UTF-8")); - - // Iterate over entries - ArrayList files = new ArrayList(); - Enumeration entries = jarFile.entries(); - while (entries.hasMoreElements()) { - String jarSubPath = entries.nextElement().getName(); - - // Only search specific Directory - if (jarSubPath.startsWith(JAR_SUBDIRECTORY)) { - jarSubPath = jarSubPath.substring(JAR_SUBDIRECTORY.length()); - if (!jarSubPath.trim().isEmpty() && jarSubPath.indexOf("/") < 0) { - // If file and not dir add to list - files.add(LANG_RESOURCE_LOCATION + jarSubPath); - LogHelper.log(Level.INFO, "Added localization file: " + jarSubPath); - } - } - } - - localeFiles = files.toArray(new String[files.size()]); - } + private static final String LANG_RESOURCE_LOCATION = "/assets/ee3/lang/"; + + public static String[] localeFiles = { LANG_RESOURCE_LOCATION + "cs_CZ.xml", LANG_RESOURCE_LOCATION + "cy_GB.xml", LANG_RESOURCE_LOCATION + "da_DK.xml", LANG_RESOURCE_LOCATION + "de_DE.xml", LANG_RESOURCE_LOCATION + "en_US.xml", LANG_RESOURCE_LOCATION + "es_ES.xml", LANG_RESOURCE_LOCATION + "fi_FI.xml", LANG_RESOURCE_LOCATION + "fr_FR.xml", LANG_RESOURCE_LOCATION + "it_IT.xml", LANG_RESOURCE_LOCATION + "ja_JP.xml", LANG_RESOURCE_LOCATION + "la_IT.xml", LANG_RESOURCE_LOCATION + "nl_NL.xml", LANG_RESOURCE_LOCATION + "nb_NO.xml", LANG_RESOURCE_LOCATION + "pl_PL.xml", LANG_RESOURCE_LOCATION + "pt_BR.xml", LANG_RESOURCE_LOCATION + "pt_PT.xml", LANG_RESOURCE_LOCATION + "ru_RU.xml", LANG_RESOURCE_LOCATION + "sk_SK.xml", LANG_RESOURCE_LOCATION + "sr_SP.xml", LANG_RESOURCE_LOCATION + "sv_SE.xml", LANG_RESOURCE_LOCATION + "tr_TR.xml", LANG_RESOURCE_LOCATION + "zh_CN.xml", LANG_RESOURCE_LOCATION + "zh_TW.xml", LANG_RESOURCE_LOCATION + "el_GR.xml" }; } diff --git a/ee3_common/com/pahimar/ee3/lib/Models.java b/ee3_common/com/pahimar/ee3/lib/Models.java index fc29299f..88a11b25 100644 --- a/ee3_common/com/pahimar/ee3/lib/Models.java +++ b/ee3_common/com/pahimar/ee3/lib/Models.java @@ -3,7 +3,7 @@ package com.pahimar.ee3.lib; public class Models { // Base file paths - public static final String MODEL_LOCATION = "/mods/ee3/models/"; + public static final String MODEL_LOCATION = "/assets/ee3/models/"; public static final String ALUDEL = MODEL_LOCATION + "aludel.obj"; public static final String CALCINATOR = MODEL_LOCATION + "calcinator.obj"; diff --git a/ee3_common/com/pahimar/ee3/lib/Reference.java b/ee3_common/com/pahimar/ee3/lib/Reference.java index c07e3f29..4a8bd425 100644 --- a/ee3_common/com/pahimar/ee3/lib/Reference.java +++ b/ee3_common/com/pahimar/ee3/lib/Reference.java @@ -27,4 +27,6 @@ public class Reference { public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.core.proxy.ClientProxy"; public static final int VERSION_CHECK_ATTEMPTS = 3; + public static final int ORE_DICTIONARY_NOT_FOUND = -1; + } diff --git a/ee3_common/com/pahimar/ee3/lib/Sounds.java b/ee3_common/com/pahimar/ee3/lib/Sounds.java index 93fc854c..242cc796 100644 --- a/ee3_common/com/pahimar/ee3/lib/Sounds.java +++ b/ee3_common/com/pahimar/ee3/lib/Sounds.java @@ -11,8 +11,8 @@ package com.pahimar.ee3.lib; */ public class Sounds { - private static final String SOUND_RESOURCE_LOCATION = "mods/ee3/sound/"; - private static final String SOUND_PREFIX = "mods.ee3.sound."; + private static final String SOUND_RESOURCE_LOCATION = Reference.MOD_ID.toLowerCase() + ":"; + private static final String SOUND_PREFIX = Reference.MOD_ID.toLowerCase() + ":"; public static String[] soundFiles = { SOUND_RESOURCE_LOCATION + "chargeDown.ogg", SOUND_RESOURCE_LOCATION + "chargeUp.ogg", SOUND_RESOURCE_LOCATION + "destruct.ogg", SOUND_RESOURCE_LOCATION + "fail.ogg", SOUND_RESOURCE_LOCATION + "gust.ogg", SOUND_RESOURCE_LOCATION + "heal.ogg", SOUND_RESOURCE_LOCATION + "kinesis.ogg", SOUND_RESOURCE_LOCATION + "launch.ogg", SOUND_RESOURCE_LOCATION + "nova.ogg", SOUND_RESOURCE_LOCATION + "philball.ogg", SOUND_RESOURCE_LOCATION + "tock.ogg", SOUND_RESOURCE_LOCATION + "transmute.ogg", SOUND_RESOURCE_LOCATION + "wall.ogg", SOUND_RESOURCE_LOCATION + "waterball.ogg", SOUND_RESOURCE_LOCATION + "wind.ogg" }; diff --git a/ee3_common/com/pahimar/ee3/lib/Strings.java b/ee3_common/com/pahimar/ee3/lib/Strings.java index b7936531..2ee765b5 100644 --- a/ee3_common/com/pahimar/ee3/lib/Strings.java +++ b/ee3_common/com/pahimar/ee3/lib/Strings.java @@ -14,6 +14,7 @@ public class Strings { /* General keys */ public static final String TRUE = "true"; public static final String FALSE = "false"; + public static final String TOKEN_DELIMITER = "."; /* Fingerprint check related constants */ public static final String INVALID_FINGERPRINT_MESSAGE = "The copy of Equivalent Exchange 3 that you are running has been modified from the original, and unpredictable things may happen. Please consider re-downloading the original version of the mod."; @@ -38,6 +39,19 @@ public class Strings { public static final String NBT_TE_STATE_KEY = "teState"; public static final String NBT_TE_CUSTOM_NAME = "CustomName"; public static final String NBT_TE_DIRECTION_KEY = "teDirection"; + public static final String NBT_ENCODED_RECIPE_OUTPUT = "recipeOutput"; + public static final String NBT_ENCODED_RECIPE_INPUTS = "recipeInputs"; + public static final String NBT_ENCODED_RECIPE_INPUT_PREFIX = "recipeInput_"; + public static final String NBT_ENCODED_ATTR_TYPE = "type"; + public static final String NBT_ENCODED_ATTR_TYPE_ITEM = "ItemStack"; + public static final String NBT_ENCODED_ATTR_TYPE_ORE = "OreStack"; + public static final String NBT_ENCODED_ATTR_TYPE_ENERGY = "EnergyStack"; + public static final String NBT_ENCODED_ATTR_SIZE = "Count"; + public static final String NBT_ENCODED_ATTR_ITEM_ID = "id"; + public static final String NBT_ENCODED_ATTR_ITEM_META = "Damage"; + public static final String NBT_ENCODED_ATTR_ITEM_TAG_COMPOUND = "tag"; + public static final String NBT_ENCODED_ATTR_ORE_NAME = "oreName"; + public static final String NBT_ENCODED_ATTR_ENERGY_NAME = "energyName"; /* Block name constants */ public static final String CALCINATOR_NAME = "calcinator"; @@ -52,7 +66,7 @@ public class Strings { public static final String INERT_STONE_NAME = "stoneInert"; public static final String MINIUM_STONE_NAME = "stoneMinium"; public static final String PHILOSOPHERS_STONE_NAME = "stonePhilosophers"; - public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust"; + public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust"; public static final String ALCHEMICAL_BAG_NAME = "alchemicalBag"; /* TileEntity name constants */ @@ -75,5 +89,4 @@ public class Strings { public static final String CONTAINER_GLASS_BELL_NAME = "container." + GLASS_BELL_NAME; public static final String CONTAINER_INVENTORY = "container.inventory"; public static final String CONTAINER_PORTABLE_CRAFTING = "container.crafting"; - } diff --git a/ee3_common/com/pahimar/ee3/lib/Textures.java b/ee3_common/com/pahimar/ee3/lib/Textures.java index 88951857..51af8788 100644 --- a/ee3_common/com/pahimar/ee3/lib/Textures.java +++ b/ee3_common/com/pahimar/ee3/lib/Textures.java @@ -1,5 +1,10 @@ package com.pahimar.ee3.lib; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.ResourceLocation; + +import com.pahimar.ee3.core.util.ResourceLocationHelper; + /** * Equivalent-Exchange-3 * @@ -11,35 +16,34 @@ package com.pahimar.ee3.lib; */ public class Textures { - // Base file pathes - public static final String ITEM_TEXTURE_LOCATION = "/mods/ee3/textures/items/"; - public static final String MODEL_SHEET_LOCATION = "/mods/ee3/textures/models/"; - public static final String ARMOR_SHEET_LOCATION = "/mods/ee3/textures/armor/"; - public static final String GUI_SHEET_LOCATION = "/mods/ee3/textures/gui/"; - public static final String EFFECTS_LOCATION = "/mods/ee3/textures/effects/"; + // Base file paths + public static final String MODEL_SHEET_LOCATION = "textures/models/"; + public static final String ARMOR_SHEET_LOCATION = "textures/armor/"; + public static final String GUI_SHEET_LOCATION = "textures/gui/"; + public static final String EFFECTS_LOCATION = "textures/effects/"; // Item/Block sprite sheets - public static final String VANILLA_ITEM_TEXTURE_SHEET = "/gui/items.png"; - public static final String VANILLA_BLOCK_TEXTURE_SHEET = "/terrain.png"; + public static final ResourceLocation VANILLA_BLOCK_TEXTURE_SHEET = TextureMap.field_110575_b; + public static final ResourceLocation VANILLA_ITEM_TEXTURE_SHEET = TextureMap.field_110576_c; // Armor sprite sheets // GUI textures - public static final String GUI_CALCINATOR = GUI_SHEET_LOCATION + "calcinator.png"; - public static final String GUI_ALUDEL = GUI_SHEET_LOCATION + "aludel.png"; - public static final String GUI_ALCHEMICAL_STORAGE = GUI_SHEET_LOCATION + "alchemicalStorage.png"; - public static final String GUI_SHARED_ALCHEMICAL_STORAGE = GUI_SHEET_LOCATION + "sharedAlchemicalStorage.png"; - public static final String GUI_PORTABLE_CRAFTING = "/gui/crafting.png"; - public static final String GUI_PORTABLE_TRANSMUTATION = GUI_SHEET_LOCATION + "portableTransmutation.png"; - public static final String GUI_GLASS_BELL = GUI_SHEET_LOCATION + "glassBell.png"; + public static final ResourceLocation GUI_CALCINATOR = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "calcinator.png"); + public static final ResourceLocation GUI_ALUDEL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "aludel.png"); + public static final ResourceLocation GUI_ALCHEMICAL_STORAGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage.png"); + public static final ResourceLocation GUI_SHARED_ALCHEMICAL_STORAGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "sharedAlchemicalStorage.png"); + public static final ResourceLocation GUI_PORTABLE_CRAFTING = ResourceLocationHelper.getResourceLocation("/gui/crafting.png"); + public static final ResourceLocation GUI_PORTABLE_TRANSMUTATION = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "portableTransmutation.png"); + public static final ResourceLocation GUI_GLASS_BELL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "glassBell.png"); // Model textures - public static final String MODEL_CALCINATOR = MODEL_SHEET_LOCATION + "calcinator.png"; - public static final String MODEL_ALUDEL = MODEL_SHEET_LOCATION + "aludel.png"; - public static final String MODEL_ALCHEMICAL_CHEST = MODEL_SHEET_LOCATION + "alchemicalChest.png"; - public static final String MODEL_GLASS_BELL = MODEL_SHEET_LOCATION + "aludel.png"; + public static final ResourceLocation MODEL_CALCINATOR = ResourceLocationHelper.getResourceLocation(MODEL_SHEET_LOCATION + "calcinator.png"); + public static final ResourceLocation MODEL_ALUDEL = ResourceLocationHelper.getResourceLocation(MODEL_SHEET_LOCATION + "aludel.png"); + public static final ResourceLocation MODEL_ALCHEMICAL_CHEST = ResourceLocationHelper.getResourceLocation(MODEL_SHEET_LOCATION + "alchemicalChest.png"); + public static final ResourceLocation MODEL_GLASS_BELL = ResourceLocationHelper.getResourceLocation(MODEL_SHEET_LOCATION + "aludel.png"); // Effect textures - public static final String EFFECT_WORLD_TRANSMUTATION = EFFECTS_LOCATION + "noise.png"; + public static final ResourceLocation EFFECT_WORLD_TRANSMUTATION = ResourceLocationHelper.getResourceLocation(EFFECTS_LOCATION + "noise.png"); } diff --git a/ee3_common/com/pahimar/ee3/nbt/NBTHelper.java b/ee3_common/com/pahimar/ee3/nbt/NBTHelper.java new file mode 100644 index 00000000..06e87be5 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/nbt/NBTHelper.java @@ -0,0 +1,508 @@ +package com.pahimar.ee3.nbt; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagByteArray; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagEnd; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagLong; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.nbt.NBTTagString; + +import com.pahimar.ee3.core.util.EnergyStack; +import com.pahimar.ee3.core.util.OreStack; +import com.pahimar.ee3.item.CustomWrappedStack; +import com.pahimar.ee3.lib.Strings; + +/** + * Equivalent-Exchange-3 + * + * NBTHelper + * + * @author pahimar + * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) + * + */ +public class NBTHelper { + + /** + * Encodes the given NBT object as a String + * @param nbtBase + * @return String encoding of the given NBT object + */ + public static String encodeNBTAsString(NBTBase nbtBase) { + + StringBuilder stringBuilder = new StringBuilder(); + + if (nbtBase != null) { + // Encode the name of the tag, and the type of the tag + stringBuilder.append(String.format("'%s':%s:", nbtBase.getName(), NBTBase.getTagName(nbtBase.getId()))); + + // Encode the value of the tag, depending on the type of the tag + switch (nbtBase.getId()) + { + case 0: { + stringBuilder.append(((NBTTagEnd) nbtBase).toString()); + break; + } + case 1: { + stringBuilder.append(String.format("%s", ((NBTTagByte) nbtBase).data)); + break; + } + case 2: { + stringBuilder.append(String.format("%s", ((NBTTagShort) nbtBase).data)); + break; + } + case 3: { + stringBuilder.append(String.format("%s", ((NBTTagInt) nbtBase).data)); + break; + } + case 4: { + stringBuilder.append(String.format("%s", ((NBTTagLong) nbtBase).data)); + break; + } + case 5: { + stringBuilder.append(String.format("%s", ((NBTTagFloat) nbtBase).data)); + break; + } + case 6: { + stringBuilder.append(String.format("%s", ((NBTTagDouble) nbtBase).data)); + break; + } + case 7: { + NBTTagByteArray byteArray = (NBTTagByteArray) nbtBase; + + stringBuilder.append("["); + + for (int i = 0; i < byteArray.byteArray.length; i++) { + stringBuilder.append(byteArray.byteArray[i]); + + if (i < byteArray.byteArray.length - 1) { + stringBuilder.append("|"); + } + } + + stringBuilder.append("]"); + + break; + } + case 8: { + stringBuilder.append(String.format("%s", ((NBTTagString) nbtBase).data)); + break; + } + case 9: { + NBTTagList tagList = (NBTTagList) nbtBase; + + stringBuilder.append("["); + + for (int i = 0; i < tagList.tagCount(); i++) { + Object tagObject = tagList.tagAt(i); + + if (tagObject instanceof NBTBase) { + stringBuilder.append(encodeNBTAsString((NBTBase) tagObject)); + } + + if (i < tagList.tagCount() - 1) { + stringBuilder.append("|"); + } + } + + stringBuilder.append("]"); + + break; + } + case 10: { + NBTTagCompound tagCompound = (NBTTagCompound) nbtBase; + + stringBuilder.append("["); + + Iterator tagIterator = tagCompound.getTags().iterator(); + + while (tagIterator.hasNext()) { + Object tagObject = tagIterator.next(); + + if (tagObject instanceof NBTBase) { + stringBuilder.append(encodeNBTAsString((NBTBase) tagObject)); + } + + if (tagIterator.hasNext()) { + stringBuilder.append("|"); + } + } + + stringBuilder.append("]"); + + break; + } + case 11: { + NBTTagIntArray intArray = (NBTTagIntArray) nbtBase; + + stringBuilder.append("["); + + for (int i = 0; i < intArray.intArray.length; i++) { + stringBuilder.append(intArray.intArray[i]); + + if (i < intArray.intArray.length - 1) { + stringBuilder.append("|"); + } + } + + stringBuilder.append("]"); + + break; + } + default: { + stringBuilder.append("UNKNOWN"); + break; + } + } + } + + return stringBuilder.toString(); + } + + // TODO Link this method to some API stuffs + public static NBTTagCompound encodeStackAsNBT(Object stackObject) { + + return encodeStackAsNBT("", stackObject); + } + + public static NBTTagCompound encodeStackAsNBT(String name, Object object) { + + NBTTagCompound encodedStack = new NBTTagCompound(name); + + if (CustomWrappedStack.canBeWrapped(object)) { + + CustomWrappedStack wrappedStack = new CustomWrappedStack(object); + + if (wrappedStack.getWrappedStack() instanceof ItemStack) { + + ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack(); + encodedStack.setString(Strings.NBT_ENCODED_ATTR_TYPE, Strings.NBT_ENCODED_ATTR_TYPE_ITEM); + itemStack.writeToNBT(encodedStack); + } + else if (wrappedStack.getWrappedStack() instanceof OreStack) { + OreStack oreStack = (OreStack) wrappedStack.getWrappedStack(); + + encodedStack.setString(Strings.NBT_ENCODED_ATTR_TYPE, Strings.NBT_ENCODED_ATTR_TYPE_ORE); + encodedStack.setString(Strings.NBT_ENCODED_ATTR_ORE_NAME, oreStack.oreName); + encodedStack.setShort(Strings.NBT_ENCODED_ATTR_SIZE, (short) wrappedStack.getStackSize()); + } + else if (wrappedStack.getWrappedStack() instanceof EnergyStack) { + EnergyStack energyStack = (EnergyStack) wrappedStack.getWrappedStack(); + + encodedStack.setString(Strings.NBT_ENCODED_ATTR_TYPE, Strings.NBT_ENCODED_ATTR_TYPE_ENERGY); + encodedStack.setString(Strings.NBT_ENCODED_ATTR_ENERGY_NAME, energyStack.energyName); + encodedStack.setShort(Strings.NBT_ENCODED_ATTR_SIZE, (short) wrappedStack.getStackSize()); + } + } + + return encodedStack; + } + + public static NBTTagCompound encodeRecipeAsNBT(Object recipeOutput, List recipeInputs) { + + NBTTagCompound encodedRecipe = new NBTTagCompound(); + + NBTTagCompound recipeOutputNBTCompound = encodeStackAsNBT(Strings.NBT_ENCODED_RECIPE_OUTPUT, recipeOutput); + NBTTagList recipeInputsNBTList = new NBTTagList(Strings.NBT_ENCODED_RECIPE_INPUTS); + + for (int i = 0; i < recipeInputs.size(); i++) { + recipeInputsNBTList.appendTag(encodeStackAsNBT(Strings.NBT_ENCODED_RECIPE_INPUT_PREFIX.concat(Integer.toString(i)), recipeInputs.get(i))); + } + + encodedRecipe.setCompoundTag(Strings.NBT_ENCODED_RECIPE_OUTPUT, recipeOutputNBTCompound); + encodedRecipe.setTag(Strings.NBT_ENCODED_RECIPE_INPUTS, recipeInputsNBTList); + + return encodedRecipe; + } + + /** + * + * @param encodedStack + * A NBTTagCompound containing the encoded information of either + * a ItemStack, OreStack, or EnergyStack + * @return A CustomWrappedStack containing the encoded stack provided in the + * NBTTagCompound (could be ItemStack, OreStack, or EnergyStack). + * Returns null in the event that no valid stack was able to be + * parsed from the encoded NBTTagCompound. + */ + public static CustomWrappedStack decodeStackFromNBT(NBTTagCompound encodedStack) { + + CustomWrappedStack decodedStack = null; + + // If the encoded tag compound is of type ItemStack, parse out the ItemStack info + if (encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_TYPE)) { + if (encodedStack.getString(Strings.NBT_ENCODED_ATTR_TYPE).equalsIgnoreCase(Strings.NBT_ENCODED_ATTR_TYPE_ITEM)) { + + ItemStack itemStack = new ItemStack(0, 0, 0); + itemStack.readFromNBT(encodedStack); + decodedStack = new CustomWrappedStack(itemStack); + } + // Else if the encoded tag compound is of type OreStack, parse out the OreStack info + else if (encodedStack.getString(Strings.NBT_ENCODED_ATTR_TYPE).equalsIgnoreCase(Strings.NBT_ENCODED_ATTR_TYPE_ORE)) { + + if (encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_ORE_NAME) && encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_SIZE)) { + if ((encodedStack.getString(Strings.NBT_ENCODED_ATTR_ORE_NAME).length() > 0) && (encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE) >= 0)) { + decodedStack = new CustomWrappedStack(new OreStack(encodedStack.getString(Strings.NBT_ENCODED_ATTR_ORE_NAME), encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE))); + } + } + } + // Else if the encoded tag compound is of type EnergyStack, parse out the EnergyStack info + else if (encodedStack.getString(Strings.NBT_ENCODED_ATTR_TYPE).equalsIgnoreCase(Strings.NBT_ENCODED_ATTR_TYPE_ENERGY)) { + + if (encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_ENERGY_NAME) && encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_SIZE)) { + if ((encodedStack.getString(Strings.NBT_ENCODED_ATTR_ENERGY_NAME).length() > 0) && (encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE) >= 0)) { + decodedStack = new CustomWrappedStack(new EnergyStack(encodedStack.getString(Strings.NBT_ENCODED_ATTR_ENERGY_NAME), encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE))); + } + } + } + } + + /* + * This will only return non-null in the event that a proper + * ItemStack|OreStack|EnergyStack was decoded from the encoded + * NBTTagCompound + */ + return decodedStack; + } + + public static Map> decodeRecipeFromNBT(NBTTagCompound encodedRecipe) { + + HashMap> decodedRecipe = new HashMap>(); + + CustomWrappedStack recipeOutput = null; + ArrayList recipeInputs = new ArrayList(); + + CustomWrappedStack decodedStack = null; + NBTTagCompound encodedStack = null; + + // Decode the recipe output + if (encodedRecipe.hasKey(Strings.NBT_ENCODED_RECIPE_OUTPUT)) { + + decodedStack = decodeStackFromNBT(encodedRecipe.getCompoundTag(Strings.NBT_ENCODED_RECIPE_OUTPUT)); + + if (decodedStack != null) { + recipeOutput = decodedStack; + } + } + + // Decode the recipe inputs + if (encodedRecipe.hasKey("recipeInputs")) { + NBTTagList recipeInputsTagList = encodedRecipe.getTagList(Strings.NBT_ENCODED_RECIPE_INPUTS); + + for (int i = 0; i < recipeInputsTagList.tagCount(); i++) { + if (recipeInputsTagList.tagAt(i) instanceof NBTTagCompound) { + + encodedStack = (NBTTagCompound) recipeInputsTagList.tagAt(i); + decodedStack = decodeStackFromNBT(encodedStack); + + if (decodedStack != null) { + recipeInputs.add(decodedStack); + } + } + } + } + + // If we decoded both a recipe output and some inputs for it, add it to the map + if (recipeOutput != null && recipeInputs.size() > 0) { + decodedRecipe.put(recipeOutput, recipeInputs); + } + + return decodedRecipe; + } + + /** + * Initializes the NBT Tag Compound for the given ItemStack if it is null + * + * @param itemStack + * The ItemStack for which its NBT Tag Compound is being checked + * for initialization + */ + private static void initNBTTagCompound(ItemStack itemStack) { + + if (itemStack.stackTagCompound == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + } + + public static boolean hasTag(ItemStack itemStack, String keyName) { + + if (itemStack.stackTagCompound != null) + return itemStack.stackTagCompound.hasKey(keyName); + + return false; + } + + public static void removeTag(ItemStack itemStack, String keyName) { + + if (itemStack.stackTagCompound != null) { + itemStack.stackTagCompound.removeTag(keyName); + } + } + + // String + public static String getString(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setString(itemStack, keyName, ""); + } + + return itemStack.stackTagCompound.getString(keyName); + } + + public static void setString(ItemStack itemStack, String keyName, String keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setString(keyName, keyValue); + } + + // boolean + public static boolean getBoolean(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setBoolean(itemStack, keyName, false); + } + + return itemStack.stackTagCompound.getBoolean(keyName); + } + + public static void setBoolean(ItemStack itemStack, String keyName, boolean keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setBoolean(keyName, keyValue); + } + + // byte + public static byte getByte(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setByte(itemStack, keyName, (byte) 0); + } + + return itemStack.stackTagCompound.getByte(keyName); + } + + public static void setByte(ItemStack itemStack, String keyName, byte keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setByte(keyName, keyValue); + } + + // short + public static short getShort(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setShort(itemStack, keyName, (short) 0); + } + + return itemStack.stackTagCompound.getShort(keyName); + } + + public static void setShort(ItemStack itemStack, String keyName, short keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setShort(keyName, keyValue); + } + + // int + public static int getInt(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setInteger(itemStack, keyName, 0); + } + + return itemStack.stackTagCompound.getInteger(keyName); + } + + public static void setInteger(ItemStack itemStack, String keyName, int keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setInteger(keyName, keyValue); + } + + // long + public static long getLong(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setLong(itemStack, keyName, 0); + } + + return itemStack.stackTagCompound.getLong(keyName); + } + + public static void setLong(ItemStack itemStack, String keyName, long keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setLong(keyName, keyValue); + } + + // float + public static float getFloat(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setFloat(itemStack, keyName, 0); + } + + return itemStack.stackTagCompound.getFloat(keyName); + } + + public static void setFloat(ItemStack itemStack, String keyName, float keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setFloat(keyName, keyValue); + } + + // double + public static double getDouble(ItemStack itemStack, String keyName) { + + initNBTTagCompound(itemStack); + + if (!itemStack.stackTagCompound.hasKey(keyName)) { + setDouble(itemStack, keyName, 0); + } + + return itemStack.stackTagCompound.getDouble(keyName); + } + + public static void setDouble(ItemStack itemStack, String keyName, double keyValue) { + + initNBTTagCompound(itemStack); + + itemStack.stackTagCompound.setDouble(keyName, keyValue); + } + +} diff --git a/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java b/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java index f4bc215a..c0e736d2 100644 --- a/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java +++ b/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java @@ -14,6 +14,7 @@ import com.pahimar.ee3.network.packet.PacketRequestEvent; import com.pahimar.ee3.network.packet.PacketSoundEvent; import com.pahimar.ee3.network.packet.PacketSpawnParticle; import com.pahimar.ee3.network.packet.PacketTileUpdate; +import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; /** * Equivalent-Exchange-3 @@ -25,9 +26,13 @@ import com.pahimar.ee3.network.packet.PacketTileUpdate; * */ public enum PacketTypeHandler { - KEY(PacketKeyPressed.class), TILE(PacketTileUpdate.class), REQUEST_EVENT( - PacketRequestEvent.class), SPAWN_PARTICLE(PacketSpawnParticle.class), SOUND_EVENT( - PacketSoundEvent.class), ITEM_UPDATE(PacketItemUpdate.class); + KEY(PacketKeyPressed.class), + TILE(PacketTileUpdate.class), + REQUEST_EVENT(PacketRequestEvent.class), + SPAWN_PARTICLE(PacketSpawnParticle.class), + SOUND_EVENT(PacketSoundEvent.class), + ITEM_UPDATE(PacketItemUpdate.class), + TILE_WITH_ITEM(PacketTileWithItemUpdate.class); private Class clazz; diff --git a/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java b/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java new file mode 100644 index 00000000..0fc0193b --- /dev/null +++ b/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java @@ -0,0 +1,78 @@ +package com.pahimar.ee3.network.packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import net.minecraft.network.INetworkManager; +import net.minecraftforge.common.ForgeDirection; + +import com.pahimar.ee3.EquivalentExchange3; +import com.pahimar.ee3.network.PacketTypeHandler; + +import cpw.mods.fml.common.network.Player; + +public class PacketTileWithItemUpdate extends PacketEE { + + public int x, y, z; + public byte orientation; + public byte state; + public String customName; + public int itemID, metaData, stackSize, color; + + public PacketTileWithItemUpdate() { + + super(PacketTypeHandler.TILE_WITH_ITEM, true); + } + + public PacketTileWithItemUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { + + super(PacketTypeHandler.TILE_WITH_ITEM, true); + this.x = x; + this.y = y; + this.z = z; + this.orientation = (byte) orientation.ordinal(); + this.state = state; + this.customName = customName; + this.itemID = itemID; + this.metaData = metaData; + this.stackSize = stackSize; + this.color = color; + } + + @Override + public void writeData(DataOutputStream data) throws IOException { + + data.writeInt(x); + data.writeInt(y); + data.writeInt(z); + data.writeByte(orientation); + data.writeByte(state); + data.writeUTF(customName); + data.writeInt(itemID); + data.writeInt(metaData); + data.writeInt(stackSize); + data.writeInt(color); + } + + @Override + public void readData(DataInputStream data) throws IOException { + + x = data.readInt(); + y = data.readInt(); + z = data.readInt(); + orientation = data.readByte(); + state = data.readByte(); + customName = data.readUTF(); + itemID = data.readInt(); + metaData = data.readInt(); + stackSize = data.readInt(); + color = data.readInt(); + } + + @Override + public void execute(INetworkManager manager, Player player) { + + EquivalentExchange3.proxy.handleTileWithItemPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, itemID, metaData, stackSize, color); + } +} diff --git a/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java b/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java deleted file mode 100644 index ece9ef2f..00000000 --- a/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.pahimar.ee3.recipe; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraftforge.oredict.OreDictionary; - -import com.pahimar.ee3.core.handlers.EquivalencyHandler; -import com.pahimar.ee3.core.helper.GeneralHelper; -import com.pahimar.ee3.core.helper.RecipeHelper; -import com.pahimar.ee3.item.ModItems; -import com.pahimar.ee3.lib.Reference; - -import cpw.mods.fml.common.ObfuscationReflectionHelper; - -/** - * Equivalent-Exchange-3 - * - * RecipesTransmutationStone - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class RecipesTransmutationStone { - - private static ItemStack philStone = new ItemStack(ModItems.philStone, 1, OreDictionary.WILDCARD_VALUE); - private static ItemStack miniumStone = new ItemStack(ModItems.miniumStone, 1, OreDictionary.WILDCARD_VALUE); - - public static List transmutationStones = Arrays.asList(miniumStone, philStone); - - private static ItemStack anyCoal = new ItemStack(Item.coal, 1, OreDictionary.WILDCARD_VALUE); - private static ItemStack anyWood = new ItemStack(Block.wood, 1, OreDictionary.WILDCARD_VALUE); - private static ItemStack anyPlank = new ItemStack(Block.planks, 1, OreDictionary.WILDCARD_VALUE); - private static ItemStack anySandStone = new ItemStack(Block.sandStone, 1, OreDictionary.WILDCARD_VALUE); - private static ItemStack dyeBoneMeal = new ItemStack(Item.dyePowder, 1, 15); - - public static void init() { - - initEquivalencyList(); - - for (ItemStack stone : transmutationStones) { - initTransmutationRecipes(stone); - initEquivalenceRecipes(stone); - initReconstructiveRecipes(stone); - initDestructorRecipes(stone); - initPortableSmeltingRecipes(stone); - } - - if (Reference.DEBUG_MODE) { - EquivalencyHandler.instance().debug(); - } - } - - public static void initTransmutationRecipes(ItemStack transmutationStone) { - - /* 4 Cobble <-> 1 Flint */ - RecipeHelper.addRecipe(Item.flint, transmutationStone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone); - RecipeHelper.addRecipe(new ItemStack(Block.cobblestone, 4), transmutationStone, Item.flint); - - /* 4 Dirt <-> 1 Gravel */ - RecipeHelper.addRecipe(Block.gravel, transmutationStone, Block.dirt, Block.dirt, Block.dirt, Block.dirt); - RecipeHelper.addRecipe(new ItemStack(Block.dirt, 4), transmutationStone, Block.gravel); - - /* 4 Sand <-> 1 Sandstone */ - // Vanilla Recipes exist to make SandStone from 4 Sand - RecipeHelper.addRecipe(new ItemStack(Block.sand, 4), transmutationStone, anySandStone); - - /* 2 Sticks -> Wood Plank */ - RecipeHelper.addRecipe(Block.planks, transmutationStone, Item.stick, Item.stick); - // Vanilla recipe exists to make sticks from planks - - /* 4 Wood Planks -> Wood Block */ - RecipeHelper.addRecipe(Block.wood, transmutationStone, anyPlank, anyPlank, anyPlank, anyPlank); - // Vanilla recipes exist to make planks from any wood log - - /* 4 Gravel/Sandstone/Flint -> 1 Clay Ball, 1 Clay Ball -> 4 Gravel */ - RecipeHelper.addRecipe(Item.clay, transmutationStone, Block.gravel, Block.gravel, Block.gravel, Block.gravel); - RecipeHelper.addRecipe(Item.clay, transmutationStone, anySandStone, anySandStone, anySandStone, anySandStone); - RecipeHelper.addRecipe(Item.clay, transmutationStone, Item.flint, Item.flint, Item.flint, Item.flint); - RecipeHelper.addRecipe(new ItemStack(Block.gravel, 4), transmutationStone, Item.clay); - - /* 2 Wood Log <-> 1 Obsidian */ - RecipeHelper.addRecipe(Block.obsidian, transmutationStone, anyWood, anyWood); - RecipeHelper.addRecipe(new ItemStack(Block.wood, 2), transmutationStone, Block.obsidian); - - /* 4 Clay Ball <-> 1 Clay Block */ - // Vanilla recipe exists to make clay blocks from clay balls - RecipeHelper.addRecipe(new ItemStack(Item.clay, 4), transmutationStone, Block.blockClay); - - /* 4 Obsidian/Clay Block -> 1 Iron Ingot, Iron Ingot -> Clay Block */ - RecipeHelper.addRecipe(Item.ingotIron, transmutationStone, Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian); - RecipeHelper.addRecipe(Item.ingotIron, transmutationStone, Block.blockClay, Block.blockClay, Block.blockClay, Block.blockClay); - RecipeHelper.addRecipe(new ItemStack(Block.blockClay, 4), transmutationStone, Item.ingotIron); - - /* 8 Iron Ingot <-> 1 Gold Ingot */ - RecipeHelper.addRecipe(Item.ingotGold, transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); - RecipeHelper.addRecipe(new ItemStack(Item.ingotIron, 8), transmutationStone, Item.ingotGold); - - /* 4 Gold Ingot <-> 1 Diamond */ - RecipeHelper.addRecipe(Item.diamond, transmutationStone, Item.ingotGold, Item.ingotGold, Item.ingotGold, Item.ingotGold); - RecipeHelper.addRecipe(new ItemStack(Item.ingotGold, 4), transmutationStone, Item.diamond); - - /* 8 Iron Block <-> 1 Gold Block */ - RecipeHelper.addRecipe(Block.blockGold, transmutationStone, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron); - RecipeHelper.addRecipe(new ItemStack(Block.blockIron, 8), transmutationStone, Block.blockGold); - - /* 4 Gold Block <-> 1 Diamond Block */ - RecipeHelper.addRecipe(Block.blockDiamond, transmutationStone, Block.blockGold, Block.blockGold, Block.blockGold, Block.blockGold); - RecipeHelper.addRecipe(new ItemStack(Block.blockGold, 4), transmutationStone, Block.blockDiamond); - - /* 1 Ender Pearl <-> 4 Iron Ingot */ - RecipeHelper.addRecipe(Item.enderPearl, transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); - RecipeHelper.addRecipe(new ItemStack(Item.ingotIron, 4), transmutationStone, Item.enderPearl); - } - - public static void initEquivalenceRecipes(ItemStack stone) { - - int outputI; - - for (ArrayList itemStackList : EquivalencyHandler.instance().getAllLists()) { - ItemStack[] currentList = new ItemStack[itemStackList.size()]; - currentList = itemStackList.toArray(currentList); - - for (int i = 0; i < currentList.length; i++) { - outputI = i == currentList.length - 1 ? 0 : i + 1; - - RecipeHelper.addRecipe(currentList[outputI], stone, GeneralHelper.convertSingleStackToPluralStacks(currentList[i])); - } - } - } - - public static void initReconstructiveRecipes(ItemStack stone) { - - /* 3 Bone Meal --> 1 Bone */ - RecipeHelper.addRecipe(Item.bone, stone, dyeBoneMeal, dyeBoneMeal, dyeBoneMeal); - - /* 2 Blaze Powder --> 1 Blaze Rod */ - RecipeHelper.addRecipe(Item.blazeRod, stone, Item.blazePowder, Item.blazePowder); - } - - public static void initDestructorRecipes(ItemStack stone) { - - /* Smooth Stone -> Cobble Stone */ - RecipeHelper.addRecipe(Block.cobblestone, stone, Block.stone); - - /* Glass -> Sand */ - RecipeHelper.addRecipe(Block.sand, stone, Block.glass); - - /* Glowstone Block -> 4 Glowstone Dust */ - RecipeHelper.addRecipe(new ItemStack(Item.lightStoneDust, 4), stone, Block.glowStone); - - /* Brick Block -> 4 Bricks */ - RecipeHelper.addRecipe(new ItemStack(Item.brick, 4), stone, Block.brick); - } - - public static void initPortableSmeltingRecipes(ItemStack stone) { - - Map furnaceMap = FurnaceRecipes.smelting().getSmeltingList(); - Map furnaceMetaMap = ObfuscationReflectionHelper.getPrivateValue(FurnaceRecipes.class, FurnaceRecipes.smelting(), "metaSmeltingList"); - - Iterator iterFurnaceKeyMap = furnaceMap.keySet().iterator(); - Iterator iterFurnaceMetaKeyMap = furnaceMetaMap.keySet().iterator(); - - Integer furnaceMapKey; - List furnaceMetaMapKey; - - ItemStack unSmeltedStack; - - while (iterFurnaceKeyMap.hasNext()) { - furnaceMapKey = (Integer) iterFurnaceKeyMap.next(); - unSmeltedStack = new ItemStack(furnaceMapKey, 1, 0); - - RecipeHelper.addSmeltingRecipe(unSmeltedStack, stone, anyCoal); - } - - while (iterFurnaceMetaKeyMap.hasNext()) { - furnaceMetaMapKey = (List) iterFurnaceMetaKeyMap.next(); - unSmeltedStack = new ItemStack((Integer) furnaceMetaMapKey.get(0), 1, (Integer) furnaceMetaMapKey.get(1)); - - RecipeHelper.addSmeltingRecipe(unSmeltedStack, stone, anyCoal); - } - } - - protected static void initEquivalencyList() { - - EquivalencyHandler.instance().addObjects(Block.sand, Block.dirt, Block.cobblestone, Block.grass); - EquivalencyHandler.instance().addObjects(Block.plantYellow, Block.plantRed); - EquivalencyHandler.instance().addObjects(Block.mushroomRed, Block.mushroomBrown); - EquivalencyHandler.instance().addObjects(Item.pumpkinSeeds, Item.melonSeeds); - EquivalencyHandler.instance().addObjects(Block.pumpkin, Block.melon); - EquivalencyHandler.instance().addObjects(Block.pumpkinStem, Block.melonStem); - EquivalencyHandler.instance().addObjects(Block.stairsWoodSpruce, Block.stairsWoodBirch, Block.stairsWoodJungle); - EquivalencyHandler.instance().addObjects(new ItemStack(Item.paper, 3), new ItemStack(Item.reed, 3)); - EquivalencyHandler.instance().addObjects(new ItemStack(Item.flint, 2), new ItemStack(Block.gravel, 2), new ItemStack(Block.sandStone, 2, 0), new ItemStack(Block.sandStone, 2, 1), new ItemStack(Block.sandStone, 2, 2)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.planks, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.wood, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.woodSingleSlab, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.woodDoubleSlab, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.sapling, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.leaves, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.tallGrass, 3)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.cloth, 16)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.stoneBrick, 4)); - EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Item.dyePowder, 16, 3, 4, 15)); - } - -} diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileAlchemicalChest.java b/ee3_common/com/pahimar/ee3/tileentity/TileAlchemicalChest.java index d4b6f52a..994410fa 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileAlchemicalChest.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileAlchemicalChest.java @@ -33,7 +33,7 @@ public class TileAlchemicalChest extends TileEE implements IInventory { /** Server sync counter (once per 20 ticks) */ private int ticksSinceSync; - private final int INVENTORY_SIZE = 13 * 4; + public static final int INVENTORY_SIZE = 13 * 4; /** * The ItemStacks that hold the items currently being used in the Alchemical @@ -236,8 +236,33 @@ public class TileAlchemicalChest extends TileEE implements IInventory { } @Override - public boolean isStackValidForSlot(int side, ItemStack itemStack) { + public boolean isItemValidForSlot(int side, ItemStack itemStack) { return true; } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(super.toString()); + + stringBuilder.append("TileAlchemicalChest Data - "); + for (int i = 0; i < inventory.length; i++) { + if (i != 0) { + stringBuilder.append(", "); + } + + if (inventory[i] != null) { + stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); + } + else { + stringBuilder.append(String.format("inventory[%d]: empty", i)); + } + } + stringBuilder.append("\n"); + + return stringBuilder.toString(); + } } diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java b/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java index b6d7a405..f54409cf 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java @@ -4,8 +4,12 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.packet.Packet; +import com.pahimar.ee3.core.util.ItemUtil; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.network.PacketTypeHandler; +import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; /** * Equivalent-Exchange-3 @@ -23,11 +27,11 @@ public class TileAludel extends TileEE implements IInventory { */ private ItemStack[] inventory; - private final int INVENTORY_SIZE = 4; + public static final int INVENTORY_SIZE = 4; - public static final int INPUT_INVENTORY_INDEX = 0; - public static final int DUST_INVENTORY_INDEX = 1; - public static final int FUEL_INVENTORY_INDEX = 2; + public static final int FUEL_INVENTORY_INDEX = 0; + public static final int INPUT_INVENTORY_INDEX = 1; + public static final int DUST_INVENTORY_INDEX = 2; public static final int OUTPUT_INVENTORY_INDEX = 3; public TileAludel() { @@ -149,8 +153,54 @@ public class TileAludel extends TileEE implements IInventory { } @Override - public boolean isStackValidForSlot(int i, ItemStack itemstack) { + public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } + + @Override + public Packet getDescriptionPacket() { + + ItemStack itemStack = getStackInSlot(INPUT_INVENTORY_INDEX); + + if (itemStack != null && itemStack.stackSize > 0) + return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, itemStack.itemID, itemStack.getItemDamage(), itemStack.stackSize, ItemUtil.getColor(itemStack))); + else + return super.getDescriptionPacket(); + } + + @Override + public void onInventoryChanged() { + + worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); + + if (worldObj.getBlockTileEntity(xCoord, yCoord + 1, zCoord) instanceof TileGlassBell) { + worldObj.updateAllLightTypes(xCoord, yCoord + 1, zCoord); + } + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(super.toString()); + + stringBuilder.append("TileAludel Data - "); + for (int i = 0; i < inventory.length; i++) { + if (i != 0) { + stringBuilder.append(", "); + } + + if (inventory[i] != null) { + stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); + } + else { + stringBuilder.append(String.format("inventory[%d]: empty", i)); + } + } + stringBuilder.append("\n"); + + return stringBuilder.toString(); + } } diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileCalcinator.java b/ee3_common/com/pahimar/ee3/tileentity/TileCalcinator.java index c0bd8266..e3090deb 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileCalcinator.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileCalcinator.java @@ -23,11 +23,11 @@ public class TileCalcinator extends TileEE implements IInventory { */ private ItemStack[] inventory; - private final int INVENTORY_SIZE = 3; + public static final int INVENTORY_SIZE = 3; public static final int FUEL_INVENTORY_INDEX = 0; public static final int INPUT_INVENTORY_INDEX = 1; - public static final int DUST_INVENTORY_INDEX = 2; + public static final int OUTPUT_INVENTORY_INDEX = 2; public TileCalcinator() { @@ -154,8 +154,33 @@ public class TileCalcinator extends TileEE implements IInventory { } @Override - public boolean isStackValidForSlot(int i, ItemStack itemstack) { + public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(super.toString()); + + stringBuilder.append("TileCalcinator Data - "); + for (int i = 0; i < inventory.length; i++) { + if (i != 0) { + stringBuilder.append(", "); + } + + if (inventory[i] != null) { + stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); + } + else { + stringBuilder.append(String.format("inventory[%d]: empty", i)); + } + } + stringBuilder.append("\n"); + + return stringBuilder.toString(); + } } diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileEE.java b/ee3_common/com/pahimar/ee3/tileentity/TileEE.java index cb684654..e1153baa 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileEE.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileEE.java @@ -21,9 +21,9 @@ import com.pahimar.ee3.network.packet.PacketTileUpdate; */ public class TileEE extends TileEntity { - private ForgeDirection orientation; - private byte state; - private String customName; + protected ForgeDirection orientation; + protected byte state; + protected String customName; public TileEE() { @@ -114,4 +114,14 @@ public class TileEE extends TileEntity { return PacketTypeHandler.populatePacket(new PacketTileUpdate(xCoord, yCoord, zCoord, orientation, state, customName)); } + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(String.format("TileEE Data - xCoord: %d, yCoord: %d, zCoord: %d, customName: '%s', orientation: %s, state: %d\n", xCoord, yCoord, zCoord, customName, orientation, state)); + + return stringBuilder.toString(); + } + } diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java b/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java index b1af9738..d89ccd0b 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java @@ -4,8 +4,12 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.packet.Packet; +import com.pahimar.ee3.core.util.ItemUtil; import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.network.PacketTypeHandler; +import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; public class TileGlassBell extends TileEE implements IInventory { @@ -14,7 +18,7 @@ public class TileGlassBell extends TileEE implements IInventory { */ private ItemStack[] inventory; - private final int INVENTORY_SIZE = 1; + public static final int INVENTORY_SIZE = 1; public static final int DISPLAY_SLOT_INVENTORY_INDEX = 0; @@ -137,8 +141,50 @@ public class TileGlassBell extends TileEE implements IInventory { } @Override - public boolean isStackValidForSlot(int i, ItemStack itemstack) { + public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } + + @Override + public Packet getDescriptionPacket() { + + ItemStack itemStack = getStackInSlot(DISPLAY_SLOT_INVENTORY_INDEX); + + if (itemStack != null && itemStack.stackSize > 0) + return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, itemStack.itemID, itemStack.getItemDamage(), itemStack.stackSize, ItemUtil.getColor(itemStack))); + else + return super.getDescriptionPacket(); + } + + @Override + public void onInventoryChanged() { + + worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); + } + + @Override + public String toString() { + + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.append(super.toString()); + + stringBuilder.append("TileGlassBell Data - "); + for (int i = 0; i < inventory.length; i++) { + if (i != 0) { + stringBuilder.append(", "); + } + + if (inventory[i] != null) { + stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); + } + else { + stringBuilder.append(String.format("inventory[%d]: empty", i)); + } + } + stringBuilder.append("\n"); + + return stringBuilder.toString(); + } } diff --git a/resources/mods/ee3/lang/cs_CZ.xml b/resources/assets/ee3/lang/cs_CZ.xml similarity index 98% rename from resources/mods/ee3/lang/cs_CZ.xml rename to resources/assets/ee3/lang/cs_CZ.xml index 0322aa2a..bf638e77 100644 --- a/resources/mods/ee3/lang/cs_CZ.xml +++ b/resources/assets/ee3/lang/cs_CZ.xml @@ -1,52 +1,52 @@ - - - - Czech (cs_CZ) Localization File - Extra - Vypustit - Přepnout - Nabít - Úlomek suříku - Inertní Kámen - Kámen suříku - Kámen mudrců - Popel - Suříkový Prášek - Nazelenalý Prášek - Azurový Prášek - Amarantový Prášek - Duhový Prášek - Alchymistický Pytlík - Rudá voda (v klidu) - Rudá voda (tekoucí) - Kalcinátor - Sublimační Nádoba - Alchymistická Truhla - Kalcinátor - Sublimační Nádoba - Alchymistická Truhla - Alchymistický Pytlík - Equivalent Exchange 3 - Provádím kontrolu verze, vzdálený soubor umístěn na - Kontrola verze neproběhla úspěšně (nezdařila se inicializace) - Používáte nejaktuálnější verzi (@REMOTE_MOD_VERSION@) modu Equivalent Exchange 3, která je pro vaši verzi Minecraftu (@MINECRAFT_VERSION@) k dispozici - Je k dispozici nová verze @MOD_NAME@ (@REMOTE_MOD_VERSION@) pro MC @MINECRAFT_VERSION@. Ke stažení zde: @MOD_UPDATE_LOCATION@ - Chyba při připojování k servru poskytujícímu informace o verzi, zkouším se znovu připojit - Kontrola verze deaktivována po třech neúspěšných pokusech, přeskakuji - Nepodařilo se nalézt verzi @MOD_NAME@ pro @MINECRAFT_VERSION@ - Zobrazení výsledku transmutace zapnuto - Zobrazení výsledku transmutace vypnuto - Pozice zobrazení výsledku transmutace nastavena na levý horní roh - Pozice zobrazení výsledku transmutace nastavena na pravý horní roh - Pozice zobrazení výsledku transmutace nastavena na levý dolní roh - Pozice zobrazení výsledku transmutace nastavena na pravý dolní roh - (kde ### je desetinná hodnota mezi 0,0 a 1,0) - Průhlednost výsledku transmutace úspěšně změněna - (kde ### je desetinná hodnota větší než 0,0) - Měřítko výsledku transmutace úspěšné změněno - Equivalent Exchange 3 částice zapnuty - Equivalent Exchange 3 částice vypnuty - Přehrávání zvuků z Equivalent Exchange 3 od všech hráčů - Přehrávání zvuků z Equivalent Exchange 3 pouze od aktuálního hráče - Přehrávání zvuků z Equivalent Exchange 3 vypnuto + + + + Czech (cs_CZ) Localization File + Extra + Vypustit + Přepnout + Nabít + Úlomek suříku + Inertní Kámen + Kámen suříku + Kámen mudrců + Popel + Suříkový Prášek + Nazelenalý Prášek + Azurový Prášek + Amarantový Prášek + Duhový Prášek + Alchymistický Pytlík + Rudá voda (v klidu) + Rudá voda (tekoucí) + Kalcinátor + Sublimační Nádoba + Alchymistická Truhla + Kalcinátor + Sublimační Nádoba + Alchymistická Truhla + Alchymistický Pytlík + Equivalent Exchange 3 + Provádím kontrolu verze, vzdálený soubor umístěn na + Kontrola verze neproběhla úspěšně (nezdařila se inicializace) + Používáte nejaktuálnější verzi (@REMOTE_MOD_VERSION@) modu Equivalent Exchange 3, která je pro vaši verzi Minecraftu (@MINECRAFT_VERSION@) k dispozici + Je k dispozici nová verze @MOD_NAME@ (@REMOTE_MOD_VERSION@) pro MC @MINECRAFT_VERSION@. Ke stažení zde: @MOD_UPDATE_LOCATION@ + Chyba při připojování k servru poskytujícímu informace o verzi, zkouším se znovu připojit + Kontrola verze deaktivována po třech neúspěšných pokusech, přeskakuji + Nepodařilo se nalézt verzi @MOD_NAME@ pro @MINECRAFT_VERSION@ + Zobrazení výsledku transmutace zapnuto + Zobrazení výsledku transmutace vypnuto + Pozice zobrazení výsledku transmutace nastavena na levý horní roh + Pozice zobrazení výsledku transmutace nastavena na pravý horní roh + Pozice zobrazení výsledku transmutace nastavena na levý dolní roh + Pozice zobrazení výsledku transmutace nastavena na pravý dolní roh + (kde ### je desetinná hodnota mezi 0,0 a 1,0) + Průhlednost výsledku transmutace úspěšně změněna + (kde ### je desetinná hodnota větší než 0,0) + Měřítko výsledku transmutace úspěšné změněno + Equivalent Exchange 3 částice zapnuty + Equivalent Exchange 3 částice vypnuty + Přehrávání zvuků z Equivalent Exchange 3 od všech hráčů + Přehrávání zvuků z Equivalent Exchange 3 pouze od aktuálního hráče + Přehrávání zvuků z Equivalent Exchange 3 vypnuto \ No newline at end of file diff --git a/resources/mods/ee3/lang/cy_GB.xml b/resources/assets/ee3/lang/cy_GB.xml similarity index 100% rename from resources/mods/ee3/lang/cy_GB.xml rename to resources/assets/ee3/lang/cy_GB.xml diff --git a/resources/mods/ee3/lang/da_DK.xml b/resources/assets/ee3/lang/da_DK.xml similarity index 100% rename from resources/mods/ee3/lang/da_DK.xml rename to resources/assets/ee3/lang/da_DK.xml diff --git a/resources/mods/ee3/lang/de_DE.xml b/resources/assets/ee3/lang/de_DE.xml similarity index 86% rename from resources/mods/ee3/lang/de_DE.xml rename to resources/assets/ee3/lang/de_DE.xml index 96553366..3639c6df 100644 --- a/resources/mods/ee3/lang/de_DE.xml +++ b/resources/assets/ee3/lang/de_DE.xml @@ -1,4 +1,4 @@ - + German (de_DE) Localization File @@ -11,19 +11,19 @@ Miniumstein Stein der Weisen Asche - Miniumstaub + Minium Staub Grüner Staub - Azurstaub - Amaranthstaub + Azurer Staub + Amaranthiner Staub Irisierender Staub Alchemiebeutel Rotes Wasser (Still) - Rotes Wasser (Fließend) + Rotes Wasser (Fliessend) Kalzinierer Aludel Alchemietruhe Glasglocke - Kalzinierung + Kalzinierer Aludel Alchemietruhe Alchemiebeutel @@ -38,10 +38,10 @@ Keine Version von @MOD_NAME@ für @MINECRAFT_VERSION@ in der Remotedatei gefunden Transmutationsanzeige an Transmutationsanzeige aus - Transmutationsanzeige wurde links oben positioniert - Transmutationsanzeige wurde rechts oben positioniert - Transmutationsanzeige wurde links unten positioniert - Transmutationsanzeige wurde rechts unten positioniert + Transmutationsanzeige wurde eingestellt nach links oben + Transmutationsanzeige wurde eingestellt nach rechts oben + Transmutationsanzeige wurde eingestellt nach links unten + Transmutationsanzeige wurde eingestellt nach rechts unten (### ist ein Dezimalwert zwischen 0.0 und 1.0) Transparenz der Transmutationsanzeige wurde erfolgreich geändert (### ist ein Dezimalwert über 0.0) diff --git a/resources/assets/ee3/lang/el_GR.xml b/resources/assets/ee3/lang/el_GR.xml new file mode 100644 index 00000000..e3446c0f --- /dev/null +++ b/resources/assets/ee3/lang/el_GR.xml @@ -0,0 +1,54 @@ + + + + English (en_US) Localization File + Επιπλέον + Άφισε + εναλλαγή + Φόρτιση + Θραύσμα μινίου + Aδρανής πέτρα + Πέτρα μινίου + Φυλοσοφική λίθος + Στάχτη + Σκόνη μινίου + Χλοερή σκόνη + Γαλανή σκόνη + Σκόνη αμάραντου + Σκόνη ιριδύου + Τσάντα αλχημιστή + Κόκκινο νερό + Κόκκινο νερό + Καζάνι + Βάζο αλχημιστή + Κασέλα αλχιμιστή + Γυαλινη καμπάνα + Καζάνι + Βάζο αλχημιστή + Κασέλα αλχιμιστή + Τσάντα αλχημιστή + Γυαλινη καμπάνα + Equivalent Exchange 3 + Έλενχος εκδοσης + Έλενχος έκδοσης απέτηχε + Χρυσιμοποιήται την πιο εγκυρη έκδοση (@REMOTE_MOD_VERSION@) του Equivalent Exchange 3 για @MINECRAFT_VERSION@ + Μια νεα έκδοση @MOD_NAME@ υπάρχει (@REMOTE_MOD_VERSION@) για το @MINECRAFT_VERSION@. Πάρτην εδώ: @MOD_UPDATE_LOCATION@ + Σφάλμα στην σύνδεση ελένχου έκδοσης + Ο έλενχος εκδοσης σταματησε στις τρεις αποτυχιμενες προσπάθειες + Δεν μπορούσε να βρεθεί η έκδοση @MOD_NAME@ για @MINECRAFT_VERSION@ στο δύκτιο + Η ένδειξη μεταλαγής άνηξε + Η ένδειξη μεταλαγής έκλεισε + Target transmutation overlay position set to top left + Target transmutation overlay position set to top right + Target transmutation overlay position set to bottom left + Target transmutation overlay position set to bottom right + (where ### is a decimal value between 0.0 and 1.0) + Η αδιαφάνεια μεταλαγής άλαξε + (where ### is a decimal value greater than 0.0) + Η κλίμακα αδιαφάνεια μεταλαγής άλαξε + Τα σωματίδια του Equivalent Exchange 3 άνειξαν + Τα σωματίδια του Equivalent Exchange 3 έκλεισαν + Παίζουν ήχους απο όλους τους παιχτες + Παίζουν ήχους απο μονο εσάς + Οι ήχοι του Equivalent Exchange 3 απενεργοποίηθικαν + \ No newline at end of file diff --git a/resources/mods/ee3/lang/en_US.xml b/resources/assets/ee3/lang/en_US.xml similarity index 100% rename from resources/mods/ee3/lang/en_US.xml rename to resources/assets/ee3/lang/en_US.xml diff --git a/resources/mods/ee3/lang/es_ES.xml b/resources/assets/ee3/lang/es_ES.xml similarity index 87% rename from resources/mods/ee3/lang/es_ES.xml rename to resources/assets/ee3/lang/es_ES.xml index f13a2a0d..0c562161 100644 --- a/resources/mods/ee3/lang/es_ES.xml +++ b/resources/assets/ee3/lang/es_ES.xml @@ -1,10 +1,10 @@ - + Spanish (es_ES) Localization File Extra Lanzar - Alternar + Mueva Cargar Fragmento de Minio Piedra Inerte @@ -16,16 +16,18 @@ Polvo Azur Polvo Purpúreo Polvo Iridiscente - Bolsa de Alquimia - Agua Roja (Quieta) - Agua Roja (Fluyendo) + Bolsa Alquimico + Agua Roja (Inmovil) + Agua Roja (Corriente) Calcinador Aludel - Cofre de Alquimia + Cofre Alquimico + Campana de Crystal Calcinator Aludel - Cofre de Alquimia - Bolsa de Alquimia + Cofre Alquimico + Bolsa Alquimico + Campana Virido Equivalent Exchange 3 Inicializando chequeo de versión contra el archivo autoritario remoto, ubicado en El chequeo de versiones no se iniicalizó adecuadamente @@ -49,4 +51,4 @@ Reproduciendo sonidos de Equivalent Exchange 3 provenientes de todos los jugadores Reproduciendo sonidos de Equivalent Exchange 3 provenientes de uno mismo La reproducción de los sonidos de Equivalent Exchange 3 ha sido desactivada - \ No newline at end of file + diff --git a/resources/mods/ee3/lang/fi_FI.xml b/resources/assets/ee3/lang/fi_FI.xml similarity index 84% rename from resources/mods/ee3/lang/fi_FI.xml rename to resources/assets/ee3/lang/fi_FI.xml index 9facce4a..b5b6d4f2 100644 --- a/resources/mods/ee3/lang/fi_FI.xml +++ b/resources/assets/ee3/lang/fi_FI.xml @@ -21,18 +21,20 @@ Punavesi (Virtaava) Kalsinaattori Aludeli - Alchemical Chest - Calcinator - Aludel + Alkeminen arkku + Lasitiuku + Kalsinaattori + Aludeli Alkeminen arkku Alkeminen pussi + Lasitiuku Equivalent Exchange 3 - Alustetaaan etäversion tarkistusta palvelimeen kohteessa - Etäversion tarkistusta ei pystytty alustamaan + Aloitetaan etäversion tarkistusta kohteesta + Etäversion tarkistuksen aloittaminen epäonnistui Käytät tällä hetkellä uusinta (@REMOTE_MOD_VERSION@) Equivalent Exchange 3 -versiota, joka on tarkoitettu Minecraft @MINECRAFT_VERSION@:lle Uusi @MOD_NAME@ versio on saatavilla (@REMOTE_MOD_VERSION@) Minecraftin versiolle @MINECRAFT_VERSION@. Lataa se täältä: @MOD_UPDATE_LOCATION@ - Virhe yhdistettäessä etäversiopalvelimeen; yritetään uudelleen - Version tarkistus pysäytetään kolmen epäonnistuneen yrityksen jälkeen + Tapahtui virhe yhdistettäessä etäversion palvelimeen; yritetään uudelleen + Version tarkistus lopetettu kolmen epäonnistuneen yrityksen jälkeen @MOD_NAME@:a @MINECRAFT_VERSION@:lle ei löytynyt Kohdistetun transmutoinnin peitevalikko käytössä Kohdistetun transmutoinnin peitevalikko poissa käytössä @@ -49,4 +51,4 @@ Toistetaan kaikkien pelaajien Equivalent Exchange 3 äänet Toistetaan vain omat Equivalent Exchange 3 äänet Equivalent Exchange 3 äänet poistettu käytöstä - \ No newline at end of file + diff --git a/resources/mods/ee3/lang/fr_FR.xml b/resources/assets/ee3/lang/fr_FR.xml similarity index 87% rename from resources/mods/ee3/lang/fr_FR.xml rename to resources/assets/ee3/lang/fr_FR.xml index e6986bf1..12870783 100644 --- a/resources/mods/ee3/lang/fr_FR.xml +++ b/resources/assets/ee3/lang/fr_FR.xml @@ -5,7 +5,7 @@ Extra Libérer - Baculer + Basculer Charger Eclat de Minium Pierre inerte @@ -21,7 +21,15 @@ Eau rouge (Immobile) Eau rouge (Ruisselante) Calcinateur + Aludel + Coffre d'alchimie + Cloche en verre Calcinateur + Aludel + Coffre d'alchimie + Sac alchimique + Cloche en verre + Equivalent Exchange 3 Lancement de la vérification de votre version par rapport à celle de réference : Le lancement de la vérification a échoué Vous utilisez la version (@REMOTE_MOD_VERSION@) la plus récente pour votre version de Minecraft (@MINECRAFT_VERSION) @@ -43,4 +51,4 @@ Joue les sons d'Equivalent Exchange 3 de tous les joueurs Joue les sons d'Equivalent Exchange 3 de soi uniquement Sons d'Equivalent Exchange 3 désactivés - \ No newline at end of file + diff --git a/resources/mods/ee3/lang/it_IT.xml b/resources/assets/ee3/lang/it_IT.xml similarity index 100% rename from resources/mods/ee3/lang/it_IT.xml rename to resources/assets/ee3/lang/it_IT.xml diff --git a/resources/mods/ee3/lang/ja_JP.xml b/resources/assets/ee3/lang/ja_JP.xml similarity index 94% rename from resources/mods/ee3/lang/ja_JP.xml rename to resources/assets/ee3/lang/ja_JP.xml index 28bfa82c..e0aafff6 100644 --- a/resources/mods/ee3/lang/ja_JP.xml +++ b/resources/assets/ee3/lang/ja_JP.xml @@ -1,35 +1,37 @@ - - - - Japanese (ja_JP) Localization File - - エクストラ - リリース - トグル - チャージ - 鉛丹の欠片 - 不活性な石 - 鉛丹石 - 賢者の石 - - 鉛丹の粉末 - 新緑の粉末 - 紺碧の粉末 - 紫赤色の粉末 - 玉虫色の粉末 - 奇術袋 - 赤い水 (水源) - 赤い水 (流水) - 煆焼器 - アルデル - 奇術チェスト - 煆焼器 - アルデル - 奇術チェスト - 奇術袋 - Equivalent Exchange 3 - オンラインバージョンチェックの初期化中。場所: - バージョンチェックに失敗しました。 (初期化に失敗しました。) - MINECRAFT (バージョン @REMOTE_MOD_VERSION@) ため @MOD_NAME@ の最新バージョンを使用しています。 - @MINECRAFT_VERSION@ ため @MOD_NAME@ の新しいバージョン (@REMOTE_MOD_VERSION@) があります。 @MOD_UPDATE_LOCATION@ からアップデートしてください。 - \ No newline at end of file + + + + Japanese (ja_JP) Localization File + + エクストラ + リリース + トグル + チャージ + 鉛丹の欠片 + 不活性な石 + 鉛丹石 + 賢者の石 + + 鉛丹の粉末 + 新緑の粉末 + 紺碧の粉末 + 紫赤色の粉末 + 玉虫色の粉末 + 奇術袋 + 赤い水 (水源) + 赤い水 (流水) + 煆焼器 + アルデル + 奇術チェスト + グラスの鐘 + 煆焼器 + アルデル + 奇術チェスト + 奇術袋 + グラスの鐘 + Equivalent Exchange 3 + オンラインバージョンチェックの初期化中。場所: + バージョンチェックに失敗しました。 (初期化に失敗しました。) + MINECRAFT (バージョン @REMOTE_MOD_VERSION@) ため @MOD_NAME@ の最新バージョンを使用しています。 + @MINECRAFT_VERSION@ ため @MOD_NAME@ の新しいバージョン (@REMOTE_MOD_VERSION@) があります。 @MOD_UPDATE_LOCATION@ からアップデートしてください。 + diff --git a/resources/mods/ee3/lang/la_IT.xml b/resources/assets/ee3/lang/la_IT.xml similarity index 100% rename from resources/mods/ee3/lang/la_IT.xml rename to resources/assets/ee3/lang/la_IT.xml diff --git a/resources/mods/ee3/lang/nb_NO.xml b/resources/assets/ee3/lang/nb_NO.xml similarity index 100% rename from resources/mods/ee3/lang/nb_NO.xml rename to resources/assets/ee3/lang/nb_NO.xml diff --git a/resources/mods/ee3/lang/nl_NL.xml b/resources/assets/ee3/lang/nl_NL.xml similarity index 97% rename from resources/mods/ee3/lang/nl_NL.xml rename to resources/assets/ee3/lang/nl_NL.xml index 17425048..87ef3bb8 100644 --- a/resources/mods/ee3/lang/nl_NL.xml +++ b/resources/assets/ee3/lang/nl_NL.xml @@ -17,16 +17,17 @@ Amarant Poeder Iriserend Poeder Alchemische Tas - Glazen Bel Stilstaand Rood Water Stromend Rood Water Calcinator Aludel Alchemische Kist + Glazen Stolp Calcinator Aludel Alchemische Kist Alchemische Tas + Glazen Stolp Equivalent Exchange 3 Start met externe versiecontrole tegen extern versiebestand, te vinden op De versiecontrole is niet geslaagd (versiecontrole is niet correct gestart) diff --git a/resources/assets/ee3/lang/pl_PL.xml b/resources/assets/ee3/lang/pl_PL.xml new file mode 100644 index 00000000..ddf80a70 --- /dev/null +++ b/resources/assets/ee3/lang/pl_PL.xml @@ -0,0 +1,54 @@ + + + + Polish (pl_PL) Localization File + Dodatkowa funkcja + Wypuść + Przełącz + Ładuj + Odłam Minium + Nieaktywny kamień + Minium + Kamień filozoficzny + Popiół + Proszek Minium + Zielony proszek + Lazurowy proszek + Amarantowy proszek + Opalowy Proszek + Torba alchemiczna + Czerwona woda (Stojąca) + Czerwona woda (Płynąca) + Kalcynator + Aludel + Skrzynia alchemiczna + Szklany dzwon + Kalcynator + Aludel + Skrzynia alchemiczna + Torba alchemiczna + Szklany dzwon + Equivalent Exchange 3 + Rozpoczynanie zdalnego sprawdzania wersji, według + Zdalne sprawdzanie wersji nie rozpoczęło się poprawnie + Używasz najnowszej wersji (@REMOTE_MOD_VERSION@) of Equivalent Exchange 3 dla @MINECRAFT_VERSION@ + Nowa wersja @MOD_NAME@ (@REMOTE_MOD_VERSION@) dla @MINECRAFT_VERSION@ dostępna. Pobierz ją tutaj: @MOD_UPDATE_LOCATION@ + Błąd podczas sprawdzania wersji; ponawianie próby + Sprawdzanie wersji przerwane po trzech nieudanych próbach + Odnalezienie wersji @MOD_NAME@ dla @MINECRAFT_VERSION@ niemożliwe + Nakładka transmutacji włączona + Nakładka transmutacji wyłączona + Nakładka transmutacji przeniesona w lewy górny róg + Nakładka transmutacji przeniesona w prawy górny róg + Nakładka transmutacji przeniesona w lewy dolny róg + Nakładka transmutacji przeniesona w prawy dolny róg + (gdzie ### to wartość dziesiętna pomiędzy 0.0 i 1.0) + Przezroczystość nakładki transmutacji zmieniona pomyślnie + (gdzie ### to wartość dziesiętna powyżej 0.0) + Skala nakładki transmutacji zmieniona pomyślnie + Efekty cząsteczek Equivalent Exchange 3 włączone + Efekty cząsteczek Equivalent Exchange 3 wyłączone + Odtwarzanie dźwięków Equivalent Exchange 3 od wszystkich graczy + Odtwarzanie dźwięków Equivalent Exchange 3 tylko od siebie + Odtwarzanie dźwięków Equivalent Exchange 3 wyłączone + \ No newline at end of file diff --git a/resources/assets/ee3/lang/pt_BR.xml b/resources/assets/ee3/lang/pt_BR.xml new file mode 100644 index 00000000..57e331a1 --- /dev/null +++ b/resources/assets/ee3/lang/pt_BR.xml @@ -0,0 +1,54 @@ + + + + Portuguese (pt_BR) Localization File + Extra + Liberar + Alterar + Carregar + Fragmento de Minium + Pedra Inerte + Pedra de Minium + Pedra Filosofal + Cinzas + Pó de Minium + Pó Verdejantet + Pó Indigo + Pó Amarantino + Pó Iridescente + Bolsa Alquímica + Água vermelha (Parada) + Água Vermelha(Corrente) + Calcinador + Sublimador + Baú Alquímico + Sino Vítreo + Calcinador + Sublimador + Baú Alquímico + Bolsa Alquímica + Sino Vítreo + Equivalent Exchange 3 + Iniciando checagem da versão remota contra a versão remota autorítaria,localizada em + Checagem da versão remota não pode ser feita adequadamente + Atualmente usando a versão mais recente (@REMOTE_MOD_VERSION@) de Equivalent Exchange 3 para @MINECRAFT_VERSION@ + Uma nova versão de @MOD_NAME@ existe (@REMOTE_MOD_VERSION@) para @MINECRAFT_VERSION@. Consigam-na aqui: @MOD_UPDATE_LOCATION@ + Erro enquanto conectando à versão remota do arquivo autoritário; tentando novamente + Checagem de versão finalizada com erros após várias tentativas sem sucesso + Não foi possível achar a versão de @MOD_NAME@ para @MINECRAFT_VERSION@ na versão remota autoritária + Camdada do alvo de transmutação ligada + Camada do alvo de transmutação desligada + Posição da camada alvo de transmutação configurada para noroeste + Posição da camada alvo de transmutação configurada para nordeste + Posição da camada alvo de transmutação configurada para sudoeste + Posição da camada alvo de transmutação configurada para sudeste + (onde ### é um valor decimal entre 0.0 e 1.0) + Opacidade da camada alvo de transmutação configurada com sucesso + (onde ### é um valor decimal maior que 0.0) + Escala da camada alvo de transmutação configurada com sucesso + Partículas do Equivalent Exchange 3 ligadas + Partículas do Equivalent Exchange 3 desligadas + Tocando sons do Equivalent Exchange 3 para todos os jogadores + Tocando sons do Equivalent Exchange 3 para si mesmo + Sons do Equivalent Exchange 3 desabilitados + \ No newline at end of file diff --git a/resources/mods/ee3/lang/pt_PT.xml b/resources/assets/ee3/lang/pt_PT.xml similarity index 73% rename from resources/mods/ee3/lang/pt_PT.xml rename to resources/assets/ee3/lang/pt_PT.xml index f6b44781..5a5783bd 100644 --- a/resources/mods/ee3/lang/pt_PT.xml +++ b/resources/assets/ee3/lang/pt_PT.xml @@ -6,29 +6,29 @@ Disparar Alternar Carregar - Fragmento de Mínio + Fragmento de Minium Pedra Inerte - Pedra de Mínio + Pedra de Minium Pedra Filosofal Cinza - Pó de Mínio - Pó Virente - Pó Cerúleo - Pó Amarantino + Pó de Minium + Pó Verde + Pó Índigo + Pó Violeta Pó Iridescente - Saco Alquímico - Água Vermelha (Estagnada) + Saco Alquémico + Água Vermelha (Parada) Água Vermelha (a Fluir) - Calcinatório + Calcinador Aludel - Baú Alquímico - Calcinatório + Baú Alquémico + Calcinador Aludel - Baú Alquímico - Saco Alquímico + Baú Alquémico + Saco Alquémico Equivalent Exchange 3 - A inicializar verificação da versão contra o ficheiro autoritário de versão remoto, localizado em - A verificação da versão não inicializou correctamente + A iniciar verificação da versão contra o ficheiro autoritário de versão remoto, localizado em + A verificação da versão falhou Estás actualmente a usar a versão mais actualizada (@REMOTE_MOD_VERSION@) do Equivalent Exchange 3 para o @MINECRAFT_VERSION@ Existe uma versão mais recente do @MOD_NAME@ (@REMOTE_MOD_VERSION@) para o @MINECRAFT_VERSION@. Obtém-na aqui: @MOD_UPDATE_LOCATION@ Erro ao ligar ao ficheiro autoritário de versão remoto, a tentar novamente @@ -47,6 +47,6 @@ As partículas do Equivalent Exchange 3 foram ligadas As partículas do Equivalent Exchange 3 foram desligadas A reproduzir os sons do Equivalent Exchange 3 de todos os jogadores - A reproduzir os sons do Equivalent Exchange 3 apenas por parte do jogador + A reproduzir os seus sons do Equivalent Exchange 3 apenas Os sons do Equivalente Exchange 3 foram desligados - \ No newline at end of file + diff --git a/resources/mods/ee3/lang/ru_RU.xml b/resources/assets/ee3/lang/ru_RU.xml similarity index 83% rename from resources/mods/ee3/lang/ru_RU.xml rename to resources/assets/ee3/lang/ru_RU.xml index 859e3b9d..faff0a55 100644 --- a/resources/mods/ee3/lang/ru_RU.xml +++ b/resources/assets/ee3/lang/ru_RU.xml @@ -1,52 +1,54 @@ - - - - Russian (ru_RU) Localization File - Экстра - Сброс - Переключение - Заряд - Алхимический Осколок - Инертный Камень - Алхимический Камень - Философский Камень - Пыль - Алхимический Порошок - Зелёный Порошок - Лазурный Порошок - Пурпурный Порошок - Радужный Порошок - Алхимическая Сумка - Красная Вода (Стоящая) - Красная Вода (Текущая) - Кальцинатор - Алюдель - Алхимический Сундук - Кальцинатор - Алюдель - Алхимический Сундук - Алхимическая Сумка - Equivalent Exchange 3 - Инициализация проверки версии файла по удалённому экземпляру, расположенному на - Не удалась инициализация удалённой проверки версии - Используется самая свежая версия (@REMOTE_MOD_VERSION@) модификации Equivalent Exchange 3 для @MINECRAFT_VERSION@ - Новая версия модификации @MOD_NAME@ существует (@REMOTE_MOD_VERSION@) для @MINECRAFT_VERSION@. Вы можите скачать её здесь: @MOD_UPDATE_LOCATION@ - Ошибка подключения к удалённому файлу проверки версии; новая попытка - Проверка версии отменена после 3х неудачных попыток - Не удаётся найти версию модификации @MOD_NAME@ для @MINECRAFT_VERSION@ в удалённом хранилище версий - Панель цели трансмутации включена - Панель цели трансмутации выключена - Позиция панели цели трансмутации установленна на верхний левый угол - Позиция панели цели трансмутации установленна на верхний правый угол - Позиция панели цели трансмутации установленна на нижний левый угол - Позиция панели цели трансмутации установленна на нижний правый угол - (где ### - десятичное значение между 0.0 и 1.0) - Прозрачность панели цели трансмутации успешно обновлена - (где ### - десятичное значение, больше 0.0) - Размер панели цели трансмутации успешно обновлён - Частицы Equivalent Exchange 3 включены - Частицы Equivalent Exchange 3 выключены - Звуки Equivalent Exchange 3 слышны всем - Звуки Equivalent Exchange 3 слышны только вам - Звуки Equivalent Exchange 3 выключены - \ No newline at end of file + + + + Russian (ru_RU) Localization File + Экстра + Сброс + Переключение + Заряд + Алхимический осколок + Инертный камень + Алхимический камень + Философский камень + Пыль + Алхимический порошок + Зелёный порошок + Лазурный порошок + Пурпурный порошок + Радужный порошок + Алхимическая сумка + Красная вода (Стоящая) + Красная вода (Текущая) + Кальцинатор + Алюдель + Алхимический сундук + Стеклянный колпак + Кальцинатор + Алюдель + Алхимический сундук + Алхимическая сумка + Стеклянный колпак + Equivalent Exchange 3 + Инициализация проверки версии файла по удалённому экземпляру, расположенному на + Не удалась инициализация удалённой проверки версии + Используется самая свежая версия (@REMOTE_MOD_VERSION@) модификации Equivalent Exchange 3 для @MINECRAFT_VERSION@ + Новая версия модификации @MOD_NAME@ существует (@REMOTE_MOD_VERSION@) для @MINECRAFT_VERSION@. Вы можите скачать её здесь: @MOD_UPDATE_LOCATION@ + Ошибка подключения к удалённому файлу проверки версии; новая попытка + Проверка версии отменена после 3х неудачных попыток + Не удаётся найти версию модификации @MOD_NAME@ для @MINECRAFT_VERSION@ в удалённом хранилище версий + Панель цели трансмутации включена + Панель цели трансмутации выключена + Позиция панели цели трансмутации установленна на верхний левый угол + Позиция панели цели трансмутации установленна на верхний правый угол + Позиция панели цели трансмутации установленна на нижний левый угол + Позиция панели цели трансмутации установленна на нижний правый угол + (где ### - десятичное значение между 0.0 и 1.0) + Прозрачность панели цели трансмутации успешно обновлена + (где ### - десятичное значение, больше 0.0) + Размер панели цели трансмутации успешно обновлён + Частицы Equivalent Exchange 3 включены + Частицы Equivalent Exchange 3 выключены + Звуки Equivalent Exchange 3 слышны всем + Звуки Equivalent Exchange 3 слышны только вам + Звуки Equivalent Exchange 3 выключены + diff --git a/resources/mods/ee3/lang/sk_SK.xml b/resources/assets/ee3/lang/sk_SK.xml similarity index 100% rename from resources/mods/ee3/lang/sk_SK.xml rename to resources/assets/ee3/lang/sk_SK.xml diff --git a/resources/assets/ee3/lang/sl_SI.xml b/resources/assets/ee3/lang/sl_SI.xml new file mode 100644 index 00000000..a6dcc1d1 --- /dev/null +++ b/resources/assets/ee3/lang/sl_SI.xml @@ -0,0 +1,54 @@ + + + + Slovenian (sl_SI) Localization File + Dodatno + Sproži + Preklopi + Nabij + Drobec Minija + Nedejaven Kamen + Minijev Kamen + Kamen Modrosti + Pepel + Minijev Prah + Zelen Prah + Moder Prah + Vijoličen Prah + Mavrični Prah + Alkimistična Vreča + Rdeča Voda (Mirujoča) + Rdeča Voda (Pretočna) + Kalcinator + Aludel + Alkimistični Zaboj + Stekleni Zvonec + Kalcinator + Aludel + Alkimistični Zaboj + Alkimistična Vreča + Stekleni Zvonec + Equivalent Exchange 3 + Inicializiram oddaljeno preverjanje različice z različico oddaljenega strežnika, ki se nahaja na + Oddaljeno preverjanje različice se ni inicializiralo pravilno + Trenutno je v uporabi zadnja različica (@REMOTE_MOD_VERSION@) Equivalent Exchange 3 za @MINECRAFT_VERSION@ + Obstaja nova različica @MOD_NAME@ (@REMOTE_MOD_VERSION@) za @MINECRAFT_VERSION@. Dobite jo tukaj: @MOD_UPDATE_LOCATION@ + Napaka pri pridobivanju datoteke z različico z oddaljenega strežnika; poskušam znova + Preverjanje različice ustavljeno po treh neuspešnih preverjanjih + Ne morem najti različice @MOD_NAME@ za @MINECRAFT_VERSION@ na oddaljenem strežniku + Prikaz transmutacije je vključen + Prikaz transmutacije je izključen + Mesto prikaza transmutacije je bilo nastavljeno na zgoraj levo + Mesto prikaza transmutacije je bilo nastavljeno na zgoraj desno + Mesto prikaza transmutacije je bilo nastavljeno na spodaj levo + Mesto prikaza transmutacije je bilo nastavljeno na spodaj desno + (kjer je ### decimalna vrednost med 0.0 in 1.0) + Prosojnost prikaza transmutacije je bila uspešno posodobljena + (kjer je ### decimalna vrednost večja od 0.0) + Velikost prikaza transmutacije je bila uspešno posodobljena + Equivalent Exchange 3 delci so vključeni + Equivalent Exchange 3 delci so izključeni + Predvajam Equivalent Exchange 3 zvoke vseh igralcev + Predvajam Equivalent Exchange 3 zvoke samo od sebe + Predvajanje Equivalent Exchange 3 zvokov je izključeno + diff --git a/resources/assets/ee3/lang/sr_SP.xml b/resources/assets/ee3/lang/sr_SP.xml new file mode 100644 index 00000000..c9139cba --- /dev/null +++ b/resources/assets/ee3/lang/sr_SP.xml @@ -0,0 +1,54 @@ + + + + Serbian (sr_SP) Localization File + Dodatno + Oslabiti + Menjati + Pojačati + Odlomak Miniuma + Inertni Kamen + Miniumski Kamen + Filozofski Kamen + Pepeo + Miniumska Prašina + Verdantna Prašina + Azurna Prašina + Amarantinska Prašina + Iridesentna Prašina + Alhemijska Vreća + Crvena Voda (Stajaća) + Crvena Voda (Tekuća) + Kalcinator + Aludel + Alhemijski Kovčeg + Stakleno Zvono + Kalcinator + Aludel + Alhemijski Kovčeg + Alhemijska Vreća + Stakleno Zvono + Equivalent Exchange 3 + Započinjem proveru verzije u poređenju sa naj novijom, koji se nalazi u + Provera verzije neuspešna + Trenutno koristite naj noviju verziju (@REMOTE_MOD_VERSION@) Equivalent Exchange 3 moda za @MINECRAFT_VERSION@ + Nova @MOD_NAME@ verzija postoji (@REMOTE_MOD_VERSION@) za @MINECRAFT_VERSION@. Skinite je ovde: @MOD_UPDATE_LOCATION@ + Greška u konektovanju sa serverom; pokusavam ponovo + Provera verzije zaustavljena posle tri neušpesna pokušaja + Potraga za verziju @MOD_NAME@ za @MINECRAFT_VERSION@, neuspešna + Prikaz mete transmutacije uključen + Prikaz mete transmutacije isključen + Prikaz mete transmutacije stavljen na gornji levi ugao + Prikaz mete transmutacije stavljen na gornji desni ugao + Prikaz mete transmutacije stavljen na donji levi ugao + Prikaz mete transmutacije stavljen na donji desni ugao + (gde je ### decimalna vrednost izmedju 0.0 i 1.0) + Prozirnost prikaza mete transmutacije uspešno promenjena + (gde je ### decimalna vrednost veća nego 0.0) + Veličina prikaza mete transmutacije uspešno promenjena + Equivalent Exchange 3 čestice uključene + Equivalent Exchange 3 čestice isključene + Čućete Equivalent Exchange 3 zvukove od svih igrača + Čućete samo svoje Equivalent Exchange 3 zvukove + Equivalent Exchange 3 zvukovi isključeni + diff --git a/resources/mods/ee3/lang/sv_SE.xml b/resources/assets/ee3/lang/sv_SE.xml similarity index 100% rename from resources/mods/ee3/lang/sv_SE.xml rename to resources/assets/ee3/lang/sv_SE.xml diff --git a/resources/mods/ee3/lang/tr_TR.xml b/resources/assets/ee3/lang/tr_TR.xml similarity index 100% rename from resources/mods/ee3/lang/tr_TR.xml rename to resources/assets/ee3/lang/tr_TR.xml diff --git a/resources/mods/ee3/lang/zh_CN.xml b/resources/assets/ee3/lang/zh_CN.xml similarity index 94% rename from resources/mods/ee3/lang/zh_CN.xml rename to resources/assets/ee3/lang/zh_CN.xml index 485701d6..33697746 100644 --- a/resources/mods/ee3/lang/zh_CN.xml +++ b/resources/assets/ee3/lang/zh_CN.xml @@ -1,52 +1,56 @@ - - - - Simplified Chinese (zh_CN) Localization File - 额外功能 - 施放技能 - 切换目标 - 充能 - 铅丹碎片 - 惰性石 - 铅丹石 - 贤者之石 - 灰烬 - 铅丹粉末 - 翠绿粉末 - 蔚蓝粉末 - 紫红粉末 - 虹彩粉末 - 炼金袋 - 红水(静止) - 红水(流动) - 煅烧炉 - 梨形器皿 - 炼金箱子 - 煅烧炉 - 梨形器皿 - 炼金箱子 - 炼金袋 - Equivalent Exchange 3 - 远程版本检查开始初始化,版本信息文件位于 - 远程版本更新检查更新失败 - 当前使用的是 Equivalent Exchange 3 的最新版本 (@REMOTE_MOD_VERSION@),适用于 @MINECRAFT_VERSION@ 版本 - @MOD_NAME@ 的最新版本 (@REMOTE_MOD_VERSION@) 已更新,适用于 @MINECRAFT_VERSION@,请在 @MOD_UPDATE_LOCATION@ 下载 - 访问远程版本文件失败;重试中 - 累计三次连接失败后版本检查中断 - 禁止远程版本检查,略过此步 - 开启转换目标快捷视图 - 关闭转换目标快捷视图 - 将转换目标快捷视图设置在屏幕左上角 - 将转换目标快捷视图设置在屏幕右上角 - 将转换目标快捷视图设置在屏幕左下角 - 将转换目标快捷视图设置在屏幕右下角 - (### 是介于 0.0 与 1.0 间的小数 ) - 已成功更新转换目标快捷视图透明度 - (### 为大于 0.0 的小数) - 已成功更新转换目标快捷视图界面大小 - 开启 Equivalent Exchange 3 粒子渲染效果 - 关闭 Equivalent Exchange 3 粒子渲染效果 - 允许对所有玩家播放 Equivalent Exchange 3 音频 - 允许对自己播放 Equivalent Exchange 3 音频 - 禁止播放 Equivalent Exchange 3 音频 - \ No newline at end of file + + + + Simplified Chinese (zh_CN) Localization File + 额外功能 + 施放技能 + 切换目标 + 充能 + 铅丹碎片 + 惰性石 + 铅丹石 + 贤者之石 + 灰烬 + 铅丹粉末 + 翠绿粉末 + 蔚蓝粉末 + 紫红粉末 + 虹彩粉末 + 炼金袋 + 红水(静止) + 红水(流动) + 煅烧炉 + 梨形器皿 + 炼金箱子 + 玻璃罩 + 玻璃钟 + 煅烧炉 + 梨形器皿 + 炼金箱子 + 玻璃罩 + 炼金袋 + 玻璃钟 + Equivalent Exchange 3 + 远程版本检查开始初始化,版本信息文件位于 + 远程版本更新检查更新失败 + 当前使用的是 Equivalent Exchange 3 的最新版本 (@REMOTE_MOD_VERSION@),适用于 @MINECRAFT_VERSION@ 版本 + @MOD_NAME@ 的最新版本 (@REMOTE_MOD_VERSION@) 已更新,适用于 @MINECRAFT_VERSION@,请在 @MOD_UPDATE_LOCATION@ 下载 + 访问远程版本文件失败;重试中 + 累计三次连接失败后版本检查中断 + 禁止远程版本检查,略过此步 + 开启转换目标快捷视图 + 关闭转换目标快捷视图 + 将转换目标快捷视图设置在屏幕左上角 + 将转换目标快捷视图设置在屏幕右上角 + 将转换目标快捷视图设置在屏幕左下角 + 将转换目标快捷视图设置在屏幕右下角 + (### 是介于 0.0 与 1.0 间的小数 ) + 已成功更新转换目标快捷视图透明度 + (### 为大于 0.0 的小数) + 已成功更新转换目标快捷视图界面大小 + 开启 Equivalent Exchange 3 粒子渲染效果 + 关闭 Equivalent Exchange 3 粒子渲染效果 + 允许对所有玩家播放 Equivalent Exchange 3 音频 + 允许对自己播放 Equivalent Exchange 3 音频 + 禁止播放 Equivalent Exchange 3 音频 + diff --git a/resources/mods/ee3/lang/zh_TW.xml b/resources/assets/ee3/lang/zh_TW.xml similarity index 97% rename from resources/mods/ee3/lang/zh_TW.xml rename to resources/assets/ee3/lang/zh_TW.xml index 9c32f645..058eaeeb 100644 --- a/resources/mods/ee3/lang/zh_TW.xml +++ b/resources/assets/ee3/lang/zh_TW.xml @@ -1,52 +1,54 @@ - - - - Traditional Chinese (zh_TW) Localization File - 額外功能 - 施放技能 - 切換目標 - 充能 - 鉛丹碎片 - 惰性石 - 鉛丹石 - 賢者之石 - 紅水(靜止) - 紅水(流動) - 灰烬 - 鉛丹粉末 - 翠綠粉末 - 蔚藍粉末 - 紫紅粉末 - 虹彩粉末 - 煉金袋 - 煅燒爐 - 梨形器皿 - 煉金箱子 - 煅燒爐 - 梨形器皿 - 煉金箱子 - 煉金袋 - Equivalent Exchange 3 - 遠程版本檢查開始初始化,版本信息文件位于 - 遠程版本更新檢查更新失敗 - 當前使用的是 Equivalent Exchange 3 的最新版本 (@REMOTE_MOD_VERSION@),適用于 @MINECRAFT_VERSION@ 版本 - @MOD_NAME@ 的最新版本 (@REMOTE_MOD_VERSION@) 已更新,適用于 @MINECRAFT_VERSION@,請在 @MOD_UPDATE_LOCATION@ 下載 - 訪問遠程版本文件失敗;重試中 - 累計三次連接失敗後版本檢查中斷 - 禁止遠程版本檢查,略過此步 - 開啓轉換目標快捷視圖 - 關閉轉換目標快捷視圖 - 將轉換目標快捷視圖設置在屏幕左上角 - 將轉換目標快捷視圖設置在屏幕右上角 - 將轉換目標快捷視圖設置在屏幕左下角 - 將轉換目標快捷視圖設置在屏幕右下角 - (### 是介于 0.0 與 1.0 間的小數) - 已成功更新轉換目標快捷視圖透明度 - (### 爲大于 0.0 的小數) - 已成功更新轉換目標快捷視圖界面大小 - 開啓 Equivalent Exchange 3 粒子渲染效果 - 關閉 Equivalent Exchange 3 粒子渲染效果 - 允許對所有玩家播放 Equivalent Exchange 3 音頻 - 允許對自己播放 Equivalent Exchange 3 音頻 - 禁止播放 Equivalent Exchange 3 音頻 - \ No newline at end of file + + + + Traditional Chinese (zh_TW) Localization File + 額外功能 + 施放技能 + 切換目標 + 充能 + 鉛丹碎片 + 惰性石 + 鉛丹石 + 賢者之石 + 紅水(靜止) + 紅水(流動) + 灰烬 + 鉛丹粉末 + 翠綠粉末 + 蔚藍粉末 + 紫紅粉末 + 虹彩粉末 + 煉金袋 + 煅燒爐 + 梨形器皿 + 煉金箱子 + 玻璃鐘 + 煅燒爐 + 梨形器皿 + 煉金箱子 + 煉金袋 + 玻璃鐘 + Equivalent Exchange 3 + 遠程版本檢查開始初始化,版本信息文件位于 + 遠程版本更新檢查更新失敗 + 當前使用的是 Equivalent Exchange 3 的最新版本 (@REMOTE_MOD_VERSION@),適用于 @MINECRAFT_VERSION@ 版本 + @MOD_NAME@ 的最新版本 (@REMOTE_MOD_VERSION@) 已更新,適用于 @MINECRAFT_VERSION@,請在 @MOD_UPDATE_LOCATION@ 下載 + 訪問遠程版本文件失敗;重試中 + 累計三次連接失敗後版本檢查中斷 + 禁止遠程版本檢查,略過此步 + 開啓轉換目標快捷視圖 + 關閉轉換目標快捷視圖 + 將轉換目標快捷視圖設置在屏幕左上角 + 將轉換目標快捷視圖設置在屏幕右上角 + 將轉換目標快捷視圖設置在屏幕左下角 + 將轉換目標快捷視圖設置在屏幕右下角 + (### 是介于 0.0 與 1.0 間的小數) + 已成功更新轉換目標快捷視圖透明度 + (### 爲大于 0.0 的小數) + 已成功更新轉換目標快捷視圖界面大小 + 開啓 Equivalent Exchange 3 粒子渲染效果 + 關閉 Equivalent Exchange 3 粒子渲染效果 + 允許對所有玩家播放 Equivalent Exchange 3 音頻 + 允許對自己播放 Equivalent Exchange 3 音頻 + 禁止播放 Equivalent Exchange 3 音頻 + diff --git a/resources/mods/ee3/models/aludel.obj b/resources/assets/ee3/models/aludel.obj similarity index 100% rename from resources/mods/ee3/models/aludel.obj rename to resources/assets/ee3/models/aludel.obj diff --git a/resources/mods/ee3/models/calcinator.obj b/resources/assets/ee3/models/calcinator.obj similarity index 100% rename from resources/mods/ee3/models/calcinator.obj rename to resources/assets/ee3/models/calcinator.obj diff --git a/resources/mods/ee3/sound/chargeDown.ogg b/resources/assets/ee3/sound/chargeDown.ogg similarity index 100% rename from resources/mods/ee3/sound/chargeDown.ogg rename to resources/assets/ee3/sound/chargeDown.ogg diff --git a/resources/mods/ee3/sound/chargeUp.ogg b/resources/assets/ee3/sound/chargeUp.ogg similarity index 100% rename from resources/mods/ee3/sound/chargeUp.ogg rename to resources/assets/ee3/sound/chargeUp.ogg diff --git a/resources/mods/ee3/sound/destruct.ogg b/resources/assets/ee3/sound/destruct.ogg similarity index 100% rename from resources/mods/ee3/sound/destruct.ogg rename to resources/assets/ee3/sound/destruct.ogg diff --git a/resources/mods/ee3/sound/fail.ogg b/resources/assets/ee3/sound/fail.ogg similarity index 100% rename from resources/mods/ee3/sound/fail.ogg rename to resources/assets/ee3/sound/fail.ogg diff --git a/resources/mods/ee3/sound/gust.ogg b/resources/assets/ee3/sound/gust.ogg similarity index 100% rename from resources/mods/ee3/sound/gust.ogg rename to resources/assets/ee3/sound/gust.ogg diff --git a/resources/mods/ee3/sound/heal.ogg b/resources/assets/ee3/sound/heal.ogg similarity index 100% rename from resources/mods/ee3/sound/heal.ogg rename to resources/assets/ee3/sound/heal.ogg diff --git a/resources/mods/ee3/sound/kinesis.ogg b/resources/assets/ee3/sound/kinesis.ogg similarity index 100% rename from resources/mods/ee3/sound/kinesis.ogg rename to resources/assets/ee3/sound/kinesis.ogg diff --git a/resources/mods/ee3/sound/launch.ogg b/resources/assets/ee3/sound/launch.ogg similarity index 100% rename from resources/mods/ee3/sound/launch.ogg rename to resources/assets/ee3/sound/launch.ogg diff --git a/resources/mods/ee3/sound/nova.ogg b/resources/assets/ee3/sound/nova.ogg similarity index 100% rename from resources/mods/ee3/sound/nova.ogg rename to resources/assets/ee3/sound/nova.ogg diff --git a/resources/mods/ee3/sound/philball.ogg b/resources/assets/ee3/sound/philball.ogg similarity index 100% rename from resources/mods/ee3/sound/philball.ogg rename to resources/assets/ee3/sound/philball.ogg diff --git a/resources/mods/ee3/sound/tock.ogg b/resources/assets/ee3/sound/tock.ogg similarity index 100% rename from resources/mods/ee3/sound/tock.ogg rename to resources/assets/ee3/sound/tock.ogg diff --git a/resources/mods/ee3/sound/transmute.ogg b/resources/assets/ee3/sound/transmute.ogg similarity index 100% rename from resources/mods/ee3/sound/transmute.ogg rename to resources/assets/ee3/sound/transmute.ogg diff --git a/resources/mods/ee3/sound/wall.ogg b/resources/assets/ee3/sound/wall.ogg similarity index 100% rename from resources/mods/ee3/sound/wall.ogg rename to resources/assets/ee3/sound/wall.ogg diff --git a/resources/mods/ee3/sound/waterball.ogg b/resources/assets/ee3/sound/waterball.ogg similarity index 100% rename from resources/mods/ee3/sound/waterball.ogg rename to resources/assets/ee3/sound/waterball.ogg diff --git a/resources/mods/ee3/sound/wind.ogg b/resources/assets/ee3/sound/wind.ogg similarity index 100% rename from resources/mods/ee3/sound/wind.ogg rename to resources/assets/ee3/sound/wind.ogg diff --git a/resources/mods/ee3/textures/blocks/alchemicalChest.png b/resources/assets/ee3/textures/blocks/alchemicalChest.png similarity index 100% rename from resources/mods/ee3/textures/blocks/alchemicalChest.png rename to resources/assets/ee3/textures/blocks/alchemicalChest.png diff --git a/resources/mods/ee3/textures/blocks/aludel.png b/resources/assets/ee3/textures/blocks/aludel.png similarity index 100% rename from resources/mods/ee3/textures/blocks/aludel.png rename to resources/assets/ee3/textures/blocks/aludel.png diff --git a/resources/mods/ee3/textures/blocks/calcinator.png b/resources/assets/ee3/textures/blocks/calcinator.png similarity index 100% rename from resources/mods/ee3/textures/blocks/calcinator.png rename to resources/assets/ee3/textures/blocks/calcinator.png diff --git a/resources/mods/ee3/textures/blocks/glassBell.png b/resources/assets/ee3/textures/blocks/glassBell.png similarity index 100% rename from resources/mods/ee3/textures/blocks/glassBell.png rename to resources/assets/ee3/textures/blocks/glassBell.png diff --git a/resources/mods/ee3/textures/effects/noise.png b/resources/assets/ee3/textures/effects/noise.png similarity index 100% rename from resources/mods/ee3/textures/effects/noise.png rename to resources/assets/ee3/textures/effects/noise.png diff --git a/resources/mods/ee3/textures/gui/alchemicalStorage.png b/resources/assets/ee3/textures/gui/alchemicalStorage.png similarity index 100% rename from resources/mods/ee3/textures/gui/alchemicalStorage.png rename to resources/assets/ee3/textures/gui/alchemicalStorage.png diff --git a/resources/mods/ee3/textures/gui/aludel.png b/resources/assets/ee3/textures/gui/aludel.png similarity index 100% rename from resources/mods/ee3/textures/gui/aludel.png rename to resources/assets/ee3/textures/gui/aludel.png diff --git a/resources/mods/ee3/textures/gui/calcinator.png b/resources/assets/ee3/textures/gui/calcinator.png similarity index 100% rename from resources/mods/ee3/textures/gui/calcinator.png rename to resources/assets/ee3/textures/gui/calcinator.png diff --git a/resources/mods/ee3/textures/gui/glassBell.png b/resources/assets/ee3/textures/gui/glassBell.png similarity index 100% rename from resources/mods/ee3/textures/gui/glassBell.png rename to resources/assets/ee3/textures/gui/glassBell.png diff --git a/resources/assets/ee3/textures/gui/ocarina.png b/resources/assets/ee3/textures/gui/ocarina.png new file mode 100644 index 0000000000000000000000000000000000000000..ee6bb8e68d837c3d240ca8c7bb1cd000075c09f4 GIT binary patch literal 6080 zcmds3^;cBUx4$!Vhja?kEe#SD!U&QB2+|@QBb~!20!j#iFd#^GcMl9AA|l-}q#_N{ z&AWczPw%bw7rb-VS@*7U?m1_l&))m9Kksz4)hS3>NC5z#fN4C`2LK582?2-+!Izmw zp&bB_DmXrPpsVZP?&a?3;EuQnd+^{U!o%Ip(d7jIXmo#0@`b}E7$OERz5!W%5>Wl{ zxfU!i9GGCCW}VDzC4fgMC0)gp4W&_g_=#IX_bX~hm&fQ~6*V2al8A>`;5L&QT*Up+ zcvN|5>+#;+`EsfIR?TtK`6gz-lo5z85J#g4H6d|7ZtR9CrLEC?(DT{^P!J9)lpvsG z^r+dgGLV?Mr?)RGoy!Aii4WNgc-jg@j0{Slw27`Wa!uBPUackrG^sTT%px?5Z{>M4 z?2K9f^GTCEb=h^)R>j3I3t;v0om0(zlxR6As$UfN zjyty*kq1z@h3@PV?afqAl*Hdb?={C%y)-gPqCs~`(lQ=UUFt-%XH~S>^Qdgc?hTqN z{ME9KM2VHN3XAeS`Cee3D`mpgyqFPj!bx=H%|UoC&5tsp^M=}+clpu1n$&fv-7BPx zj!KH?JakcbQ-3xVN21+(h~>3ME8& zUhl|V+IQqF@rI`ED)jRTyy>UilVUvnIzXEVfoMR5;)s6SWnTpzSP_<@L=pIISk{wJ zYHAWAJO&N?A{15iU5-h7(tEcjNsdrXxmb&8T~tY1O2FDl4xabw!Ga+I+Dh0TMz+9?;GG3H!|p8X z@5-FWDv_#&{-H)u)39VmGI5iCCHSkJ9q0EZwp2Ybjx-nIsMh>J>RrQWA>+End54K8IL=j{DT zS{XJew5hjgvPta&JttKETD0&JvE3-ZMumkZErzWcmciHHxosNHxCo?@D^cds6by}VTw?-%WtBL65z zGoEYhgPFz<50@j+8uc36n%Ej|iq<&yo%o#Z&^<~IsZ;1F&1nq2+82#4ny*Ex?qxs9 zeqf`q)Wl<rgML#i$h8aD+qs^L+d6r%K)se)$=ZLpVGd$^MuV|v@$K~(z zJ#{^}q(FWhv~Pk=(me0H;I%F!FSCHUFfOmsaxweMPyKcMnY_|GHO*LYOaZa*x*(xo zxuH_wWQBY|Zt1VAkLB<@uX~PRw&u~D5mL~T`(xT zhB+`XR5R2u%yPo4qt;)4sy8h(Z8J@se&GFD@qw}h#tfq#Z1g~_Q|FdWj@oiMpG87e zN@0_6jgF^<<}+b4=MtlW@sIUs^=O}RpQs}|_UiYc{VbmeKR;_`G7opF-d4e}22`ep zS!7$p%y|bto!8GOY1auE1YE6Lu~H5aOt*QM6`Ac=>Y3g%4@C#X?8PX?q_a9RsWb0L zZcAM`*jUHg3_Ezt!@rHrNYB^K9QaBpOC_1aOo@6{H?^D+?u+d+_8y>LCT&^zbicM) zw67Y=?p_MbOXQue9`l%f+$l6(Jnr=7-V1z*$4uz5q4EB4)>0jl_PVNCnn|{X)4uUR z*{P$qTcaLZzteul^mcEJZYKL2`s5sWoj*OtJIbLfrqqfcjOc#9{@$gVuN%g1Ucgh3 zqdoBXN!n@uR{y@3tk{NGe-n2(N4Z)#o|~jwmfM(H?CjX=joD|j_R1nk;{j>=4+GEq zw)fcn>hIb3%LMiXJoB&E-#+9z#XpCiD;)(n+b6DhIgaXGB$4E;Ij56MT zh_?Qg_ExPsyqn`)@W6q+ti+$C)+MK9I}@=|OsTz#x{pHOr{~>*%Ua)Ny3k!Zypz0} z+R55p8l@U(i_M6VCh>Tsg!TB9gv$gf-jK&6I*yuMdEfHWfA#Ff`(qq`I8Hf+uAQxg zt>rkojBlDq^&T(Ey|~L#8@Z$tO8xm?WI?35#qztoM=?Z&6hjw-4;M zEf3soaMp7+aSq&r@5}yI>u4 zPB~vj0eTk^run6+ygc3PI7|8JF&}4~?5ON^{j05&nUeYt5gSHxQCY!q0i@*@p{BE# zHMzw3plO=+=b59`Uf0?`wdeX5%_&0%!vOoeu7oB6WYh*8PY7K{&)GjM(o*?n2&{n)$9dxsK1HCuFCxZ^PB zR4D&eA=!Ty_WbGd`G#os)Kt1pk*O+dOYAJlY+j8GQ^ifEZAAN(M`xt;Xz_ zwQo4dxRkl))X{U|b-(FOM{=HD?!L@eR_15oHw_uQ$g2N5Y%vP){^j-4htKD|kD3of z`hm*Si0cgQDrYD*Lc1uvSV1(f`G9;;t0P6n-gBV;v!<$?r^@1mpN`hRB^eE)+aci* zrP)D~-)a1L9$Bzh})i*@%oB?)ab)gJ=a z|DH@tK>|2Jg3vJW1OUp8e;v~J!FdZDB=UkiQ6s_;;880=-7{0xL0L)+dw37-H@$@m z(K0;b?EX7(_?k}jKJqQiS1QK(QZBArl2haY&&Q{0hoqf5$L^P?N<_(M(naRyYxlvw z8pSnb_Q}fS@|a!$+|n{poD8OT4gv(aQ68A0|6Z=XzP_~Uv~)3k;~qUWMauqQ)^or_=jz_+ z>8VX6EjA2qVW}(X$B!SwQ#JNw8(Mq`c0ZG|zI}VduHf-T2vW`hlo*xiKYyO%J>?=R zEGK8|@9!TO6*ZEs99T%Z5DBTYAK*w#Ok^H^VP_{KC<8+_y1#y1{SrpzJ{$tQ)=qrpNx>=h6eOwNI5ldd3mXbylC|H z-=1yS+uN&d+3}qZ=7+7XuV;g%;bRvpy#3#c#cn6%v9N$Z<<)O0O3M8I-tIC;L*uPm z`=w9I`RK$1YXEV0c(}eGmL6)Q8x+)vJ5*Ly{?XT0cXh}qWf#4)v{XnZ0S#xTvf|0; zny+(4`)o}gqR%PF$yc)?II{H-h1J#Zp%SzZ30k5f>?^#0)8FXCjEstw?dIM}*W+zm zzXU1?m2PA4&|tW zo_w*&Ap%=lTl2}F0wf;eVJ9Yxkw~PX?{*qbQF*zxW|D}Wj!vv~dtsq~^4V$*oVd}# z6}ZLA&3(T>`?J2TZk$EXU$xZoHoF=Vut}!&!HE%FfPlETv9)y;^7_&@b&Hvq`IC~r z$7Ew^IMLA6Cm<{%BLcx?MMt5npL6i{H8d7}5rI~!oUPt+ovQBImK7Hle_?C8I$C4^2M~3@WP3=vtlO-EZ)!n7!FZ`j z&gdvyMovy@j&tELWN>semtNS&!O9A2ml_cfF&D5Qs-~{)d~xy@#3kJ16(o8ISY2Bi zs(#UX0OrV~^63P)MRGFJMl%@A`Ik^LUO?7;t~5WNFZIyP&CRsQBhTjfbBc}5&Q1~l zjGYB=)hO6qd}oI9G`HSEm}qFSGLUEQgn)@2!wr%~h40Gr4* zIgdPlQe)Sr9}?1T9qi^-9-oj<){DVlOk4e`DA^ScVv&QnxjZlI?WG>wM9^PuJi<;- zo2DjQrw4A|PP>Tzh(;gBf{rLIEJRG!P-DGGQS0kYsopv&r@7Xrz2fb){RhsmAoP6N zX@!}YH)EKWPt>QIJPUC3gupEX8G<()8N*0RYje`p-q2voD(h0|pV83JuriQQ(blFi zHZkEmR%{qA*2n(Tz#u0+o)%=iuPedN>Rt5i-Ge0Jr7eYCR#s6 zz&=Sk#;cqx;3*%D8brp#7&<$bc&DP#=5K}`Nt>TD-wX=K2^(W zCMGLuWMN?eCqvW&Olg}VdZ~9oDn2|MWPVj44b0BYy5!Rm?e3)Tm=Llq6c-nhvsR21 zVzKSFYo9pan!V$5FI(`kFffBHXzMWVXNaI)FEWNCT14zYND3)eEi z2WY1&IUeuFawt2oE1#^Sx{pUQOBJ#$h(K<_4Dz*xW}7^DVSffPChA>hT#o)89~)a( zq=SS-&&X&$$-uy{vP-%EhD<{naxD+dbOQjr5SJSrP0q{93yTN;Gc+}I@>LB92?0y@ z6g~^y(j+Nu`1<;mnKkL_s9x5Bm2fXv#Go{sqD*5ipqcUnM>Dcj_ATl;~V#d9_EHaYR(8y^0 z6%mK7lT-0_>%Ml&@n0GmnzLUCI$ld(NrEpACn6&whd~jL7#DXp5A{LbSk2ff+QW;0 zBTE=ng2UAp6sS{BP@FABaC#kWns|G8X*5f_TOkmYEG#T^EG$mGVh|wb7Xy}tii!$k z(>t3zAddZ+8CV(VZz;&+!NEc67Cbz}B0voK_1QC4L&#MWWC7&({{DXJ3{w1sY|tMa z9Ual9L>I<*H+gt$Cl@<_=r6$P`ntZ3&Vc1MBOP5X8Kamk^8yRgPz7Y*^PK|MnfjvY zYW=OPEe~JciG#I~#FP|ACJ`@(JAf;I6`(@Z*UKuOZ`Op{0|9}7hh2=8gp#E0+j)v@d$s$EUuN2sJ%D&8EFOg~N%0R}jLB9tY%oHj~>fk7lfor&@d~aHqgC zQ&YBnPQZ!|ADj4dZf0uAQR>}WFGpRyz>x?D6E9@fc;HGColeH2h%*Mo8JL@FveZx} z0*Hj$Y-9T@KQC{W9V(Xnj*ozhOky#RqW}={LtpZUh-eL{UbkA~t}f5LPj;>QQlujO zGizgG!=|zqI3IlMxG`R~cX%jM%iMZ(wgGaI9fQ>Z3(E&25E>fVw)=%_{Pq>?jT?!e z;wmyIFg<2vV$y}d-jR}#)!B5Bre=MCfKbMXDUT+Aas(`^MWv-$-Lag;wzjz-GN2xY zTUu7&5m7q)_$VkOBoyD?t~v&kS6O%Cx0?26s8)dd4;D~oE33Q9-(p5`VF}Xyd$vtY zO?m`ohS4Oe_{IQw|M++!luG6M5MkO+CQ8WvA&&o-W?l$j4x*(t{`Mrk$5zrrNLX0G z4;ykoiv1^y-xHbAx>88Y|K-X{P60nJH7 zK~z}7?U%7j0$~`&pD$V(yqhY)?VyBc=vHxQ5p8mmR0xE2q5cl{pvj6xw;-e(4v89E zqBsp_9U5G837)1;yz|t%^E@GX;aiUH_`T2j-uryt36fZ6Y+%jtpTK4q5LF0D*f%Lc ztAHv5RUtTF9{}(ZRtqMpR|>lzh+PVa04 zskmnv7_g76{XLA@9Yo_vM0d95zZ|4uxrU}e1z=j&c#+S{RKHXOR3TWaR>q2DNaYD# z!{I?3?;mFHJ|N-8g;UFOI~)L-tu6+((Fvc)nk3uhR$I~cV)c)q!tf-h3PR06eX z1pp9@C-L(7hHSBHfxA)f%L!E>c%IJy08Y}WaW(94H|l*?K!O3_>h=K%T|=|gwd`@D zerYF^$^k%&MNn@Tp40!e3*5pz zIiUiuoJ&!UzotE;d2vk>Uq%cnF)jiCuto+d3m&lr?K*T zEtf~EJY>RvJ6dtJSVk$A3I%R)Lg{j!=GWNOLQTN_4TJ&rbr}7*f5TrwrEebSRqC7o O0000{4$QK!pwj!!e&urng;lA_cifB$nv@EQ}Tw^n6AKPrz%tKBmw?5%!qQ)&9HIY->GFW!7nBqY7oHGT1E z&p!;0q}IBw7jW&r{8Ys(s{5SV^vO3ebgiUg{T{IkSifsb?>6DeiT>g6u`g7oHsK-j zQR}dcUm9EaMSu!SJ7ht6+l`nGH8ey#=CM!@3$B@VzEfhq)Z5@c#XtJ|i~XlhuHa2_ z&%UUAWMPk?lES+iGu)E96jlg+&z(Q(jAZ~b|1V2!d7yjNJH7!~+snlGaa*WQii`k9 zlT=}jsk=mIPtDx80_%65Z$JN^`j8oHZT1$iy@3h}UGZ(T-&Ee+ZprM~^YsPuy!By! zQmmf-%yRv8`}m&!FBG}uHGm%07Py|FTeaBXh(tl1;5SRTt9L#+h$`pX{%Ux>TJ-44 zo05zB<%1#0LGEyfS-kZ{FOzzh@x(%h2Nfa3$C-~>7Mwb;cJh3~**=xm)Z==X|5ttD zl#g8#@x$TbQo&R;j{@>r0M~k~f!JgGu zEW5*eUTmd+xk$xrEj1%PjyIkr3zN56K<}deO*~tEPPAh+j zW#@DO>!|KH#XOA->dDIlg(cZpnjYk>xLI7-5*T8*$*c44CEOb^J3^TR)(`)+vCs-U(4SH6!zg%Q41AV6^$J*zq!X*~Ue6AF}<{LjY!)0U=J&CydYWZei1MA1jn+&Ep0bR(lLZPwCne_^SyI4uT@XXt@Vnjx^O=7hr{&A zJDP4>jQYY=sG*$HquN!T>m+ccV-csQd99D{Gp*+m%h&u=`Yuu*_rHJ9Y0n%%V4$6I zYqgjnXn0KM{jHWH|3^V!hj^RLd?fRDis@1Doy&imuJQzBfNdS%l(hgFSkA0jN0zFE zyxDo<+uS)vFBJEE_Kh?C&b{wUHpr73T|x0K`Y7O7NaIX5k=|oDw3{7rIm(qi3ZE1mL()p1vGT;ZS8j0(i`offfd%QL7S$qYnxIEN&w>+ z1wsI=?TMHe_|X!hCY7X&nkYp{GzO!R5Po=xC>glAHPFxu zEbRlDHv@?RVAW+HwE##@2VQy}=v~O-ob{_cWqxJG66!8rApWqH`{~~!698Wa@A@4% z?~M8OF?JU4&nFdR8#&Ir2uYH(+UbiYrU915Gg68Fj#W4eYoa+8W%!$OO|w3qGaae; zA6WT^$2NwQw}w+Jz6Aoek~BU?ZTHW$CO-!U`G3OFjL*Lv*Kx~pL{?IkI;EHNUi$m> zm`jdD#6_kj(wR>0%C_!}nbwvL?~1OL*0yfRD5_bW;eMh0i&)@E^(!&Ra0+ z=FPgjK1sjv)HwF2#dYoK@ldG|`O4W!+D9%pwaDLUFcee^V`&wS&Q=}a8D-^P>XbX_ zmlBqhb5>QkzpnN2tJI1ZS92m6yCmYDU_@UVQz~gJjUIGr(GTrmv&N-PRTrvHs}34w zcGECN@^y`wdoWrvf6UdqZ^V9Z_LF6=tm%QGTtTlsq*VR|jM zWrLYj0j<|Q2-N*VO?A~=wlCD2ch7Gu)+saSr436PWe1CCt)N)c0B+ zpw}yt;^$y3=aw#T#vWt*iI0J{WA^8deo$DEKCa^j=tG3}N&mvn#FOM{XDs6eHVpzh zE{bmVw|`P#ztFX|*y!==#98zLoAk(o64P4GDtp?CyWO3=XGdjuu?5NPqdW90*(JiL zF0sC5;MEP}6<|M)`2Ad%0WRFYdf*K{{5P32cnNr$8{p6bBubW%)udB8+3VFiF8fID H-jaU-Q`T^h delta 1403 zcmbu9S!_&E7{~v2Mna>lH8duvR+C#x6f@I1T}C@DQ(dD|l!i!zX(~jm5la-=^% z*ejGOsRZR(g4iMGn=5SD_&N4bl&A*Ky73toiUn$GI?RL$3OMEdhMh~?$ zTvESkqfF~(q;0t5^#C;GUYI zuXe4d+wzx;cIYK?h|)%oL4^HF+)|(^t;Dppm)+6K(pZm-1N1WqbIV+O6EBh5_E;I; z#_~Jl8BobH8#+wRSz9Y+^w+ESHpNYz5Oqqbj@h-UcI)GumrlKUi_(+mC0w&QYS*e; ztatN&I*giTrE}_XH)U=OzaC*eTbN&qxT#pp3t-VUU`eBuyzq9SQM*^gTj>qL+FG96 z2)_Ukk3CjDErOQ|}0XQ_7Q~}2ykxrn6vunu$+PMF1_kar*31@%#Gx^0H1Br`F Uke#j`taDyHculkFj%2z10-ZMzrvLx| diff --git a/resources/mods/ee3/textures/xcf/gui/base_gui.xcf b/resources/assets/ee3/textures/xcf/gui/base_gui.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/gui/base_gui.xcf rename to resources/assets/ee3/textures/xcf/gui/base_gui.xcf diff --git a/resources/mods/ee3/textures/xcf/gui/calcinator.xcf b/resources/assets/ee3/textures/xcf/gui/calcinator.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/gui/calcinator.xcf rename to resources/assets/ee3/textures/xcf/gui/calcinator.xcf diff --git a/resources/mods/ee3/textures/xcf/gui/glassBell.xcf b/resources/assets/ee3/textures/xcf/gui/glassBell.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/gui/glassBell.xcf rename to resources/assets/ee3/textures/xcf/gui/glassBell.xcf diff --git a/resources/assets/ee3/textures/xcf/gui/ocarina.xcf b/resources/assets/ee3/textures/xcf/gui/ocarina.xcf new file mode 100644 index 0000000000000000000000000000000000000000..d601a6c2fe0f61df3064295dca93f9f8d95efd8c GIT binary patch literal 15138 zcmeHN2V9g#)8FSRy&YZ3p>(B*bP*6yuml^ZM5A~da7yz4L8BfTV`51(Mv1);8|rII zEHSoNP!nTsQInv?SQD|Jz?J=GjypW?ByaNNP4a%9`}@uF%*@X2vpZY`0|SEzA&iFLMTjK|sIdYv0urHMi4OsgLD&61x*-8?4a5P82eQ@hXlFx+=_Yua zNJJvP0%?AxBu5M)VS_3WskbCApJhQvZeEeJe~+%h!9&u7{F8)53<-|}5t1${Ea)?! z`#>y|ln^g01S8}%3BK{{qPo@OoL^#Jp-`LgZ@w)>1=1quWnZul&JY)hfS(F{PDxP# z>T7_v9yuC$7WU6t3JnC_9{H?BzJuDPk&i__BR4MtY_QD*8MztA9|r#YvBhHG*}Z|E zHdZ1o0scJj?m5M|65#8Ax6T!(7lJEIP+ue#Wdk1wyoq#RfAB4*Gq~L(ONSq+!xxE5 zp`9=Y`32*olC10^p|{9K7!(l^E=&}cg1?hR?2x;symLgW@ zTOl|(G$`m<5?4#^+>}vJ{c0Gs35paYYKTZ@Uk(0s^amH{aab|HAan^Bma1L|M zajtV}I4Z6w*NNMn8_7-L4(4WYOSsdx<=i#g?c5{W3*1}WXFMLymgmI_<0bNj@J8|8 z=FQ?Qb4W8`qmynfRK-n+!E6Hu=zGt;qqC z?@XSUnwol=#+s&?7MXr%T4{R7^as;AGl7}ES&~_Xnapgl*$%U_X1|&nntPbXnZIQ| z-n`uWGxJmC4=fBVJT2la(k&)gEVlT<;*v$JrNA=CGTAcMa+c+K%j1@JtoT-*RtZ)a zR#UA$wK`;VQ@|Fq6T}Ndf_DU~1V;q7ta;X6)=Ac*tY=#P%lf2sjg6H}C!188Qk%s# zdu^(1*|wgxNwzt*vu(H8UbJnnbGD1K6WdL<+hljv?zw#%`&fIi{S5of_806M9E1)D z4x=4Da@gtcy(7ob*Rh{tiQ_WIBaRQ+ShtC4BWg3F&9*jIoLEl2PW_$UcKX!mgj21v zi*pa>0_TO!hnyd{*t*2JjB=Uhvd`tNtH8C3tHgDl>wedJLK|V6Fh{sRcvx8D=H!;> zR_wOY?WCK$tykNWwo}?}Zu@;Zqjur#GTY5-cd%WJyQ_O2_X+MB+^={TdW3sqdwk+? z)Z@9Qm**hQ_dIuc-tn^cO7a@-wZZF}x2boG_ZaUA@AE!9pKzbiK1+R0`?7pPe6xKQ z`<`mgY9HEO(tc_CGaa}cB0A)CsOWIX&%`gzZ>--2zw7?C{=NOD`0w=pHNZU}E#RYo zqXDYGkieY4Re@K7tb%$5O$pi^^thvMM^VSc9nS}w26qpZ1@8)e)Twg}axg?08Wt)I-4uE^%sp&G*pjeI;nv}O!)Jvbi{M6djgUp`iKveZjVy}X7WpvB zFKTqu`lvgdy*i6Kuj+g=x@~lN^vdY!F2XJ&x~%9@9pe_09#au>Beq>^M(mo{+i^Z| zqvAHk{n|CKtF-I(uFvBm<0r-+=*I5WquY#bCljm^QW6#={LsB^_pI(4y4Umw>G5`t z1Bu+kUWp$iUP^LK5+zk8)$|POIkD&AUM9T;^jg&GMsMHV(%!rKu=@1u^KqYRZ+N_s z_r}g-lAM(Maq{9FH(Ilh(i*52Xf!_$XGdgo_=AEqQtdFzqX2)cgXFrg{OBP8UjY=G~eAM&N$)nefra6OhHs>1T zj>!EY&njx_6;zLj95a7RjkK3^O(9b_tZ-M6H3U;9ioJ{9Extas z%h<(Z>q=5fJ}b2>%_}`I&Uf7Oaks~JAHVu-&fB854^D8KFnPlDiE$HGPGTmFoODpu zPBv9`tE@-ay2(b9M^FBCO5l{aQ=Yyv=$+kDou`&fz4>mBcQ;HknAk4;mcP$= zU-JIR>A}+%PFKyynDO<@z?tPU6|+RMzWyNSg9RVZ4>LbJIXiUrvN^mtd2=p)6!X!# zxt4Rs&%OC^pO1IU6V974@9F&E^N*KzDqsGI(I>^9R4?egVAn$Tg>x1v7G*EGu(<2u z%}bn?OkeVRX~xpC%VL*pTJF4j=JJLWk`2!n30MQ{JazKmB=C>Z+rw!&g_X zaa=QVjdE??+Uj-v*B!15tE^n_w0`ym)`sE@cQ+2*c=})6{wDZ8y){Lbeod zxwm!1){EPEZ9Di`_-C6w_xOCtcER=;JD45gcGT?5-dVkC$gVSA^!(!B?x@|{zx4ld z?H;#1i}%{>oxRU!-_(6{|M>m22MP{6_$uqGn+Jy^d|ILLrE}XfTa`Ez|p_i&JXI#GXUCwupu8h4Rzgl*Udu_(|7T=fu;PgYq zk3K(ct`4oNtWS-i1Zu za>T;I{2WP!kCAs~7KUO{2#oRNC(Rm}E)4V!R3|-5kS5CqijLG%RGTk+HG@S$25)ad+*^CU$OtBJD3g;+j6GqX@!)YL#M{j#c2)4VA9!BXe!<(HS9t37}b zo4(okMfru<`31tH_;{ht@eGR*V%7r=1#KXdbAf}24;WToct+4OzkdM9jG$Uwr|44B{QgzF4%A8<|E z4a|nKW2#tMBoU?O2pdR_Ml#R$YavC)Uk>`d#P`QI^BTuEp=beYm(JH4WsQ2 zyscEtbpkV#W#oV^;Z~(B^J*8UZ%K4rfTk?04$@!c3f%Qx469PT)S9u`{z9jn+U|gCCxnCDi2G{0$IU4n*)l5eU#oe zL)n9t!&ctFen#mySm}zPbQQ{8ls+^=c_&>BvOJN}c_7M#O1c2$Hz^H5c?G4VAS)#F zDu@liN=gSd%H>ddy}@}(6;^;7G1QtUded-dqDln4QN0DNP;{cM&bE9`H5dCo2rV@V~Z(=Dz`A`t`cO= z8Y5eV>~$w}8#5dEpWI1XXpIF?y@%p2{%BQ7xm2|VxqMJ6YQ~+y0&ggw@`lHej!zh9 znX>(35bJBB33=!YT~r#J16f%ci#<5f4K%9RsHjiCVOTPX1Q2Bh1-4c7CJsd5T+pb# z1QXR{aMkl+XJzv~o|tL@my)V*EV!2q1r>>VRM-UhHeZN(W2ga9TFKEFsrVV*UTQ*> z>v_-xRSIf%p+7&RW;nQ@TZ%etkg6~ANdEZT4Fz^m)fF&6bp+?YHFY&VfZel)r4zTp zuP_4+V3Ura#ci~}d8JAQgNARNNc1^u`iOe0H--p_st!%k&}21mbr)e_**;^yNR^5< za4e{{#gHqd3&R?N7LCby7l3nucX6eb*eqpAy9BtRw5kfWF_#B3F% zshGVy9kP{NtQzw1+p0j!|B2FQ%rBh^SG}s8pto0hP1O!fCZkDDO4S44dj?HPLEo0h zPg8mf-Myb~hvEwE6E@T@pG4_%a74opN|nx7*8V0<#_F%QV|E3ldoY`QnbKk?EqA~6 zC;+?nSsyTJU~W)47>1#tvx43>!+hI~j|W3F%9$mYA5H0xJh+9HPp5PacE`>JGc#5| zrhFHrNyHuMuB3E0L`}+QY@d86rSpj=Y2a<8iX7O&YHgkZa7I3%TiC>l)H4&6w6YB# z$n#&^$)HDc4wv|ny6{8v>EdV}R9k;!#%_A5hk7arNUdR{-B%O(J&>|QL z-Aziyi3R7$SY`U3q>RXnbcppe@u4zimEPw7BIAIqhT0Hi@NWF3#djo{DDSY5Kjwzd z)$y={DNXTbJ>~Qvutw_a7yU%*HaMV%#tkF>u;Jar^-*mD9a5G`Km&6b7A)>C%BdsZ zPG1#Cc~tq3!LeA|0~O;bpQ@}-zUF}Pd^CXTa`1QHMXaF=6sl!tu(}lGIH*y1SpWu# zH-0w7ud)x}SGTEEU4H2b3%p+VJ*8XXz(&q0xRVI&ermfydFS08NfVBLUOyrj$ zlHBuw-~5}96Icy$0@s9`V62Or<}HxZ>?PzhYl)nuFCnL?UgYGx3ONBuDgjB9_Z@IO z8_riz1Ax@`Ss=Xxrwst7q&b+%XAzLKR7-Icy$jUY-|g-~ea zDEYgD3CPy7fs6EKprUbyOoNA9i`CCbClF z9^?S-0R{r@0S~wbPryA39o#c*iF+n5;hsqg+%s;8d!T5BdmuN*J*c4>?t$C__u#87 zanI}}+_Pwodx96ZhnKM6mKV5&2Pi)v#38Qs1gO0fK_${(1!8ytYzw6CB#2kWn&hFq zq|r7WK+FT$?6D5$bB&QE&m$CcLxHBCUS=HIM6Co;|DF|pBmiS0y*kW-k75{sf33pg z3#7TU);d@1VdJjw|DG&qelh+5>9-w@Hh)Icfc0R~=Wwl)A=^{^gFxe4z-B|_M?7Z} z5@iIW>6*4Xo>$>263TXPCnRV-&}u?L9uN`=|GbJE4>SX45fBVev6jYp@t+BuEoPB|Nk8|yQ_s8 zIlZv^TKT_?=;6nWs+6b{7U`TKW5>Ss@_*)R^xDh+8NW7P|1G>MGl^|H`(mI66P(K6 z4*{U8f>=*I*& z60CR$9%1$s3mNA2J9lOjmEPpc`Mz_`y>tByT6XuFdDm>4ZM)MVEHet$I|w20$RIY( ze-d$EWf2KP60sL)p4-LzIr0Y!#}@2v!)g_*8~X|+LSN9)z`5_V%)xcXzB=AIYFo|g z&h?FXq*LL>x@?%mlcHWLL@8<=W9#LLt#RM{zu>KRgKv$d-LuS6{4NylR~4gL;kIWx zrrm3PZ4G$;b-O)iIZqel-ET`_<>gl9khB`zZX+T>+2YCR+3DF?_&4ikiF?r!zhi}L zMgfwP{CwMM*brp!1B<@}e-nk+h%`@bMjDAeE$OW#y}hL0E$P&feh&$q^`F?d-sez5;ezm$+cS{)$yN=o$+Vy>pLBGoSBY^tV3=q&W(RB;0? z4Hrz6P;+>P{X&kEp=NB+-&yv$FXV$WosQ7vep>yNBS*3oP7r!$gbMqG9th+}jC@=p zoXDs@a)kLxvB(ExlrNoP#i;Ovc6|wF$SmI6mkGJYH;_UetjPVS&Us(0A$&fYhv(ST zm!L71{R(ItDnni+SLfoARwX|em+2i;{^fHn_P?PoPh}8^VvK+$8e1p5!LYT!ieYvA}>bdjVT`? z8hhguv_>@cxB;gTjXmMb;j1Ac*E75sTl5*xlh=J9s*cAl+T3SEZk5=IYJ{ljqQZWm z2Lf`1>*E^X1S4`WpHHRu07g_z<&8W~Xjdk<5K%coR2l4_6E)h=zS3~eE{RT{xL_MEdiHjz2ju_vJpUd2AG;k-3n=d*Ko#|8ZZ DtAFiE literal 0 HcmV?d00001 diff --git a/resources/mods/ee3/textures/xcf/items/ocarina.xcf b/resources/assets/ee3/textures/xcf/items/ocarina.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/ocarina.xcf rename to resources/assets/ee3/textures/xcf/items/ocarina.xcf diff --git a/resources/mods/ee3/textures/xcf/items/shardMinium.xcf b/resources/assets/ee3/textures/xcf/items/shardMinium.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/shardMinium.xcf rename to resources/assets/ee3/textures/xcf/items/shardMinium.xcf diff --git a/resources/mods/ee3/textures/xcf/items/spear1.xcf b/resources/assets/ee3/textures/xcf/items/spear1.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/spear1.xcf rename to resources/assets/ee3/textures/xcf/items/spear1.xcf diff --git a/resources/mods/ee3/textures/xcf/items/spear2.xcf b/resources/assets/ee3/textures/xcf/items/spear2.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/spear2.xcf rename to resources/assets/ee3/textures/xcf/items/spear2.xcf diff --git a/resources/mods/ee3/textures/xcf/items/spear3.xcf b/resources/assets/ee3/textures/xcf/items/spear3.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/spear3.xcf rename to resources/assets/ee3/textures/xcf/items/spear3.xcf diff --git a/resources/mods/ee3/textures/xcf/items/spear4.xcf b/resources/assets/ee3/textures/xcf/items/spear4.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/spear4.xcf rename to resources/assets/ee3/textures/xcf/items/spear4.xcf diff --git a/resources/mods/ee3/textures/xcf/items/staff1.xcf b/resources/assets/ee3/textures/xcf/items/staff1.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/staff1.xcf rename to resources/assets/ee3/textures/xcf/items/staff1.xcf diff --git a/resources/mods/ee3/textures/xcf/items/staff2.xcf b/resources/assets/ee3/textures/xcf/items/staff2.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/staff2.xcf rename to resources/assets/ee3/textures/xcf/items/staff2.xcf diff --git a/resources/mods/ee3/textures/xcf/items/staff3.xcf b/resources/assets/ee3/textures/xcf/items/staff3.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/staff3.xcf rename to resources/assets/ee3/textures/xcf/items/staff3.xcf diff --git a/resources/mods/ee3/textures/xcf/items/staff4.xcf b/resources/assets/ee3/textures/xcf/items/staff4.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/staff4.xcf rename to resources/assets/ee3/textures/xcf/items/staff4.xcf diff --git a/resources/mods/ee3/textures/xcf/items/staff5.xcf b/resources/assets/ee3/textures/xcf/items/staff5.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/staff5.xcf rename to resources/assets/ee3/textures/xcf/items/staff5.xcf diff --git a/resources/mods/ee3/textures/xcf/items/staff6.xcf b/resources/assets/ee3/textures/xcf/items/staff6.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/staff6.xcf rename to resources/assets/ee3/textures/xcf/items/staff6.xcf diff --git a/resources/mods/ee3/textures/xcf/items/stoneEffectFlame.xcf b/resources/assets/ee3/textures/xcf/items/stoneEffectFlame.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/stoneEffectFlame.xcf rename to resources/assets/ee3/textures/xcf/items/stoneEffectFlame.xcf diff --git a/resources/mods/ee3/textures/xcf/items/stoneInert.xcf b/resources/assets/ee3/textures/xcf/items/stoneInert.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/stoneInert.xcf rename to resources/assets/ee3/textures/xcf/items/stoneInert.xcf diff --git a/resources/mods/ee3/textures/xcf/items/stoneMinium.xcf b/resources/assets/ee3/textures/xcf/items/stoneMinium.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/stoneMinium.xcf rename to resources/assets/ee3/textures/xcf/items/stoneMinium.xcf diff --git a/resources/mods/ee3/textures/xcf/items/stonePhilosophers.xcf b/resources/assets/ee3/textures/xcf/items/stonePhilosophers.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/items/stonePhilosophers.xcf rename to resources/assets/ee3/textures/xcf/items/stonePhilosophers.xcf diff --git a/resources/mods/ee3/textures/xcf/logo/logo.xcf b/resources/assets/ee3/textures/xcf/logo/logo.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/logo/logo.xcf rename to resources/assets/ee3/textures/xcf/logo/logo.xcf diff --git a/resources/mods/ee3/textures/xcf/models/alchemicalChest.xcf b/resources/assets/ee3/textures/xcf/models/alchemicalChest.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/models/alchemicalChest.xcf rename to resources/assets/ee3/textures/xcf/models/alchemicalChest.xcf diff --git a/resources/mods/ee3/textures/xcf/models/aludel.xcf b/resources/assets/ee3/textures/xcf/models/aludel.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/models/aludel.xcf rename to resources/assets/ee3/textures/xcf/models/aludel.xcf diff --git a/resources/mods/ee3/textures/xcf/models/calcinator.xcf b/resources/assets/ee3/textures/xcf/models/calcinator.xcf similarity index 100% rename from resources/mods/ee3/textures/xcf/models/calcinator.xcf rename to resources/assets/ee3/textures/xcf/models/calcinator.xcf diff --git a/resources/mods/ee3/lang/pl_PL.xml b/resources/mods/ee3/lang/pl_PL.xml deleted file mode 100644 index 4d5754f2..00000000 --- a/resources/mods/ee3/lang/pl_PL.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Polish (pl_PL) Localization File - - Dodatkowa funkcja - Wypuść - Przełącz - Ładuj - Odłam Minium - Nieaktywny Kamień - Minium - Kamień Filozoficzny - Popiół - Proszek Minium - Zielony Proszek - Lazurowy Proszek - Amarantowy Proszek - Opalowy Proszek - Torba Alchemiczna - Czerwona Woda (Stojąca) - Czerwona Woda (Płynąca) - Kalcynator - Kalcynator - Equivalent Exchange 3 - Inicjowanie sprawdzania wersji względem zdalnego pliku autoryzacji, umieszczonego na - Wystąpił błąd podczas sprawdzania wersji - Posiadasz aktualnie najnowszą wersję (@REMOTE_MOD_VERSION@) Equivalent Exchange 3 dla @MINECRAFT_VERSION@ - Istnieje nowsza wersja @MOD_NAME@ (@REMOTE_MOD_VERSION@) dla @MINECRAFT_VERSION@. Pobierz stąd: @MOD_UPDATE_LOCATION@ - Wystąpił błąd podczas łaczenia ze zdalnym plikiem wersji - Zdalne sprawdzanie wersji wyłączone, pomijanie - \ No newline at end of file diff --git a/resources/mods/ee3/lang/pt_BR.xml b/resources/mods/ee3/lang/pt_BR.xml deleted file mode 100644 index 66c1b6f0..00000000 --- a/resources/mods/ee3/lang/pt_BR.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - Brazilian Portuguese (pt_BR) Localization File - - Extra - Liberar - Alternar - Carregar - Fragmento de Minium - Pedra Inerte - Pedra de Minium - Pedra Filosofal - Cinzas - Pó de Minium - Pó Verdejante - Pó Índigo - Pó Amarantino - Pó Iridescente - Bolsa Alquímica - Água Vermelha (Parada) - Água Vermelha (Corrente) - Calcinador - Calcinador - Equivalent Exchange 3 - Inicializando checagem de versão remota contra a versão remota mestre, localizada em: - Checagem de versão remota não conseguiu ser inicializada adequadamente - Usando a versão mais recente(@REMOTE_MOD_VERSION@) de Equivalent Exchange 3 para @MINECRAFT_VERSION@ - Uma nova versão de @MOD_NAME@ existe (@REMOTE_MOD_VERSION@) para @MINECRAFT_VERSION@. Consiga-a aqui: @MOD_UPDATE_LOCATION@ - Erro checando a versão remota mestre - \ No newline at end of file diff --git a/resources/mods/ee3/lang/sr_RS.xml b/resources/mods/ee3/lang/sr_RS.xml deleted file mode 100644 index fca078b6..00000000 --- a/resources/mods/ee3/lang/sr_RS.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - Serbian (sr_RS) Localization File - - Екстра - Одпустити - Клин - Напунити - Делић од Миниум - Инерт Камен - Миниум Камен - Философ'сКи Камен - Пепео - Minium Прашина - Зелена Прашина - Плава Пашина - Неувенљива Прашина - Преливач боја Прашина - Црвена Вода (Извор) - Црвена Вода (Текућа) - Цалцинатор - Цалцинатор - Equivalent Exchange 3 - Покретање верзије провера према приступу удаљеним фајловима верзије ауторитета, који се налази у - Провера Верзије није успешно завршена (верзија провере није покренута правилно) - Ви тренутно користите најновију верзинју (@REMOTE_MOD_VERSION@) од Исте Замене 3 за @MINECRAFT_VERSION@ - Нова @MOD_NAME@ верзија постоји (@REMOTE_MOD_VERSION@) за @MINECRAFT_VERSION@. Узмите овде: @MOD_UPDATE_LOCATION@ - Грешка у повезивању удаљене верзије ауторетета податка (Погледајте вашу конекцију?) - Провера верзије је искључено, Прескочено - \ No newline at end of file diff --git a/resources/mods/ee3/textures/items/shardMinium.png b/resources/mods/ee3/textures/items/shardMinium.png deleted file mode 100644 index eb83f02e0b61a5a43b1628f98d43f3ea62b2418b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 404 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;RN#5=* z4F5rJ!QSPQfg+p*9+AZi4BWyX%*Zfnjs#GUy~NYkmHjR=i;$q4%pt|y3=E8do-U3d z7N^%v-tBkTK%&+D_Cnvi4HJwEQdev$KXZmV#pTtpW3x-r(%fI2s5UTAa+Nenf60=m zXvSQavecKUWAlwof8^(O^ZxI2X)~L+u(Y~fw&_c|^1_Z5rHKoDr>ad{xYu&GgevDR zc5ln)QRf&=G!-*!d$UaR$uhC2xf*BW8m7i9xGp)JU;17Cd$!PyI<}RUjuaj9(%Yx1 zm&`ElbNDuS>!RT9i##%MXRI0KyWZ54+G@bE_nejL?4MUBPEF`~@b+V;{M8o^oWA7# zcyV3ohwg=E0kfD3qf_TEF=1EJ{h=i@QCjcJJP(Zt3(xxM9$EQZhSN1wI%ui?r0{Jo wU)cmbShGcZSC;ne2iN~R=QsPhv#wWv=gwTQzq#UG!0=-5boFyt=akR{00?WK3;+NC diff --git a/version.xml b/version.xml index 60cb0021..11759920 100644 --- a/version.xml +++ b/version.xml @@ -8,4 +8,5 @@ pre1e|http://goo.gl/Ria2V pre1f|http://goo.gl/Ria2V pre1g|http://goo.gl/Ria2V + pre1h|http://goo.gl/Ria2V From 1b0512cf9c0d63eac6ec048df5df91cbe4c0319b Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Fri, 2 Aug 2013 04:29:38 +0200 Subject: [PATCH 06/16] Small fix for readability --- .../ee3/core/handlers/TransmutationTargetOverlayHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java index 11afbf0e..9498f1e9 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java @@ -81,7 +81,7 @@ public class TransmutationTargetOverlayHandler implements ITickHandler { GL11.glPushMatrix(); ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight); - GL11.glClear(256); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); From 3ca518e51871d0b654af620ba9dca7335414a947 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 16:31:02 +0200 Subject: [PATCH 07/16] Properly Merged --- .../core/handlers/InterModCommsHandler.java | 98 ---- .../pahimar/ee3/core/util/EnergyStack.java | 49 -- .../pahimar/ee3/core/util/GeneralHelper.java | 55 -- .../com/pahimar/ee3/core/util/ItemUtil.java | 204 ------- .../pahimar/ee3/core/util/KeyBindingUtil.java | 65 --- .../ee3/core/util/LocalizationUtil.java | 46 -- .../com/pahimar/ee3/core/util/LogHelper.java | 72 --- .../com/pahimar/ee3/core/util/OreStack.java | 97 ---- .../pahimar/ee3/core/util/QualityHelper.java | 40 -- .../pahimar/ee3/core/util/RecipeHelper.java | 175 ------ .../ee3/core/util/ResourceLocationHelper.java | 13 - .../ee3/core/util/TransmutationHelper.java | 146 ----- .../pahimar/ee3/core/util/VersionHelper.java | 224 -------- ee3_common/com/pahimar/ee3/emc/DynEMC.java | 161 ------ .../com/pahimar/ee3/emc/EmcBlackList.java | 119 ---- .../com/pahimar/ee3/emc/EmcComponent.java | 46 -- .../com/pahimar/ee3/emc/EmcDefaultValues.java | 15 - ee3_common/com/pahimar/ee3/emc/EmcMap.java | 37 -- ee3_common/com/pahimar/ee3/emc/EmcType.java | 5 - ee3_common/com/pahimar/ee3/emc/EmcValue.java | 161 ------ .../com/pahimar/ee3/emc/EquivalencyGroup.java | 113 ---- .../ee3/emc/graph/WeightedDirectedGraph.java | 272 ---------- .../pahimar/ee3/emc/graph/WeightedEdge.java | 55 -- .../pahimar/ee3/item/CustomWrappedStack.java | 290 ---------- .../ee3/item/crafting/RecipeRegistry.java | 301 ----------- .../ee3/item/crafting/RecipesPotions.java | 292 ---------- .../ee3/item/crafting/RecipesSmelting.java | 48 -- .../ee3/item/crafting/RecipesVanilla.java | 49 -- .../com/pahimar/ee3/lib/InterModComms.java | 14 - ee3_common/com/pahimar/ee3/nbt/NBTHelper.java | 508 ------------------ .../packet/PacketTileWithItemUpdate.java | 78 --- 31 files changed, 3848 deletions(-) delete mode 100644 ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/EnergyStack.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/ItemUtil.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/LogHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/OreStack.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/QualityHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/core/util/VersionHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/DynEMC.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EmcBlackList.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EmcComponent.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EmcMap.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EmcType.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EmcValue.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java delete mode 100644 ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java delete mode 100644 ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java delete mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java delete mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java delete mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java delete mode 100644 ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java delete mode 100644 ee3_common/com/pahimar/ee3/lib/InterModComms.java delete mode 100644 ee3_common/com/pahimar/ee3/nbt/NBTHelper.java delete mode 100644 ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java diff --git a/ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java deleted file mode 100644 index 4c137770..00000000 --- a/ee3_common/com/pahimar/ee3/core/handlers/InterModCommsHandler.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.pahimar.ee3.core.handlers; - -import java.util.List; -import java.util.Map; - -import net.minecraft.nbt.NBTTagCompound; - -import com.pahimar.ee3.core.util.LogHelper; -import com.pahimar.ee3.emc.EmcBlackList; -import com.pahimar.ee3.item.CustomWrappedStack; -import com.pahimar.ee3.item.crafting.RecipeRegistry; -import com.pahimar.ee3.lib.InterModComms; -import com.pahimar.ee3.nbt.NBTHelper; - -import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; -import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; - -public class InterModCommsHandler { - - public static void processIMCMessages(IMCEvent event) { - - for (IMCMessage imcMessage : event.getMessages()) { - - if (imcMessage.getMessageType() == NBTTagCompound.class) { - - if (imcMessage.key.equalsIgnoreCase(InterModComms.ADD_RECIPE)) { - processAddRecipeMessage(imcMessage); - } - else if (imcMessage.key.equalsIgnoreCase(InterModComms.ADD_BLACKLIST_ENTRY)) { - processAddBlackListMessage(imcMessage); - } - else if (imcMessage.key.equalsIgnoreCase(InterModComms.REMOVE_BLACKLIST_ENTRY)) { - processRemoveBlackListMessage(imcMessage); - } - else if (imcMessage.key.equalsIgnoreCase(InterModComms.SET_EMC_VALUE)) { - processSetEmcValueMessage(imcMessage); - } - } - else { - LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' sent a message with key '" + imcMessage.key + "' with an invalid argument type (received " + imcMessage.getMessageType().getSimpleName() + ", expected NBTTagCompound)"); - } - } - } - - private static void processAddRecipeMessage(IMCMessage imcMessage) { - - NBTTagCompound encodedRecipe = imcMessage.getNBTValue(); - - Map> decodedRecipe = NBTHelper.decodeRecipeFromNBT(encodedRecipe); - - if (!decodedRecipe.isEmpty()) { - for (CustomWrappedStack key : decodedRecipe.keySet()) { - RecipeRegistry.getInstance().addRecipe(key, decodedRecipe.get(key)); - LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' added recipe with output '" + key.toString() + "' and inputs '" + decodedRecipe.get(key) + "'"); - } - } - else { - LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempting to add a NBT encoded recipe to the recipe registry, but the encoded recipe is invalid"); - } - } - - private static void processAddBlackListMessage(IMCMessage imcMessage) { - - NBTTagCompound encodedStack = imcMessage.getNBTValue(); - - CustomWrappedStack decodedStack = NBTHelper.decodeStackFromNBT(encodedStack); - - if (decodedStack != null) { - if (EmcBlackList.getInstance().add(decodedStack)) { - LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' added object '" + decodedStack.toString() + "' to the EMC blacklist"); - } - else { - LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempted to add an object to the EMC blacklist that already existed"); - } - } - } - - private static void processRemoveBlackListMessage(IMCMessage imcMessage) { - - NBTTagCompound encodedStack = imcMessage.getNBTValue(); - - CustomWrappedStack decodedStack = NBTHelper.decodeStackFromNBT(encodedStack); - - if (decodedStack != null) { - if (EmcBlackList.getInstance().remove(decodedStack)) { - LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' removed object '" + decodedStack.toString() + "' from the EMC blacklist"); - } - else { - LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempted to remove an object to the EMC blacklist that was not present"); - } - } - } - - private static void processSetEmcValueMessage(IMCMessage imcMessage) { - - // TODO Set an EMC Value via IMC - } -} diff --git a/ee3_common/com/pahimar/ee3/core/util/EnergyStack.java b/ee3_common/com/pahimar/ee3/core/util/EnergyStack.java deleted file mode 100644 index dc1c46ff..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/EnergyStack.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.pahimar.ee3.core.util; - -public class EnergyStack { - - public static final String VANILLA_SMELTING_ENERGY_NAME = "vanillaFuelValueUnits"; - public static final int VANILLA_SMELTING_ENERGY_THRESHOLD = 200; - - public String energyName; - public int stackSize; - - public EnergyStack(String energyName, int stackSize) { - - this.energyName = energyName; - this.stackSize = stackSize; - } - - public EnergyStack() { - - this("", 0); - } - - public EnergyStack(String energyName) { - - this(energyName, 1); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyName)); - - return stringBuilder.toString(); - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof EnergyStack)) { - return false; - } - - EnergyStack energyStack = (EnergyStack) object; - - return (this.stackSize == energyStack.stackSize && this.energyName.equalsIgnoreCase(energyStack.energyName)); - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java b/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java deleted file mode 100644 index fc3cb7c0..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.monster.IMob; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - * - * GeneralHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class GeneralHelper { - - public static ItemStack convertObjectToItemStack(Object obj) { - - if (obj instanceof Item) - return new ItemStack((Item) obj); - else if (obj instanceof Block) - return new ItemStack((Block) obj); - else if (obj instanceof ItemStack) - return (ItemStack) obj; - else - return null; - } - - public static Object[] convertSingleStackToPluralStacks(ItemStack stack) { - - ArrayList list = new ArrayList(); - ItemStack currentStack; - - for (int i = 0; i < stack.stackSize; i++) { - currentStack = new ItemStack(stack.itemID, 1, stack.getItemDamage()); - list.add(currentStack); - } - - return list.toArray(); - } - - public static boolean isHostileEntity(EntityLivingBase entity) { - - if (entity instanceof IMob) - return true; - else - return false; - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/util/ItemUtil.java b/ee3_common/com/pahimar/ee3/core/util/ItemUtil.java deleted file mode 100644 index d9b4f22d..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/ItemUtil.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.pahimar.ee3.core.util; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.oredict.OreDictionary; - -import com.pahimar.ee3.item.ModItems; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.nbt.NBTHelper; - -/** - * Equivalent-Exchange-3 - * - * ItemDropHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class ItemUtil { - - private static double rand; - - public static String toString(ItemStack itemStack) { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append("ItemStack("); - - if (itemStack != null) { - - stringBuilder.append(String.format("%s", encodeItemStackAsString(itemStack))); - - if (itemStack.hasTagCompound()) { - stringBuilder.append(String.format("%s%s", Strings.TOKEN_DELIMITER, NBTHelper.encodeNBTAsString((itemStack.getTagCompound())))); - } - } - else { - stringBuilder.append("null"); - } - - stringBuilder.append(")"); - - return stringBuilder.toString(); - } - - public static String encodeItemStackAsString(ItemStack itemStack) { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("%s%s%s", itemStack.itemID, Strings.TOKEN_DELIMITER, itemStack.getItemDamage())); - - return stringBuilder.toString(); - } - - public static ItemStack decodeItemStackFromString(String encodedItemStack) { - - ItemStack decodedItemStack = null; - - final int UNDEFINED = -1; - final int ERROR = -2; - - int itemId = UNDEFINED; - int meta = UNDEFINED; - - String[] splitString = encodedItemStack.split(Strings.TOKEN_DELIMITER); - - // Grab itemId - if (splitString.length >= 1) { - - try { - itemId = Integer.parseInt(splitString[0]); - } catch (NumberFormatException e) { - itemId = ERROR; - } - } - - // Grab meta - if (splitString.length >= 2) { - - try { - meta = Integer.parseInt(splitString[1]); - } catch (NumberFormatException e) { - meta = ERROR; - } - } - - if (meta == UNDEFINED) { - meta = OreDictionary.WILDCARD_VALUE; - } - - if (itemId != UNDEFINED && itemId != ERROR) { - if (meta != ERROR) { - decodedItemStack = new ItemStack(itemId, 1, meta); - } - } - - return decodedItemStack; - } - - /** - * Compares two ItemStacks for equality, testing itemID, metaData, - * stackSize, and their NBTTagCompounds (if they are present) - * - * @param first - * The first ItemStack being tested for equality - * @param second - * The second ItemStack being tested for equality - * @return true if the two ItemStacks are equivalent, false otherwise - */ - public static boolean compare(ItemStack first, ItemStack second) { - - // Check to see if either argument is null - if ((first != null) && (second != null)) { - // Check the item IDs - if (first.itemID == second.itemID) { - // Check the meta data - - if ((first.getItemDamage() == OreDictionary.WILDCARD_VALUE) || (second.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { - //return true; - } - - if (first.getItemDamage() == second.getItemDamage()) { - // Check the stack size - if (first.stackSize == second.stackSize) { - // If at least one of the ItemStacks has a NBTTagCompound, test for equality - if (first.hasTagCompound() || second.hasTagCompound()) { - - // If one of the stacks has a tag compound, but not both, they are not equal - if (!(first.hasTagCompound() && second.hasTagCompound())) { - return false; - } - // Otherwise, they both have tag compounds and we need to test them for equality - else { - return first.getTagCompound().equals(second.getTagCompound()); - } - } - // Otherwise, they must be equal if we have gotten this far (item IDs, meta data, and stack size all match) - else { - return true; - } - } - } - } - } - - return false; - } - - public static boolean hasColor(ItemStack itemStack) { - - return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR); - } - - public static int getColor(ItemStack itemStack) { - - NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); - - if (nbtTagCompound == null) - return Integer.parseInt(Colours.PURE_WHITE, 16); - else { - - NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); - return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - public static void setColor(ItemStack itemStack, int color) { - - if (itemStack != null) { - - NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); - - if (nbtTagCompound == null) { - - nbtTagCompound = new NBTTagCompound(); - itemStack.setTagCompound(nbtTagCompound); - } - - NBTTagCompound colourTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); - - if (!nbtTagCompound.hasKey(Strings.NBT_ITEM_DISPLAY)) { - nbtTagCompound.setCompoundTag(Strings.NBT_ITEM_DISPLAY, colourTagCompound); - } - - colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color); - } - } - - public static void dropMiniumShard(EntityPlayer player, EntityLivingBase entity) { - - if (GeneralHelper.isHostileEntity(entity)) { - rand = Math.random(); - - if (rand < 0.15d) { - entity.dropItem(ModItems.miniumShard.itemID, 1); - } - } - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java b/ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java deleted file mode 100644 index b4bbf975..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/KeyBindingUtil.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.util.ArrayList; - -import net.minecraft.client.settings.KeyBinding; - -import com.pahimar.ee3.configuration.ConfigurationSettings; - -/** - * Equivalent-Exchange-3 - * - * KeyBindingHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class KeyBindingUtil { - - public static ArrayList keyBindingsList; - public static ArrayList isRepeatingList; - - public static void addKeyBinding(String name, int value) { - - if (keyBindingsList == null) { - keyBindingsList = new ArrayList(); - } - - keyBindingsList.add(new KeyBinding(name, value)); - } - - public static void addIsRepeating(boolean value) { - - if (isRepeatingList == null) { - isRepeatingList = new ArrayList(); - } - - isRepeatingList.add(value); - } - - public static KeyBinding[] gatherKeyBindings() { - - return keyBindingsList.toArray(new KeyBinding[keyBindingsList.size()]); - } - - public static boolean[] gatherIsRepeating() { - - boolean[] isRepeating = new boolean[isRepeatingList.size()]; - - for (int x = 0; x < isRepeating.length; x++) { - isRepeating[x] = isRepeatingList.get(x).booleanValue(); - } - - return isRepeating; - } - - // TODO Still not ideal, won't work for every case. Specifically, make it context sensitive - public static boolean isClientSided(String keybinding) { - - if (keybinding.equalsIgnoreCase(ConfigurationSettings.KEYBINDING_TOGGLE)) - return true; - else - return false; - } -} diff --git a/ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java b/ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java deleted file mode 100644 index 44a840b8..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/LocalizationUtil.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.pahimar.ee3.core.util; - -import cpw.mods.fml.common.registry.LanguageRegistry; - -/** - * Equivalent-Exchange-3 - * - * LocalizationHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class LocalizationUtil { - - /*** - * Simple test to determine if a specified file name represents a XML file - * or not - * - * @param fileName - * String representing the file name of the file in question - * @return True if the file name represents a XML file, false otherwise - */ - public static boolean isXMLLanguageFile(String fileName) { - - return fileName.endsWith(".xml"); - } - - /*** - * Returns the locale from file name - * - * @param fileName - * String representing the file name of the file in question - * @return String representation of the locale snipped from the file name - */ - public static String getLocaleFromFileName(String fileName) { - - return fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf('.')); - } - - public static String getLocalizedString(String key) { - - return LanguageRegistry.instance().getStringLocalization(key); - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/util/LogHelper.java b/ee3_common/com/pahimar/ee3/core/util/LogHelper.java deleted file mode 100644 index 7cb52574..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/LogHelper.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.pahimar.ee3.lib.Reference; - -import cpw.mods.fml.common.FMLLog; - -/** - * Equivalent-Exchange-3 - * - * LogHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class LogHelper { - - private static Logger eeLogger = Logger.getLogger(Reference.MOD_ID); - - public static void init() { - - eeLogger.setParent(FMLLog.getLogger()); - } - - public static void log(Level logLevel, String message) { - - eeLogger.log(logLevel, message); - } - - public static void severe(String message) { - - log(Level.SEVERE, message); - } - - public static void debug(String message) { - - log(Level.WARNING, "[DEBUG] " + message); - } - - public static void warning(String message) { - - log(Level.WARNING, message); - } - - public static void info(String message) { - - log(Level.INFO, message); - } - - public static void config(String message) { - - log(Level.CONFIG, message); - } - - public static void fine(String message) { - - log(Level.FINE, message); - } - - public static void finer(String message) { - - log(Level.FINER, message); - } - - public static void finest(String message) { - - log(Level.FINEST, message); - } -} diff --git a/ee3_common/com/pahimar/ee3/core/util/OreStack.java b/ee3_common/com/pahimar/ee3/core/util/OreStack.java deleted file mode 100644 index da143c7e..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/OreStack.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.util.ArrayList; -import java.util.Comparator; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class OreStack implements Comparator { - - public String oreName; - public int stackSize; - - public OreStack() { - - stackSize = 0; - oreName = null; - } - - public OreStack(String oreName, int stackSize) { - - this.oreName = oreName; - this.stackSize = stackSize; - } - - public OreStack(String oreName) { - - this(oreName, 1); - } - - public OreStack(int oreID) { - - this(OreDictionary.getOreName(oreID)); - } - - public OreStack(int oreID, int stackSize) { - - this(OreDictionary.getOreName(oreID), stackSize); - } - - public OreStack(ItemStack itemStack) { - - this(OreDictionary.getOreID(itemStack), itemStack.stackSize); - } - - public ArrayList getOres() { - - return OreDictionary.getOres(oreName); - } - - public int getOreID() { - - return OreDictionary.getOreID(oreName); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreName)); - - return stringBuilder.toString(); - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof OreStack)) - return false; - - OreStack oreStackObject = (OreStack) object; - - return stackSize == oreStackObject.stackSize && oreName.equals(oreStackObject.oreName); - } - - @Override - public int compare(OreStack oreStack1, OreStack oreStack2) { - - if (oreStack1 != null && oreStack2 != null) { - if (oreStack1.oreName.equals(oreStack2.oreName)) - return 0; - } - - return -1; - } - - public static boolean compareStacks(OreStack oreStack1, OreStack oreStack2) { - - return oreStack1.compareToStack(oreStack2); - } - - public boolean compareToStack(OreStack oreStack) { - - return compare(this, oreStack) == 0; - } -} diff --git a/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java b/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java deleted file mode 100644 index 72aab085..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.pahimar.ee3.core.util; - -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - * - * QualityHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class QualityHelper { - - private static int[][] dustTable = { { 0, 0, 0, 1, 1, 1 }, { 0, 1, 1, 1, 2, 2 }, { 0, 1, 2, 2, 2, 2 }, { 1, 1, 2, 3, 3, 3 }, { 1, 2, 2, 3, 4, 4 }, { 1, 2, 2, 3, 4, 5 }, }; - - public static int getItemTierQuality(ItemStack item) { - - // TODO Return the 'Tier' level of the given ItemStack - return -1; - } - - public static int getFuelTierQuality(ItemStack fuel) { - - // TODO Return the 'Tier' level of the given ItemStack - return -1; - } - - public static int getDustTierQuality(ItemStack item, ItemStack fuel) { - - if (getItemTierQuality(item) >= 0 && getItemTierQuality(item) <= 5) { - if (getFuelTierQuality(fuel) >= 0 && getFuelTierQuality(fuel) <= 5) - return dustTable[getItemTierQuality(item)][getFuelTierQuality(fuel)]; - } - - return -1; - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java b/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java deleted file mode 100644 index 8e616bf9..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -import com.pahimar.ee3.item.CustomWrappedStack; - -/** - * Equivalent-Exchange-3 - * - * RecipeHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class RecipeHelper { - - /** - * Discovers all instances of ItemStacks with wild card meta values in the - * vanilla Crafting Manager - * - * @return A list of CustomWrappedStacks that contains all wild card meta - * ItemStacks in the vanilla Crafting Manager - */ - public static ArrayList populateWildCards() { - - ArrayList wildCards = new ArrayList(); - - for (Object recipe : CraftingManager.getInstance().getRecipeList()) { - - if (recipe instanceof IRecipe) { - - if (((IRecipe) recipe).getRecipeOutput() instanceof ItemStack) { - - CustomWrappedStack recipeOutput = new CustomWrappedStack(((IRecipe) recipe).getRecipeOutput()); - ArrayList recipeInputs = RecipeHelper.getRecipeInputs((IRecipe) recipe); - ItemStack itemStack = null; - - if (recipeOutput.getWrappedStack() instanceof ItemStack) { - - itemStack = (ItemStack) recipeOutput.getWrappedStack(); - - if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !wildCards.contains(recipeOutput)) { - wildCards.add(recipeOutput); - } - } - - for (CustomWrappedStack inputStack : recipeInputs) { - - if (inputStack.getWrappedStack() instanceof ItemStack) { - - itemStack = (ItemStack) inputStack.getWrappedStack(); - - if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !wildCards.contains(inputStack)) { - wildCards.add(inputStack); - } - } - } - } - } - } - - return wildCards; - } - - /** - * Returns a list of elements that constitute the input in a crafting recipe - * - * @param recipe - * The IRecipe being examined - * @return List of elements that constitute the input of the given IRecipe. - * Could be an ItemStack or an Arraylist - */ - public static ArrayList getRecipeInputs(IRecipe recipe) { - - ArrayList recipeInputs = new ArrayList(); - - if (recipe instanceof ShapedRecipes) { - - ShapedRecipes shapedRecipe = (ShapedRecipes) recipe; - - for (int i = 0; i < shapedRecipe.recipeItems.length; i++) { - - if (shapedRecipe.recipeItems[i] instanceof ItemStack) { - - ItemStack itemStack = shapedRecipe.recipeItems[i].copy(); - - if (itemStack.stackSize > 1) { - itemStack.stackSize = 1; - } - - recipeInputs.add(new CustomWrappedStack(itemStack)); - } - } - } - else if (recipe instanceof ShapelessRecipes) { - - ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe; - - for (Object object : shapelessRecipe.recipeItems) { - - if (object instanceof ItemStack) { - - ItemStack itemStack = ((ItemStack) object).copy(); - - if (itemStack.stackSize > 1) { - itemStack.stackSize = 1; - } - - recipeInputs.add(new CustomWrappedStack(itemStack)); - } - } - } - else if (recipe instanceof ShapedOreRecipe) { - - ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe; - - for (int i = 0; i < shapedOreRecipe.getInput().length; i++) { - - /* - * If the element is a list, then it is an OreStack - */ - if (shapedOreRecipe.getInput()[i] instanceof ArrayList) { - CustomWrappedStack oreStack = new CustomWrappedStack(shapedOreRecipe.getInput()[i]); - - if (oreStack.getWrappedStack() instanceof OreStack) { - recipeInputs.add(new CustomWrappedStack(shapedOreRecipe.getInput()[i])); - } - } - else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) { - - ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy(); - - if (itemStack.stackSize > 1) { - itemStack.stackSize = 1; - } - - recipeInputs.add(new CustomWrappedStack(itemStack)); - } - } - } - else if (recipe instanceof ShapelessOreRecipe) { - - ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe; - - for (Object object : shapelessOreRecipe.getInput()) { - - if (object instanceof ArrayList) { - recipeInputs.add(new CustomWrappedStack(object)); - } - else if (object instanceof ItemStack) { - - ItemStack itemStack = ((ItemStack) object).copy(); - - if (itemStack.stackSize > 1) { - itemStack.stackSize = 1; - } - - recipeInputs.add(new CustomWrappedStack(itemStack)); - } - } - } - - return recipeInputs; - } -} diff --git a/ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java b/ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java deleted file mode 100644 index 148c51da..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/ResourceLocationHelper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.pahimar.ee3.core.util; - -import com.pahimar.ee3.lib.Reference; - -import net.minecraft.util.ResourceLocation; - -public class ResourceLocationHelper { - - public static ResourceLocation getResourceLocation(String path) { - - return new ResourceLocation(Reference.MOD_ID.toLowerCase(), path); - } -} diff --git a/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java b/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java deleted file mode 100644 index a62d2584..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import com.pahimar.ee3.core.handlers.EquivalencyHandler; - -/** - * Equivalent-Exchange-3 - * - * TransmutationHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class TransmutationHelper { - - public static ItemStack previousBlockStack = null; - public static ItemStack currentBlockStack = null; - public static ItemStack targetBlockStack = null; - - public static boolean transmuteInWorld(World world, EntityPlayer player, ItemStack stack, int x, int y, int z, int targetID, int targetMeta) { - - if (Block.blocksList[targetID] != null) { - world.setBlock(x, y, z, targetID, targetMeta, 2); - return true; - } - - return false; - } - - public static String formatTargetBlockInfo(ItemStack targetBlock) { - - if (targetBlock != null) - return TransmutationHelper.targetBlockStack.itemID + ":" + TransmutationHelper.targetBlockStack.getItemDamage(); - else - return ""; - } - - public static void updateTargetBlock(World world, int x, int y, int z) { - - int id = world.getBlockId(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - Block currentBlock = Block.blocksList[id]; - - if (currentBlock != null) { - meta = currentBlock.damageDropped(meta); - - currentBlockStack = new ItemStack(id, 1, meta); - - if (previousBlockStack == null) { - previousBlockStack = currentBlockStack; - targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); - } - else { - if (!EquivalencyHandler.instance().areEquivalent(TransmutationHelper.previousBlockStack, currentBlockStack)) { - previousBlockStack = currentBlockStack; - targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); - } - } - } - } - - public static ItemStack getNextBlock(int id, int meta) { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); - - ItemStack nextStack = null; - - if (list != null) - return getNextBlock(id, meta, id, meta); - return nextStack; - } - - private static ItemStack getNextBlock(int id, int meta, int origId, int origMeta) { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); - - ItemStack nextStack = null; - - if (list != null) { - nextStack = EquivalencyHandler.instance().getNextInList(id, meta); - nextStack.stackSize = 1; - - /* - * If the current item is the same as the original one we started - * with, then we have recursed through the entire list and not found - * a next block so return the original. This is the "base case" for - * the recursion. - */ - if (nextStack.itemID == origId && nextStack.getItemDamage() == origMeta) - return nextStack; - else { - if (nextStack.getItem() instanceof ItemBlock) - return nextStack; - else - return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta); - } - } - - // In the event the list is null, return null - return nextStack; - } - - public static ItemStack getPreviousBlock(int itemID, int meta) { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(itemID, meta); - - ItemStack prevStack = null; - - if (list != null) - return getPreviousBlock(itemID, meta, itemID, meta); - return prevStack; - } - - private static ItemStack getPreviousBlock(int id, int meta, int origId, int origMeta) { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); - - ItemStack prevStack = null; - if (list != null) { - prevStack = EquivalencyHandler.instance().getPrevInList(id, meta); - prevStack.stackSize = 1; - - if (prevStack.itemID == origId && prevStack.getItemDamage() == origMeta) - return prevStack; - else { - if (prevStack.getItem() instanceof ItemBlock) - return prevStack; - else - return getPreviousBlock(prevStack.itemID, prevStack.getItemDamage(), origId, origMeta); - } - } - - // In the event the list is null, return null - return prevStack; - } - -} diff --git a/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java b/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java deleted file mode 100644 index 1631b601..00000000 --- a/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.pahimar.ee3.core.util; - -import java.io.InputStream; -import java.net.URL; -import java.util.Properties; - -import net.minecraftforge.common.Configuration; - -import com.pahimar.ee3.configuration.ConfigurationHandler; -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.lib.Strings; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.LanguageRegistry; - -/** - * Equivalent-Exchange-3 - * - * VersionHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class VersionHelper implements Runnable { - - private static VersionHelper instance = new VersionHelper(); - - // The (publicly available) remote version number authority file - private static final String REMOTE_VERSION_XML_FILE = "https://raw.github.com/pahimar/Equivalent-Exchange-3/master/version.xml"; - - public static Properties remoteVersionProperties = new Properties(); - - // All possible results of the remote version number check - public static final byte UNINITIALIZED = 0; - public static final byte CURRENT = 1; - public static final byte OUTDATED = 2; - public static final byte ERROR = 3; - public static final byte FINAL_ERROR = 4; - public static final byte MC_VERSION_NOT_FOUND = 5; - - // Var to hold the result of the remote version check, initially set to uninitialized - private static byte result = UNINITIALIZED; - public static String remoteVersion = null; - public static String remoteUpdateLocation = null; - - /*** - * Checks the version of the currently running instance of the mod against - * the remote version authority, and sets the result of the check - * appropriately - */ - public static void checkVersion() { - - InputStream remoteVersionRepoStream = null; - result = UNINITIALIZED; - - try { - URL remoteVersionURL = new URL(REMOTE_VERSION_XML_FILE); - remoteVersionRepoStream = remoteVersionURL.openStream(); - remoteVersionProperties.loadFromXML(remoteVersionRepoStream); - - String remoteVersionProperty = remoteVersionProperties.getProperty(Loader.instance().getMCVersionString()); - - if (remoteVersionProperty != null) { - String[] remoteVersionTokens = remoteVersionProperty.split("\\|"); - - if (remoteVersionTokens.length >= 2) { - remoteVersion = remoteVersionTokens[0]; - remoteUpdateLocation = remoteVersionTokens[1]; - } - else { - result = ERROR; - } - - if (remoteVersion != null) { - if (!ConfigurationSettings.LAST_DISCOVERED_VERSION.equalsIgnoreCase(remoteVersion)) { - ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, remoteVersion); - } - - if (remoteVersion.equalsIgnoreCase(getVersionForCheck())) { - result = CURRENT; - } - else { - result = OUTDATED; - } - } - - } - else { - result = MC_VERSION_NOT_FOUND; - } - } - catch (Exception e) { - } - finally { - if (result == UNINITIALIZED) { - result = ERROR; - } - - try { - if (remoteVersionRepoStream != null) { - remoteVersionRepoStream.close(); - } - } - catch (Exception ex) { - } - } - } - - private static String getVersionForCheck() { - - String[] versionTokens = Reference.VERSION_NUMBER.split(" "); - - if (versionTokens.length >= 1) - return versionTokens[0]; - else - return Reference.VERSION_NUMBER; - } - - public static void logResult() { - - if (result == CURRENT || result == OUTDATED) { - LogHelper.info(getResultMessage()); - } - else { - LogHelper.warning(getResultMessage()); - } - } - - public static String getResultMessage() { - - if (result == UNINITIALIZED) - return LanguageRegistry.instance().getStringLocalization(Strings.UNINITIALIZED_MESSAGE); - else if (result == CURRENT) { - String returnString = LanguageRegistry.instance().getStringLocalization(Strings.CURRENT_MESSAGE); - returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion); - returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString()); - return returnString; - } - else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) { - String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE); - returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME); - returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion); - returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString()); - returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation); - return returnString; - } - else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) { - String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE); - returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME); - returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion); - returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString()); - returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation); - return returnString; - } - else if (result == ERROR) - return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE); - else if (result == FINAL_ERROR) - return LanguageRegistry.instance().getStringLocalization(Strings.FINAL_ERROR_MESSAGE); - else if (result == MC_VERSION_NOT_FOUND) { - String returnString = LanguageRegistry.instance().getStringLocalization(Strings.MC_VERSION_NOT_FOUND); - returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME); - returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString()); - return returnString; - } - else { - result = ERROR; - return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE); - } - } - - public static String getResultMessageForClient() { - - String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE); - returnString = returnString.replace("@MOD_NAME@", Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE); - returnString = returnString.replace("@REMOTE_MOD_VERSION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE); - returnString = returnString.replace("@MINECRAFT_VERSION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE); - returnString = returnString.replace("@MOD_UPDATE_LOCATION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE); - return returnString; - } - - public static byte getResult() { - - return result; - } - - @Override - public void run() { - - int count = 0; - - LogHelper.info(LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE); - - try { - while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) { - - checkVersion(); - count++; - logResult(); - - if (result == UNINITIALIZED || result == ERROR) { - Thread.sleep(10000); - } - } - - if (result == ERROR) { - result = FINAL_ERROR; - logResult(); - } - } - catch (InterruptedException e) { - e.printStackTrace(); - } - - } - - public static void execute() { - - new Thread(instance).start(); - } - -} diff --git a/ee3_common/com/pahimar/ee3/emc/DynEMC.java b/ee3_common/com/pahimar/ee3/emc/DynEMC.java deleted file mode 100644 index f5891f8d..00000000 --- a/ee3_common/com/pahimar/ee3/emc/DynEMC.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Set; - -import com.google.common.collect.Multimap; -import com.pahimar.ee3.core.util.LogHelper; -import com.pahimar.ee3.emc.graph.WeightedDirectedGraph; -import com.pahimar.ee3.emc.graph.WeightedEdge; -import com.pahimar.ee3.item.CustomWrappedStack; -import com.pahimar.ee3.item.crafting.RecipeRegistry; - -public class DynEMC { - - private static DynEMC dynEMC = null; - - private RecipeRegistry recipeRegistry; - private WeightedDirectedGraph graph; - - private DynEMC() { - - recipeRegistry = RecipeRegistry.getInstance(); - graph = new WeightedDirectedGraph(); - - init(); - } - - public static DynEMC getInstance() { - - if (dynEMC == null) { - dynEMC = new DynEMC(); - } - - return dynEMC; - } - - private void init() { - - populateGraph(); - } - - private void populateGraph() { - - for (CustomWrappedStack discoveredStack : recipeRegistry.getDiscoveredStacks()) { - graph.addNode(discoveredStack); - } - - Multimap> recipeMappings = recipeRegistry.getRecipeMappings(); - - Set recipeKeySet = recipeMappings.keySet(); - Iterator recipeKeySetIterator = recipeKeySet.iterator(); - CustomWrappedStack recipeOutput = null; - - while (recipeKeySetIterator.hasNext()) { - recipeOutput = recipeKeySetIterator.next(); - - for (List recipeInputs : recipeMappings.get(recipeOutput)) { - - CustomWrappedStack unWrappedRecipeOutput = new CustomWrappedStack(recipeOutput.getWrappedStack()); - - if (graph.nodeExists(unWrappedRecipeOutput)) { - for (CustomWrappedStack recipeInput : recipeInputs) { - - // Unwrapped the wrapped stacks so that we actually find them in the graph - - CustomWrappedStack unWrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack()); - - if (graph.nodeExists(unWrappedRecipeInput)) { - if (recipeOutput.getStackSize() != 0) { - try { - graph.addEdge(unWrappedRecipeOutput, unWrappedRecipeInput, (recipeInput.getStackSize() * 1.0f) / recipeOutput.getStackSize()); - } catch (NoSuchElementException e) { - LogHelper.severe(e.getLocalizedMessage()); - } - } - } - else { - LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' exists in the crafting relationship graph"); - LogHelper.debug("Recipe input '" + unWrappedRecipeInput.toString() + "' does not exist in the crafting relationship graph"); - } - } - } - else { - LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' does not exist in the crafting relationship graph"); - } - } - } - } - - public List getCriticalNodes() { - - return graph.getCriticalNodes(); - } - - public int size() { - - return graph.size(); - } - - public void printDebugDump() { - - LogHelper.debug("Total node count: " + graph.getAllNodes().size()); - LogHelper.debug("Critical node count: " + graph.getCriticalNodes().size()); - LogHelper.debug("Orphan node count: " + graph.getOrphanNodes().size()); - - List critsMinusOrphans = graph.getCriticalNodes(); - critsMinusOrphans.removeAll(graph.getOrphanNodes()); - - LogHelper.debug("[Critical - Orphans] node count: " + critsMinusOrphans.size()); - - LogHelper.debug("***** START NODES *****"); - Iterator nodeIter = graph.iterator(); - while (nodeIter.hasNext()) { - CustomWrappedStack node = nodeIter.next(); - LogHelper.debug("Node: " + node); - } - LogHelper.debug("***** END NODES *****"); - - LogHelper.debug("***** START EDGES FROM *****"); - nodeIter = graph.iterator(); - while (nodeIter.hasNext()) { - CustomWrappedStack node = nodeIter.next(); - Set> edgesFrom = graph.edgesFrom(node); - for (WeightedEdge edge : edgesFrom) { - LogHelper.debug("Crafting Output: " + node); - LogHelper.debug("Crafting Input: " + edge.getTarget()); - LogHelper.debug("Weight: " + edge.getWeight()); - LogHelper.debug(""); - } - } - LogHelper.debug("***** END EDGES FROM *****"); - - LogHelper.debug("***** START EDGES TO *****"); - nodeIter = graph.iterator(); - while (nodeIter.hasNext()) { - CustomWrappedStack node = nodeIter.next(); - Set> edgesTo = graph.edgesTo(node); - Iterator> edgeIter = edgesTo.iterator(); - while (edgeIter.hasNext()) { - WeightedEdge edge = edgeIter.next(); - LogHelper.debug("From: " + node); - LogHelper.debug("To: " + edge.getTarget()); - LogHelper.debug("Weight: " + edge.getWeight()); - LogHelper.debug(""); - } - } - LogHelper.debug("***** END EDGES TO *****"); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("DynEMC Node Count: %s", graph.size())); - - return stringBuilder.toString(); - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcBlackList.java b/ee3_common/com/pahimar/ee3/emc/EmcBlackList.java deleted file mode 100644 index 0e64eb56..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EmcBlackList.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; - -import com.pahimar.ee3.item.CustomWrappedStack; - -public class EmcBlackList { - - private static EmcBlackList emcBlackList = null; - - private ArrayList stackBlackList = new ArrayList(); - - private EmcBlackList() { - - } - - public static EmcBlackList getInstance() { - - if (emcBlackList == null) { - - emcBlackList = new EmcBlackList(); - emcBlackList.init(); - } - - return emcBlackList; - } - - public List getBlackList() { - - return stackBlackList; - } - - public boolean add(Object object) { - - boolean wasAdded = false; - - if (CustomWrappedStack.canBeWrapped(object)) { - - CustomWrappedStack wrappedStack = new CustomWrappedStack(object); - wrappedStack.setStackSize(1); - - if (!stackBlackList.contains(wrappedStack)) { - stackBlackList.add(wrappedStack); - wasAdded = true; - } - } - - return wasAdded; - } - - public boolean contains(Object object) { - - if (CustomWrappedStack.canBeWrapped(object)) { - - CustomWrappedStack wrappedStack = new CustomWrappedStack(object); - wrappedStack.setStackSize(1); - - return stackBlackList.contains(wrappedStack); - } - - return false; - } - - public boolean remove(Object object) { - - boolean wasRemoved = false; - - if (CustomWrappedStack.canBeWrapped(object)) { - - CustomWrappedStack wrappedStack = new CustomWrappedStack(object); - wrappedStack.setStackSize(1); - - if (stackBlackList.contains(wrappedStack)) { - stackBlackList.remove(wrappedStack); - wasRemoved = true; - } - } - - return wasRemoved; - } - - private void init() { - - add(Block.bed); - add(Block.pistonExtension); - add(Block.pistonMoving); - add(Block.mobSpawner); - add(Block.redstoneWire); - add(Block.crops); - add(Block.furnaceBurning); - add(Block.signPost); - add(Block.doorWood); - add(Block.signWall); - add(Block.doorIron); - add(Block.torchRedstoneIdle); - add(Block.reed); - add(Block.portal); - add(Block.cake); - add(Block.redstoneRepeaterIdle); - add(Block.redstoneRepeaterActive); - add(Block.lockedChest); - add(Block.pumpkinStem); - add(Block.melonStem); - add(Block.netherStalk); - add(Block.brewingStand); - add(Block.cauldron); - add(Block.endPortal); - add(Block.redstoneLampActive); - add(Block.commandBlock); - add(Block.carrot); - add(Block.potato); - add(Block.skull); - add(Block.redstoneComparatorIdle); - add(Block.redstoneComparatorActive); - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcComponent.java b/ee3_common/com/pahimar/ee3/emc/EmcComponent.java deleted file mode 100644 index 13c6fc9b..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EmcComponent.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.pahimar.ee3.emc; - -public class EmcComponent { - - private final EmcType emcType; - private final float percentage; - - public EmcComponent(EmcType emcType, float percentage) { - - this.emcType = emcType; - this.percentage = percentage; - } - - public EmcType getEmcType() { - - return emcType; - } - - public float getPercentage() { - - return percentage; - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof EmcComponent)) { - - return false; - } - - EmcComponent emcBreakDown = (EmcComponent) object; - - return ((this.emcType == emcBreakDown.emcType) && (this.percentage == emcBreakDown.percentage)); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("", emcType, (percentage * 100))); - - return stringBuilder.toString(); - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java b/ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java deleted file mode 100644 index cac65ca2..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EmcDefaultValues.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.HashMap; -import java.util.List; - -import com.pahimar.ee3.item.CustomWrappedStack; - -public class EmcDefaultValues { - - private static HashMap> defaultEmcValues = new HashMap>(); - - public static void init() { - - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcMap.java b/ee3_common/com/pahimar/ee3/emc/EmcMap.java deleted file mode 100644 index 548ce166..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EmcMap.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.HashMap; - -import com.pahimar.ee3.item.CustomWrappedStack; - -public class EmcMap { - - private static EmcMap emcMap = null; - - private HashMap emcMappings; - - private EmcMap() { - - emcMappings = new HashMap(); - } - - public static EmcMap getInstance() { - - if (emcMap == null) { - emcMap = new EmcMap(); - } - - return emcMap; - } - - public EmcValue getEmcValue(Object object) { - - EmcValue emcValue = null; - - if (CustomWrappedStack.canBeWrapped(object)) { - return emcMappings.get(new CustomWrappedStack(object)); - } - - return emcValue; - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcType.java b/ee3_common/com/pahimar/ee3/emc/EmcType.java deleted file mode 100644 index 9630fe8c..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EmcType.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.pahimar.ee3.emc; - -public enum EmcType { - CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID, OMNI; -} diff --git a/ee3_common/com/pahimar/ee3/emc/EmcValue.java b/ee3_common/com/pahimar/ee3/emc/EmcValue.java deleted file mode 100644 index 19f02442..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EmcValue.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.ArrayList; -import java.util.List; - -import com.pahimar.ee3.lib.Strings; - -/** - * Equivalent-Exchange-3 - * - * EMCEntry - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class EmcValue { - - private float value, recoveryPercentage; - private List emcComponents; - - public EmcValue() { - - value = 0F; - recoveryPercentage = 1F; - emcComponents = new ArrayList(); - } - - public EmcValue(float value) { - - this.value = value; - recoveryPercentage = 1F; - emcComponents = new ArrayList(); - } - - public EmcValue(float value, float recoveryPercentage) { - - this.value = value; - this.recoveryPercentage = recoveryPercentage; - emcComponents = new ArrayList(); - } - - public EmcValue(float value, float recoveryPercentage, List emcComponents) { - - this.value = value; - this.recoveryPercentage = recoveryPercentage; - this.emcComponents = emcComponents; - } - - public float getValue() { - - return value; - } - - public float getRecoveryPercentage() { - - return recoveryPercentage; - } - - public List getComponents() { - - return emcComponents; - } - - public EmcComponent getComponent(EmcType emcType) { - - for (EmcComponent emcComponent : emcComponents) { - if (emcComponent.getEmcType().equals(emcType)) { - return emcComponent; - } - } - - return null; - } - - public boolean containsEmcType(EmcType emcType) { - - for (EmcComponent emcComponent : emcComponents) { - if (emcComponent.getEmcType().equals(emcType)) { - return true; - } - } - - return false; - } - - public void setValue(float cost) { - - this.value = cost; - } - - public void setRecoveryPercentage(float recoveryPercentage) { - - this.recoveryPercentage = recoveryPercentage; - } - - public void addEmcComponent(EmcComponent emcComponent) { - - if (!containsEmcType(emcComponent.getEmcType())) { - emcComponents.add(emcComponent); - } - } - - public void addEmcComponent(EmcType emcType, float percentage) { - - addEmcComponent(new EmcComponent(emcType, percentage)); - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof EmcValue)) { - return false; - } - - EmcValue emcValue = (EmcValue) object; - - if (value == emcValue.value) { - if (recoveryPercentage == emcValue.recoveryPercentage) { - return emcComponents.equals(emcValue.getComponents()); - } - } - - return false; - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("V:%s", value)); - stringBuilder.append(Strings.TOKEN_DELIMITER); - stringBuilder.append(String.format("RP:%s", recoveryPercentage)); - stringBuilder.append(Strings.TOKEN_DELIMITER); - stringBuilder.append("["); - - for (int i = 0; i < emcComponents.size(); i++) { - if (i > 0) { - stringBuilder.append(Strings.TOKEN_DELIMITER); - } - stringBuilder.append(String.format("%s:%s", emcComponents.get(i).getEmcType(), emcComponents.get(i).getPercentage())); - } - - stringBuilder.append("]"); - - return stringBuilder.toString(); - } - - @Override - public int hashCode() { - - int hashCode = 1; - - hashCode = 37 * hashCode + Float.floatToIntBits(value); - hashCode = 37 * hashCode + Float.floatToIntBits(recoveryPercentage); - hashCode = 37 * hashCode + emcComponents.hashCode(); - - return hashCode; - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java b/ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java deleted file mode 100644 index 724988aa..00000000 --- a/ee3_common/com/pahimar/ee3/emc/EquivalencyGroup.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.pahimar.ee3.emc; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import com.pahimar.ee3.item.CustomWrappedStack; - -public class EquivalencyGroup { - - private List equivalentItems; - - public EquivalencyGroup() { - - equivalentItems = new ArrayList(); - } - - public EquivalencyGroup(List equivalentItems) { - - this.equivalentItems = new ArrayList(); - - for (ItemStack itemStack : equivalentItems) { - this.equivalentItems.add(new CustomWrappedStack(itemStack)); - } - } - - public List getMembers() { - - return equivalentItems; - } - - public boolean containsMember(ItemStack itemStack) { - - return containsMember(new CustomWrappedStack(itemStack)); - } - - public boolean containsMember(CustomWrappedStack customWrappedStack) { - - return equivalentItems.contains(customWrappedStack); - } - - public void addMember(ItemStack itemStack) { - - this.addMember(new CustomWrappedStack(itemStack)); - } - - public void addMember(CustomWrappedStack customWrappedStack) { - - if (!containsMember(customWrappedStack)) { - equivalentItems.add(customWrappedStack); - } - } - - public void setEquivalentItems(List equivalentItems) { - - this.equivalentItems = equivalentItems; - } - - public void removeMember(ItemStack itemStack) { - - removeMember(new CustomWrappedStack(itemStack)); - } - - public void removeMember(CustomWrappedStack customWrappedStack) { - - while (containsMember(customWrappedStack)) { - equivalentItems.remove(customWrappedStack); - } - } - - public void clearMembers() { - - equivalentItems = new ArrayList(); - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof EquivalencyGroup)) { - return false; - } - - EquivalencyGroup equivalencyGroup = (EquivalencyGroup) object; - - return (equivalentItems.equals(equivalencyGroup.equivalentItems)); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append("Equivalent Group Members: "); - for (CustomWrappedStack customWrappedStack : equivalentItems) { - stringBuilder.append(String.format("%s ", customWrappedStack)); - } - - return stringBuilder.toString(); - } - - @Override - public int hashCode() { - - int hashCode = 1; - - for (CustomWrappedStack customWrappedStack : equivalentItems) { - hashCode = 37 * hashCode + customWrappedStack.hashCode(); - } - - return hashCode; - } -} diff --git a/ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java b/ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java deleted file mode 100644 index 59e39bce..00000000 --- a/ee3_common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.pahimar.ee3.emc.graph; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.logging.Logger; - -import com.pahimar.ee3.core.util.LogHelper; - -public class WeightedDirectedGraph implements Iterable { - - private final Map>> graph = new HashMap>>(); - private List orderedNodes = new ArrayList(); - - public boolean addNode(T node) { - - // Ignore nodes already added - if (graph.containsKey(node)) - return false; - - orderedNodes.add(node); - graph.put(node, new TreeSet>(new Comparator>() { - - @Override - public int compare(WeightedEdge o1, WeightedEdge o2) { - - return orderedNodes.indexOf(o1.getTarget()) - orderedNodes.indexOf(o2.getTarget()); - } - })); - - return true; - } - - public void addEdge(T from, T to) { - - addEdge(from, to, 1); - } - - public void addEdge(T from, T to, float weight) { - - if (!(graph.containsKey(from) && graph.containsKey(to))) { - if (!graph.containsKey(from)) { - LogHelper.severe("From node doesn't exist: " + from.toString()); - LogHelper.severe("To node: " + to.toString()); - } - if (!graph.containsKey(to)) { - LogHelper.severe("From node: " + from.toString()); - LogHelper.severe("To node doesn't exist: " + to.toString()); - } - throw new NoSuchElementException("Missing nodes from graph"); - } - - // If a directed edge of the same weight doesn't already exist, add the new edge - if (!edgeExists(from, to, weight)) { - graph.get(from).add(new WeightedEdge(weight, to)); - } - } - - public boolean edgeExists(T from, T to) { - - if (!(graph.containsKey(from) && graph.containsKey(to))) - throw new NoSuchElementException("Missing nodes from graph"); - - Iterator> edgeIterator = graph.get(from).iterator(); - - while (edgeIterator.hasNext()) { - if (edgeIterator.next().getTarget().equals(to)) - return true; - } - - return false; - } - - public boolean edgeExists(T from, T to, float weight) { - - if (!(graph.containsKey(from) && graph.containsKey(to))) { - if (!graph.containsKey(from)) { - LOGGER.severe("From node doesn't exist: " + from.toString()); - LOGGER.severe("To node: " + to.toString()); - } - if (!graph.containsKey(to)) { - LOGGER.severe("To node doesn't exist: " + to.toString()); - LOGGER.severe("From node: " + from.toString()); - } - throw new NoSuchElementException("Missing nodes from graph"); - } - - return graph.get(from).contains(new WeightedEdge(weight, to)); - } - - public boolean nodeExists(T node) { - - return graph.containsKey(node); - } - - public Set> edgesFrom(T from) { - - if (!graph.containsKey(from)) - throw new NoSuchElementException("Missing node from graph"); - - return Collections.unmodifiableSortedSet(graph.get(from)); - } - - public Set> edgesTo(T to) { - - if (!graph.containsKey(to)) - throw new NoSuchElementException("Missing node from graph"); - - Set> edgesTo = new TreeSet>(new Comparator>() { - - @Override - public int compare(WeightedEdge o1, WeightedEdge o2) { - - return o1.hashCode() - o2.hashCode(); - } - }); - - for (T node : graph.keySet()) { - if (!node.equals(to)) { - Set> edgesFrom = edgesFrom(node); - - for (WeightedEdge fromEdge : edgesFrom) { - if (fromEdge.getTarget().equals(to)) { - edgesTo.add(new WeightedEdge(fromEdge.getWeight(), node)); - } - } - } - } - - return Collections.unmodifiableSet(edgesTo); - } - - public void removeNode(T node) { - - if (!graph.containsKey(node)) - throw new NoSuchElementException("Missing node from graph"); - - // Remove all edges from and to the node - removeAllEdgesFrom(node); - removeAllEdgesTo(node); - - // Remove the node - graph.remove(node); - } - - public void removeEdge(T from, T to) { - - removeEdge(from, to, 1); - } - - public void removeEdge(T from, T to, float weight) { - - if (!(graph.containsKey(from) && graph.containsKey(to))) - throw new NoSuchElementException("Missing nodes from graph"); - - graph.get(from).remove(new WeightedEdge(weight, to)); - } - - public void removeAllEdgesFrom(T node) { - - if (!graph.containsKey(node)) - throw new NoSuchElementException("Missing node from graph"); - - graph.get(node).clear(); - } - - public void removeAllEdgesTo(T node) { - - if (!graph.containsKey(node)) - throw new NoSuchElementException("Missing node from graph"); - - for (T aNode : graph.keySet()) { - Set> edgesFrom = edgesFrom(aNode); - - for (WeightedEdge fromEdge : edgesFrom) { - if (fromEdge.getTarget().equals(node)) { - graph.get(aNode).remove(fromEdge); - } - } - } - } - - public void removeAllEdgesBetween(T firstNode, T secondNode) { - - if (!(graph.containsKey(firstNode) && graph.containsKey(secondNode))) - throw new NoSuchElementException("Missing nodes from graph"); - - for (WeightedEdge edgeFrom : edgesFrom(firstNode)) { - if (edgeFrom.getTarget().equals(secondNode)) { - graph.get(firstNode).remove(edgeFrom); - } - } - - for (WeightedEdge edgeFrom : edgesFrom(secondNode)) { - if (edgeFrom.getTarget().equals(firstNode)) { - graph.get(secondNode).remove(edgeFrom); - } - } - } - - public List getAllNodes() { - - return orderedNodes; - } - - public List getCriticalNodes() { - - ArrayList criticalNodes = new ArrayList(); - - Iterator nodeIter = orderedNodes.iterator(); - - while (nodeIter.hasNext()) { - T currentNode = nodeIter.next(); - - if (this.edgesFrom(currentNode).size() == 0) { - criticalNodes.add(currentNode); - } - } - - return criticalNodes; - } - - public List getOrphanNodes() { - - ArrayList orphanedNodes = new ArrayList(); - - Iterator nodeIter = orderedNodes.iterator(); - - while (nodeIter.hasNext()) { - T currentNode = nodeIter.next(); - - if (this.edgesFrom(currentNode).size() == 0 && this.edgesTo(currentNode).size() == 0) { - orphanedNodes.add(currentNode); - } - } - - return orphanedNodes; - } - - @Override - public Iterator iterator() { - - return orderedNodes.iterator(); - } - - public int size() { - - return graph.size(); - } - - public boolean isEmpty() { - - return graph.isEmpty(); - } - - @Override - public String toString() { - - return graph.toString(); - } - - private static final Logger LOGGER = Logger.getLogger(WeightedDirectedGraph.class.getName()); - -} diff --git a/ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java b/ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java deleted file mode 100644 index 9b7d97ed..00000000 --- a/ee3_common/com/pahimar/ee3/emc/graph/WeightedEdge.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.pahimar.ee3.emc.graph; - -public class WeightedEdge { - - private float weight; - private T target; - - public WeightedEdge(float weight, T target) { - - this.weight = weight; - this.target = target; - } - - public float getWeight() { - - return weight; - } - - public T getTarget() { - - return target; - } - - public void setWeight(float weight) { - - this.weight = weight; - } - - public void setTarget(T target) { - - this.target = target; - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof WeightedEdge)) { - return false; - } - - WeightedEdge edge = (WeightedEdge) object; - - return ((this.weight == edge.weight) && (target.equals(edge.target))); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(String.format("Weight: %s, Target: %s ", weight, target)); - - return stringBuilder.toString(); - } -} diff --git a/ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java b/ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java deleted file mode 100644 index 60923788..00000000 --- a/ee3_common/com/pahimar/ee3/item/CustomWrappedStack.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.pahimar.ee3.item; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.pahimar.ee3.core.util.EnergyStack; -import com.pahimar.ee3.core.util.ItemUtil; -import com.pahimar.ee3.core.util.OreStack; -import com.pahimar.ee3.lib.Reference; - -public class CustomWrappedStack { - - private int stackSize; - private ItemStack itemStack; - private OreStack oreStack; - private EnergyStack energyStack; - - /** - * Creates a new CustomWrappedStack object which wraps the given input. - * Valid inputs would be ItemStacks or OreStacks. If something other than an - * ItemStack or an OreStack is used as input, nothing is wrapped and the - * size of the wrapped stack is set to -1 to indicate an invalid wrapped - * stack. - * - * @param object - * The newly created wrapped stack object - */ - public CustomWrappedStack(Object object) { - - /* - * If we are given an Item or a Block, convert it to an ItemStack for further inspection - */ - if (object instanceof Item) { - object = new ItemStack((Item) object); - } - else if (object instanceof Block) { - object = new ItemStack((Block) object); - } - - /* - * We are given an ItemStack to wrap - */ - if (object instanceof ItemStack) { - - ItemStack itemStack = (ItemStack) object; - - /* - * If the ItemStack does not exist in the OreDictionary, wrap it as - * an ItemStack - */ - if (OreDictionary.getOreID(itemStack) == Reference.ORE_DICTIONARY_NOT_FOUND) { - this.itemStack = itemStack.copy(); - oreStack = null; - energyStack = null; - stackSize = this.itemStack.stackSize; - this.itemStack.stackSize = 1; - } - /* - * Else the ItemStack exists in the OreDictionary, so wrap it as an - * OreStack instead of an ItemStack - */ - else { - this.itemStack = null; - oreStack = new OreStack(itemStack); - energyStack = null; - stackSize = oreStack.stackSize; - oreStack.stackSize = 1; - } - } - /* - * Or we are given an OreStack to wrap - */ - else if (object instanceof OreStack) { - - itemStack = null; - oreStack = (OreStack) object; - energyStack = null; - stackSize = oreStack.stackSize; - oreStack.stackSize = 1; - } - else if (object instanceof ArrayList) { - - itemStack = null; - - ArrayList objectList = (ArrayList) object; - - if (!objectList.isEmpty()) { - for (Object listElement : objectList) { - if (listElement instanceof ItemStack) { - ItemStack stack = (ItemStack) listElement; - - if (OreDictionary.getOreID(stack) != Reference.ORE_DICTIONARY_NOT_FOUND) { - oreStack = new OreStack(stack); - stackSize = oreStack.stackSize; - oreStack.stackSize = 1; - break; - } - } - } - } - - energyStack = null; - } - /* - * Or we are given an EnergyStack to wrap - */ - else if (object instanceof EnergyStack) { - itemStack = null; - oreStack = null; - energyStack = (EnergyStack) object; - stackSize = energyStack.stackSize; - energyStack.stackSize = 1; - } - else if (object instanceof CustomWrappedStack) { - CustomWrappedStack wrappedStack = (CustomWrappedStack) object; - - itemStack = wrappedStack.itemStack; - oreStack = wrappedStack.oreStack; - energyStack = wrappedStack.energyStack; - stackSize = wrappedStack.stackSize; - } - /* - * Else, we are given something we cannot wrap - */ - else { - stackSize = -1; - } - } - - /** - * Returns the stack size of the wrapped stack, or -1 if we wrapped an - * invalid input - * - * @return The size of the wrapped stack - */ - public int getStackSize() { - - return stackSize; - } - - /** - * Sets the size of the wrapped stack - * - * @param stackSize - * The new size of the wrapped stack - */ - public void setStackSize(int stackSize) { - - this.stackSize = stackSize; - } - - /** - * Returns the wrapped stack - * - * @return The wrapped ItemStack, OreStack, or EnergyStack, or null if - * something other than an ItemStack, OreStack, or EnergyStack was - * used to create this object - */ - public Object getWrappedStack() { - - if (itemStack != null) { - return itemStack; - } - else if (oreStack != null) { - return oreStack; - } - else if (energyStack != null) { - return energyStack; - } - - return null; - } - - @Override - public boolean equals(Object object) { - - if (!(object instanceof CustomWrappedStack)) - return false; - - CustomWrappedStack customWrappedStack = (CustomWrappedStack) object; - - if (itemStack != null) { - if (customWrappedStack.itemStack != null) - return ItemUtil.compare(itemStack, customWrappedStack.itemStack) && stackSize == customWrappedStack.itemStack.stackSize; - else if (customWrappedStack.oreStack != null) { - for (ItemStack oreDictItemStack : OreDictionary.getOres(customWrappedStack.oreStack.oreName)) { - if (ItemUtil.compare(itemStack, oreDictItemStack) && stackSize == customWrappedStack.stackSize) - return true; - } - } - } - else if (oreStack != null) { - if (customWrappedStack.itemStack != null) { - for (ItemStack oreDictItemStack : OreDictionary.getOres(oreStack.oreName)) { - if (ItemUtil.compare(customWrappedStack.itemStack, oreDictItemStack) && stackSize == customWrappedStack.stackSize) - return true; - } - } - else if (customWrappedStack.oreStack != null) - return oreStack.oreName.equalsIgnoreCase(customWrappedStack.oreStack.oreName) && stackSize == customWrappedStack.stackSize; - } - else if (energyStack != null) { - if (customWrappedStack.energyStack != null) { - return energyStack.energyName.equalsIgnoreCase(customWrappedStack.energyStack.energyName) && stackSize == customWrappedStack.stackSize; - } - } - - return false; - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - if (itemStack != null) { - stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", this.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getItemName(), itemStack.getItem().getClass().getCanonicalName())); - } - else if (oreStack != null) { - stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName)); - } - else if (energyStack != null) { - stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName)); - } - else { - stringBuilder.append("null"); - } - - return stringBuilder.toString(); - } - - public String encodeAsPropertyKey() { - - StringBuilder stringBuilder = new StringBuilder(); - - if (itemStack != null) { - stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", this.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getItemName(), itemStack.getItem().getClass().getCanonicalName())); - } - else if (oreStack != null) { - stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName)); - } - else if (energyStack != null) { - stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName)); - } - - return stringBuilder.toString(); - } - - @Override - public int hashCode() { - - int hashCode = 1; - - hashCode = 37 * hashCode + stackSize; - - if (itemStack != null) { - hashCode = 37 * hashCode + itemStack.itemID; - - if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - hashCode = 37 * hashCode; - } - else { - hashCode = 37 * hashCode + itemStack.getItemDamage(); - } - - try { - hashCode = 37 * hashCode + itemStack.getItemName().hashCode(); - } catch (ArrayIndexOutOfBoundsException e) { - - } - } - else if (oreStack != null) { - hashCode = 37 * hashCode + oreStack.oreName.hashCode(); - } - else if (energyStack != null) { - hashCode = 37 * hashCode + energyStack.energyName.hashCode(); - } - - return hashCode; - } - - public static boolean canBeWrapped(Object object) { - - return (object instanceof CustomWrappedStack || object instanceof ItemStack || object instanceof OreStack || object instanceof EnergyStack || object instanceof Item || object instanceof Block); - } -} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java deleted file mode 100644 index 48079f93..00000000 --- a/ee3_common/com/pahimar/ee3/item/crafting/RecipeRegistry.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.core.util.EnergyStack; -import com.pahimar.ee3.core.util.ItemUtil; -import com.pahimar.ee3.core.util.OreStack; -import com.pahimar.ee3.core.util.RecipeHelper; -import com.pahimar.ee3.item.CustomWrappedStack; - -public class RecipeRegistry { - - private static RecipeRegistry recipeRegistry = null; - - private Multimap> recipeMap; - private ArrayList discoveredStacks; - private ArrayList recipelessStacks; - private List wildCardStacks; - - private RecipeRegistry() { - - recipeMap = HashMultimap.create(); - wildCardStacks = RecipeHelper.populateWildCards(); - discoveredStacks = new ArrayList(); - recipelessStacks = new ArrayList(); - } - - public static RecipeRegistry getInstance() { - - if (recipeRegistry == null) { - recipeRegistry = new RecipeRegistry(); - recipeRegistry.init(); - } - - return recipeRegistry; - } - - private void init() { - - Multimap> recipes = HashMultimap.create(); - - // Add potion recipes - recipes.putAll(RecipesPotions.getPotionRecipes()); - - // Add smelting recipes in the vanilla smelting manager - recipes.putAll(RecipesSmelting.getSmeltingRecipes()); - - // Add recipes in the vanilla crafting manager - recipes.putAll(RecipesVanilla.getVanillaRecipes()); - - // Add recipes gathered via IMC - // TODO Gather IMC recipes - - // Populate the discovered stacks list with all stacks that we are involved in a recipe we are aware of - discoverStacks(recipes); - - // Add items that have no recipe, using the list of discovered stacks to determine if it's in a recipe or not - for (CustomWrappedStack stack : recipelessStacks) { - recipes.put(stack, new ArrayList()); - } - - // Iterate through every recipe in the map, and add them to the registry - Set recipeKeySet = recipes.keySet(); - Iterator recipeKeySetIterator = recipeKeySet.iterator(); - CustomWrappedStack recipeOutput = null; - - while (recipeKeySetIterator.hasNext()) { - recipeOutput = recipeKeySetIterator.next(); - - for (List recipeInputs : recipes.get(recipeOutput)) { - addRecipe(recipeOutput, recipeInputs); - } - } - } - - private void discoverStacks(Multimap> recipes) { - - Set recipeKeySet = recipes.keySet(); - Iterator recipeKeySetIterator = recipeKeySet.iterator(); - CustomWrappedStack recipeOutput = null; - - // Discover all stacks involved in the recipes we know about - while (recipeKeySetIterator.hasNext()) { - recipeOutput = recipeKeySetIterator.next(); - - if (!discoveredStacks.contains(new CustomWrappedStack(recipeOutput.getWrappedStack())) && recipeOutput.getWrappedStack() != null) { - discoveredStacks.add(new CustomWrappedStack(recipeOutput.getWrappedStack())); - } - - for (List recipeInputs : recipes.get(recipeOutput)) { - for (CustomWrappedStack recipeInput : recipeInputs) { - - CustomWrappedStack unwrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack()); - - if (!discoveredStacks.contains(unwrappedRecipeInput) && recipeInput.getWrappedStack() != null) { - discoveredStacks.add(unwrappedRecipeInput); - } - } - } - } - - CustomWrappedStack customWrappedStack; - - // Discover all stacks from the vanilla Items array - for (int i = 0; i < Item.itemsList.length; i++) { - - if (Item.itemsList[i] != null) { - - if (Item.itemsList[i].getHasSubtypes()) { - - for (int meta = 0; meta < 16; meta++) { - - customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta)); - - if (!discoveredStacks.contains(customWrappedStack)) { - discoveredStacks.add(customWrappedStack); - } - } - } - else { - - customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i])); - - if (!discoveredStacks.contains(customWrappedStack)) { - discoveredStacks.add(customWrappedStack); - } - } - } - } - - /* - * For every stack we have discovered, check to see if we know a recipe for it. If we don't - * and we haven't already added it to the recipeless stack list, add it to the recipeless stack - * list - */ - for (CustomWrappedStack discoveredStack : discoveredStacks) { - - if (recipes.get(discoveredStack).size() == 0 && !recipelessStacks.contains(discoveredStack)) { - recipelessStacks.add(discoveredStack); - } - } - } - - public boolean hasRecipe(CustomWrappedStack customWrappedStack) { - - return recipeMap.containsKey(customWrappedStack); - } - - public boolean hasRecipe(ItemStack itemStack) { - - return hasRecipe(new CustomWrappedStack(itemStack)); - } - - public int countRecipesFor(CustomWrappedStack customWrappedStack) { - - Collection> keys = recipeMap.get(customWrappedStack); - - return keys.size(); - } - - public int countRecipesFor(ItemStack itemStack) { - - return countRecipesFor(new CustomWrappedStack(itemStack)); - } - - public Collection> getRecipesFor(CustomWrappedStack customWrappedStack) { - - return recipeMap.get(customWrappedStack); - } - - public Collection> getRecipesFor(ItemStack itemStack) { - - return getRecipesFor(new CustomWrappedStack(itemStack)); - } - - /* - * Item: Item (Output) <- { ... } - */ - public void addRecipe(CustomWrappedStack recipeOutput, List recipeInputs) { - - ArrayList collatedStacks = new ArrayList(); - - CustomWrappedStack wrappedInputStack = null; - boolean found = false; - - /** - * For every input in the input list, check to see if we have discovered - * it already - If we have, add it to the one we already have - If we - * have not, add it to the collection of discovered items - */ - for (Object object : recipeInputs) { - - if (object instanceof ItemStack || object instanceof OreStack) { - wrappedInputStack = new CustomWrappedStack(object); - } - else if (object instanceof CustomWrappedStack) { - wrappedInputStack = (CustomWrappedStack) object; - } - - if (wildCardStacks.contains(wrappedInputStack)) { - Iterator wildIter = wildCardStacks.iterator(); - while (wildIter.hasNext()) { - CustomWrappedStack wildCard = wildIter.next(); - if (wildCard.equals(wrappedInputStack)) { - wrappedInputStack = wildCard; - break; - } - } - } - - if (collatedStacks.size() == 0) { - collatedStacks.add(wrappedInputStack); - } - else { - found = false; - - for (int i = 0; i < collatedStacks.size(); i++) { - if (collatedStacks.get(i) != null) { - if (wrappedInputStack.getWrappedStack() instanceof ItemStack && collatedStacks.get(i).getWrappedStack() instanceof ItemStack) { - if (ItemUtil.compare((ItemStack) wrappedInputStack.getWrappedStack(), (ItemStack) collatedStacks.get(i).getWrappedStack())) { - collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + wrappedInputStack.getStackSize()); - found = true; - } - } - else if (wrappedInputStack.getWrappedStack() instanceof OreStack && collatedStacks.get(i).getWrappedStack() instanceof OreStack) { - if (OreStack.compareStacks((OreStack) wrappedInputStack.getWrappedStack(), (OreStack) collatedStacks.get(i).getWrappedStack())) { - collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + wrappedInputStack.getStackSize()); - found = true; - } - } - else if (wrappedInputStack.getWrappedStack() instanceof EnergyStack && collatedStacks.get(i).getWrappedStack() instanceof EnergyStack) { - if (((EnergyStack) wrappedInputStack.getWrappedStack()).energyName.equalsIgnoreCase(((EnergyStack) collatedStacks.get(i).getWrappedStack()).energyName)) { - collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + wrappedInputStack.getStackSize()); - found = true; - } - } - } - } - - if (!found) { - collatedStacks.add(wrappedInputStack); - } - } - } - - if (!recipeMap.containsEntry(recipeOutput, collatedStacks)) { - recipeMap.put(recipeOutput, collatedStacks); - } - } - - public int size() { - - return recipeMap.size(); - } - - @Override - public String toString() { - - StringBuilder stringBuilder = new StringBuilder(); - - for (CustomWrappedStack key : recipeMap.keySet()) { - - Collection> recipeMappings = recipeMap.get(key); - - for (List recipeList : recipeMappings) { - stringBuilder.append(String.format("Recipe Output: %s, Recipe Input: %s\n", key.toString(), recipeList.toString())); - } - } - - return stringBuilder.toString(); - } - - public Multimap> getRecipeMappings() { - - return recipeMap; - } - - public List getDiscoveredStacks() { - - return discoveredStacks; - } - - public List getRecipelessStacks() { - - return recipelessStacks; - } - - public List getWildCardStacks() { - - return wildCardStacks; - } -} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java deleted file mode 100644 index c270bac9..00000000 --- a/ee3_common/com/pahimar/ee3/item/crafting/RecipesPotions.java +++ /dev/null @@ -1,292 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.item.CustomWrappedStack; - -public class RecipesPotions { - - private static Multimap> potionRecipes = null; - - private static CustomWrappedStack reagentWater = new CustomWrappedStack(new ItemStack(Block.waterStill)); - private static CustomWrappedStack reagentNetherWart = new CustomWrappedStack(new ItemStack(372, 1, 0)); - private static CustomWrappedStack reagentGlowstoneDust = new CustomWrappedStack(new ItemStack(Item.glowstone)); - private static CustomWrappedStack reagentRedstoneDust = new CustomWrappedStack(new ItemStack(331, 1, 0)); - private static CustomWrappedStack reagentGunpowder = new CustomWrappedStack(new ItemStack(Item.gunpowder)); - private static CustomWrappedStack reagentGoldenCarrot = new CustomWrappedStack(new ItemStack(Item.goldenCarrot)); - private static CustomWrappedStack reagentMagmaCream = new CustomWrappedStack(new ItemStack(Item.magmaCream)); - private static CustomWrappedStack reagentSugar = new CustomWrappedStack(new ItemStack(Item.sugar)); - private static CustomWrappedStack reagentGlisteringMelon = new CustomWrappedStack(new ItemStack(Item.speckledMelon)); - private static CustomWrappedStack reagentSpiderEye = new CustomWrappedStack(new ItemStack(Item.spiderEye)); - private static CustomWrappedStack reagentGhastTear = new CustomWrappedStack(new ItemStack(Item.ghastTear)); - private static CustomWrappedStack reagentFermentedSpiderEye = new CustomWrappedStack(new ItemStack(Item.fermentedSpiderEye)); - private static CustomWrappedStack reagentBlazePowder = new CustomWrappedStack(new ItemStack(Item.blazePowder)); - - private static CustomWrappedStack bottleWater = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 0)); - - private static CustomWrappedStack potionAwkward = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16)); - private static CustomWrappedStack potionThick = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 32)); - private static CustomWrappedStack potionMundane = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 128)); - private static CustomWrappedStack potionMundaneExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 64)); - private static CustomWrappedStack potionMundaneSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16512)); - private static CustomWrappedStack potionMundaneSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16448)); - - private static CustomWrappedStack potionRegeneration = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8193)); - private static CustomWrappedStack potionRegenerationEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8225)); - private static CustomWrappedStack potionRegenerationExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8257)); - private static CustomWrappedStack potionRegenerationSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16385)); - private static CustomWrappedStack potionRegenerationSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16417)); - private static CustomWrappedStack potionRegenerationSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16449)); - - private static CustomWrappedStack potionSwiftness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8194)); - private static CustomWrappedStack potionSwiftnessEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8226)); - private static CustomWrappedStack potionSwiftnessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8258)); - private static CustomWrappedStack potionSwiftnessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16386)); - private static CustomWrappedStack potionSwiftnessSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16418)); - private static CustomWrappedStack potionSwiftnessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16450)); - - private static CustomWrappedStack potionFireResist = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8195)); - private static CustomWrappedStack potionFireResistExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8259)); - private static CustomWrappedStack potionFireResistSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16387)); - private static CustomWrappedStack potionFireResistSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16451)); - - private static CustomWrappedStack potionPoison = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8196)); - private static CustomWrappedStack potionPoisonEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8228)); - private static CustomWrappedStack potionPoisonExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8260)); - private static CustomWrappedStack potionPoisonSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16388)); - private static CustomWrappedStack potionPoisonSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16420)); - private static CustomWrappedStack potionPoisonSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16452)); - - private static CustomWrappedStack potionHealing = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8197)); - private static CustomWrappedStack potionHealingEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8229)); - private static CustomWrappedStack potionHealingSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16389)); - private static CustomWrappedStack potionHealingSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16421)); - - private static CustomWrappedStack potionNightVision = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8198)); - private static CustomWrappedStack potionNightVisionExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8262)); - private static CustomWrappedStack potionNightVisionSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16390)); - private static CustomWrappedStack potionNightVisionSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16454)); - - private static CustomWrappedStack potionWeakness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8200)); - private static CustomWrappedStack potionWeaknessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8264)); - private static CustomWrappedStack potionWeaknessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16392)); - private static CustomWrappedStack potionWeaknessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16456)); - - private static CustomWrappedStack potionStrength = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8201)); - private static CustomWrappedStack potionStrengthEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8233)); - private static CustomWrappedStack potionStrengthExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8265)); - private static CustomWrappedStack potionStrengthSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16393)); - private static CustomWrappedStack potionStrengthSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16425)); - private static CustomWrappedStack potionStrengthSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16457)); - - private static CustomWrappedStack potionSlowness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8202)); - private static CustomWrappedStack potionSlownessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8266)); - private static CustomWrappedStack potionSlownessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16394)); - private static CustomWrappedStack potionSlownessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16458)); - - private static CustomWrappedStack potionHarming = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8204)); - private static CustomWrappedStack potionHarmingEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8236)); - private static CustomWrappedStack potionHarmingSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16396)); - private static CustomWrappedStack potionHarmingSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16428)); - - private static CustomWrappedStack potionInvisibility = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8206)); - private static CustomWrappedStack potionInvisibilityExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8270)); - private static CustomWrappedStack potionInvisibilitySplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16398)); - private static CustomWrappedStack potionInvisibilitySplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16462)); - - public static Multimap> getPotionRecipes() { - - if (potionRecipes == null) { - init(); - } - - return potionRecipes; - } - - private static void init() { - - potionRecipes = HashMultimap.create(); - - potionRecipes.put(bottleWater, Arrays.asList(reagentWater)); - - potionRecipes.put(potionAwkward, Arrays.asList(bottleWater, reagentNetherWart)); - - potionRecipes.put(potionNightVision, Arrays.asList(potionAwkward, reagentGoldenCarrot)); - potionRecipes.put(potionNightVision, Arrays.asList(potionNightVisionExtended, reagentGlowstoneDust)); - potionRecipes.put(potionNightVisionSplash, Arrays.asList(potionNightVisionSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionNightVisionSplash, Arrays.asList(potionNightVision, reagentGunpowder)); - - potionRecipes.put(potionNightVisionExtended, Arrays.asList(potionNightVision, reagentRedstoneDust)); - potionRecipes.put(potionNightVisionSplashExtended, Arrays.asList(potionNightVisionSplash, reagentRedstoneDust)); - potionRecipes.put(potionNightVisionSplashExtended, Arrays.asList(potionNightVisionExtended, reagentGunpowder)); - - potionRecipes.put(potionInvisibility, Arrays.asList(potionNightVision, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibility, Arrays.asList(potionInvisibilityExtended, reagentGlowstoneDust)); - potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionNightVisionSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionInvisibilitySplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionInvisibility, reagentGunpowder)); - - potionRecipes.put(potionInvisibilityExtended, Arrays.asList(potionInvisibility, reagentRedstoneDust)); - potionRecipes.put(potionInvisibilityExtended, Arrays.asList(potionNightVisionExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionInvisibilitySplash, reagentRedstoneDust)); - potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionNightVisionSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionInvisibilityExtended, reagentGunpowder)); - - potionRecipes.put(potionFireResist, Arrays.asList(potionAwkward, reagentMagmaCream)); - potionRecipes.put(potionFireResist, Arrays.asList(potionFireResistExtended, reagentGlowstoneDust)); - potionRecipes.put(potionFireResistSplash, Arrays.asList(potionFireResistSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionFireResistSplash, Arrays.asList(potionFireResist, reagentGunpowder)); - - potionRecipes.put(potionFireResistExtended, Arrays.asList(potionFireResist, reagentRedstoneDust)); - potionRecipes.put(potionFireResistSplashExtended, Arrays.asList(potionFireResistSplash, reagentRedstoneDust)); - potionRecipes.put(potionFireResistSplashExtended, Arrays.asList(potionFireResistExtended, reagentGunpowder)); - - potionRecipes.put(potionSlowness, Arrays.asList(potionFireResist, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlowness, Arrays.asList(potionSlownessExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSlowness, Arrays.asList(potionSwiftness, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlowness, Arrays.asList(potionSwiftnessExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionFireResistSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSlownessSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSwiftnessSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSwiftnessSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSlowness, reagentGunpowder)); - - potionRecipes.put(potionSlownessExtended, Arrays.asList(potionFireResistExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessExtended, Arrays.asList(potionSwiftnessEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionFireResistSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionSwiftnessSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionSlownessExtended, reagentGunpowder)); - - potionRecipes.put(potionSwiftness, Arrays.asList(potionAwkward, reagentSugar)); - potionRecipes.put(potionSwiftnessSplash, Arrays.asList(potionSwiftness, reagentGunpowder)); - - potionRecipes.put(potionSwiftnessExtended, Arrays.asList(potionSwiftness, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessExtended, Arrays.asList(potionSwiftnessEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessSplash, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessExtended, reagentGunpowder)); - - potionRecipes.put(potionSwiftnessEnhanced, Arrays.asList(potionSwiftness, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessEnhanced, Arrays.asList(potionSwiftnessExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessSplash, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessEnhanced, reagentGunpowder)); - - potionRecipes.put(potionHealing, Arrays.asList(potionAwkward, reagentGlisteringMelon)); - potionRecipes.put(potionHealing, Arrays.asList(potionHealingEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHealingSplash, Arrays.asList(potionHealingSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHealingSplash, Arrays.asList(potionHealing, reagentGunpowder)); - - potionRecipes.put(potionHealingEnhanced, Arrays.asList(potionHealing, reagentGlowstoneDust)); - potionRecipes.put(potionHealingSplashEnhanced, Arrays.asList(potionHealingSplash, reagentGlowstoneDust)); - potionRecipes.put(potionHealingSplashEnhanced, Arrays.asList(potionHealingEnhanced, reagentGunpowder)); - - potionRecipes.put(potionHarming, Arrays.asList(potionHealing, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarming, Arrays.asList(potionPoison, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarming, Arrays.asList(potionPoisonExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarming, Arrays.asList(potionHarmingEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHealingSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionPoisonSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionPoisonSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHarmingSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHarming, reagentGunpowder)); - - potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionHealingEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionHarming, reagentGlowstoneDust)); - potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionPoisonEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHealingSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHarmingSplash, reagentGlowstoneDust)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionPoisonSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHarmingEnhanced, reagentGunpowder)); - - potionRecipes.put(potionPoison, Arrays.asList(potionAwkward, reagentSpiderEye)); - potionRecipes.put(potionPoisonSplash, Arrays.asList(potionPoison, reagentGunpowder)); - - potionRecipes.put(potionPoisonExtended, Arrays.asList(potionPoisonExtended, reagentRedstoneDust)); - potionRecipes.put(potionPoisonExtended, Arrays.asList(potionPoisonEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonSplashExtended, reagentRedstoneDust)); - potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonExtended, reagentGunpowder)); - - potionRecipes.put(potionPoisonEnhanced, Arrays.asList(potionPoison, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonEnhanced, Arrays.asList(potionPoisonExtended, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonSplash, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonEnhanced, reagentGunpowder)); - - potionRecipes.put(potionRegeneration, Arrays.asList(potionAwkward, reagentGhastTear)); - potionRecipes.put(potionRegenerationSplash, Arrays.asList(potionRegeneration, reagentGunpowder)); - - potionRecipes.put(potionRegenerationExtended, Arrays.asList(potionRegeneration, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationExtended, Arrays.asList(potionRegenerationEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationSplash, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationExtended, reagentGunpowder)); - - potionRecipes.put(potionRegenerationEnhanced, Arrays.asList(potionRegeneration, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationEnhanced, Arrays.asList(potionRegenerationExtended, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationSplash, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationEnhanced, reagentGunpowder)); - - potionRecipes.put(potionWeakness, Arrays.asList(potionAwkward, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionRegeneration, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionRegenerationEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionStrength, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionStrengthEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionMundane, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionWeaknessExtended, reagentGlowstoneDust)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionRegenerationSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionRegenerationSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionStrengthSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionStrengthSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionMundaneSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionWeaknessSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionWeakness, reagentGunpowder)); - - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionWeakness, reagentRedstoneDust)); - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionRegenerationExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionStrengthExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionMundaneExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionWeaknessSplash, reagentRedstoneDust)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionRegenerationSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionStrengthSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionMundaneSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionWeaknessExtended, reagentGunpowder)); - - potionRecipes.put(potionStrength, Arrays.asList(potionAwkward, reagentBlazePowder)); - potionRecipes.put(potionStrengthSplash, Arrays.asList(potionStrength, reagentGunpowder)); - - potionRecipes.put(potionStrengthEnhanced, Arrays.asList(potionStrength, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthEnhanced, Arrays.asList(potionStrengthExtended, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthSplash, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthEnhanced, reagentGunpowder)); - - potionRecipes.put(potionStrengthExtended, Arrays.asList(potionStrength, reagentRedstoneDust)); - potionRecipes.put(potionStrengthExtended, Arrays.asList(potionStrengthEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthSplash, reagentRedstoneDust)); - potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthExtended, reagentGunpowder)); - - potionRecipes.put(potionThick, Arrays.asList(bottleWater, reagentGlowstoneDust)); - - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentSugar)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentGlisteringMelon)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentSpiderEye)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentBlazePowder)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentMagmaCream)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentGhastTear)); - potionRecipes.put(potionMundaneSplash, Arrays.asList(potionMundane, reagentGunpowder)); - - potionRecipes.put(potionMundaneExtended, Arrays.asList(bottleWater, reagentRedstoneDust)); - potionRecipes.put(potionMundaneSplashExtended, Arrays.asList(potionMundaneExtended, reagentGunpowder)); - } -} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java deleted file mode 100644 index 21f3e7c0..00000000 --- a/ee3_common/com/pahimar/ee3/item/crafting/RecipesSmelting.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.core.util.EnergyStack; -import com.pahimar.ee3.item.CustomWrappedStack; - -public class RecipesSmelting { - - private static Multimap> smeltingRecipes = null; - - private static final CustomWrappedStack smeltingEnergy = new CustomWrappedStack(new EnergyStack(EnergyStack.VANILLA_SMELTING_ENERGY_NAME, EnergyStack.VANILLA_SMELTING_ENERGY_THRESHOLD)); - - public static Multimap> getSmeltingRecipes() { - - if (smeltingRecipes == null) { - init(); - } - - return smeltingRecipes; - } - - private static void init() { - - smeltingRecipes = HashMultimap.create(); - - @SuppressWarnings("unchecked") - Map smeltingList = FurnaceRecipes.smelting().getSmeltingList(); - Map, ItemStack> metaSmeltingList = FurnaceRecipes.smelting().getMetaSmeltingList(); - - for (Integer i : smeltingList.keySet()) { - smeltingRecipes.put(new CustomWrappedStack(smeltingList.get(i)), Arrays.asList(smeltingEnergy, new CustomWrappedStack(new ItemStack(i, 1, 0)))); - } - - for (List idMetaPair : metaSmeltingList.keySet()) { - if (idMetaPair.size() == 2) { - smeltingRecipes.put(new CustomWrappedStack(metaSmeltingList.get(idMetaPair)), Arrays.asList(smeltingEnergy, new CustomWrappedStack(new ItemStack(idMetaPair.get(0), 1, idMetaPair.get(1))))); - } - } - } -} diff --git a/ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java b/ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java deleted file mode 100644 index 5b504acb..00000000 --- a/ee3_common/com/pahimar/ee3/item/crafting/RecipesVanilla.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.core.util.RecipeHelper; -import com.pahimar.ee3.item.CustomWrappedStack; - -public class RecipesVanilla { - - private static Multimap> vanillaRecipes = null; - - ArrayList discoveredItems = new ArrayList(); - - public static Multimap> getVanillaRecipes() { - - if (vanillaRecipes == null) { - init(); - } - - return vanillaRecipes; - } - - private static void init() { - - vanillaRecipes = HashMultimap.create(); - - for (Object recipeObject : CraftingManager.getInstance().getRecipeList()) { - - if (recipeObject instanceof IRecipe) { - - IRecipe recipe = (IRecipe) recipeObject; - ItemStack recipeOutput = recipe.getRecipeOutput(); - - if (recipeOutput != null) { - - ArrayList recipeInputs = RecipeHelper.getRecipeInputs(recipe); - vanillaRecipes.put(new CustomWrappedStack(recipeOutput), recipeInputs); - } - } - } - } -} diff --git a/ee3_common/com/pahimar/ee3/lib/InterModComms.java b/ee3_common/com/pahimar/ee3/lib/InterModComms.java deleted file mode 100644 index c4133e50..00000000 --- a/ee3_common/com/pahimar/ee3/lib/InterModComms.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pahimar.ee3.lib; - -public class InterModComms { - - // Interacting with the Recipe Registry - public static final String ADD_RECIPE = "add-recipe"; - - // Interacting with the EMC BlackList - public static final String ADD_BLACKLIST_ENTRY = "add-blacklist-entry"; - public static final String REMOVE_BLACKLIST_ENTRY = "remove-blacklist-entry"; - - // Interacting with the EMC value mappings - public static final String SET_EMC_VALUE = "set-emc-value"; -} diff --git a/ee3_common/com/pahimar/ee3/nbt/NBTHelper.java b/ee3_common/com/pahimar/ee3/nbt/NBTHelper.java deleted file mode 100644 index 06e87be5..00000000 --- a/ee3_common/com/pahimar/ee3/nbt/NBTHelper.java +++ /dev/null @@ -1,508 +0,0 @@ -package com.pahimar.ee3.nbt; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagByteArray; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagEnd; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.nbt.NBTTagIntArray; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.nbt.NBTTagString; - -import com.pahimar.ee3.core.util.EnergyStack; -import com.pahimar.ee3.core.util.OreStack; -import com.pahimar.ee3.item.CustomWrappedStack; -import com.pahimar.ee3.lib.Strings; - -/** - * Equivalent-Exchange-3 - * - * NBTHelper - * - * @author pahimar - * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) - * - */ -public class NBTHelper { - - /** - * Encodes the given NBT object as a String - * @param nbtBase - * @return String encoding of the given NBT object - */ - public static String encodeNBTAsString(NBTBase nbtBase) { - - StringBuilder stringBuilder = new StringBuilder(); - - if (nbtBase != null) { - // Encode the name of the tag, and the type of the tag - stringBuilder.append(String.format("'%s':%s:", nbtBase.getName(), NBTBase.getTagName(nbtBase.getId()))); - - // Encode the value of the tag, depending on the type of the tag - switch (nbtBase.getId()) - { - case 0: { - stringBuilder.append(((NBTTagEnd) nbtBase).toString()); - break; - } - case 1: { - stringBuilder.append(String.format("%s", ((NBTTagByte) nbtBase).data)); - break; - } - case 2: { - stringBuilder.append(String.format("%s", ((NBTTagShort) nbtBase).data)); - break; - } - case 3: { - stringBuilder.append(String.format("%s", ((NBTTagInt) nbtBase).data)); - break; - } - case 4: { - stringBuilder.append(String.format("%s", ((NBTTagLong) nbtBase).data)); - break; - } - case 5: { - stringBuilder.append(String.format("%s", ((NBTTagFloat) nbtBase).data)); - break; - } - case 6: { - stringBuilder.append(String.format("%s", ((NBTTagDouble) nbtBase).data)); - break; - } - case 7: { - NBTTagByteArray byteArray = (NBTTagByteArray) nbtBase; - - stringBuilder.append("["); - - for (int i = 0; i < byteArray.byteArray.length; i++) { - stringBuilder.append(byteArray.byteArray[i]); - - if (i < byteArray.byteArray.length - 1) { - stringBuilder.append("|"); - } - } - - stringBuilder.append("]"); - - break; - } - case 8: { - stringBuilder.append(String.format("%s", ((NBTTagString) nbtBase).data)); - break; - } - case 9: { - NBTTagList tagList = (NBTTagList) nbtBase; - - stringBuilder.append("["); - - for (int i = 0; i < tagList.tagCount(); i++) { - Object tagObject = tagList.tagAt(i); - - if (tagObject instanceof NBTBase) { - stringBuilder.append(encodeNBTAsString((NBTBase) tagObject)); - } - - if (i < tagList.tagCount() - 1) { - stringBuilder.append("|"); - } - } - - stringBuilder.append("]"); - - break; - } - case 10: { - NBTTagCompound tagCompound = (NBTTagCompound) nbtBase; - - stringBuilder.append("["); - - Iterator tagIterator = tagCompound.getTags().iterator(); - - while (tagIterator.hasNext()) { - Object tagObject = tagIterator.next(); - - if (tagObject instanceof NBTBase) { - stringBuilder.append(encodeNBTAsString((NBTBase) tagObject)); - } - - if (tagIterator.hasNext()) { - stringBuilder.append("|"); - } - } - - stringBuilder.append("]"); - - break; - } - case 11: { - NBTTagIntArray intArray = (NBTTagIntArray) nbtBase; - - stringBuilder.append("["); - - for (int i = 0; i < intArray.intArray.length; i++) { - stringBuilder.append(intArray.intArray[i]); - - if (i < intArray.intArray.length - 1) { - stringBuilder.append("|"); - } - } - - stringBuilder.append("]"); - - break; - } - default: { - stringBuilder.append("UNKNOWN"); - break; - } - } - } - - return stringBuilder.toString(); - } - - // TODO Link this method to some API stuffs - public static NBTTagCompound encodeStackAsNBT(Object stackObject) { - - return encodeStackAsNBT("", stackObject); - } - - public static NBTTagCompound encodeStackAsNBT(String name, Object object) { - - NBTTagCompound encodedStack = new NBTTagCompound(name); - - if (CustomWrappedStack.canBeWrapped(object)) { - - CustomWrappedStack wrappedStack = new CustomWrappedStack(object); - - if (wrappedStack.getWrappedStack() instanceof ItemStack) { - - ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack(); - encodedStack.setString(Strings.NBT_ENCODED_ATTR_TYPE, Strings.NBT_ENCODED_ATTR_TYPE_ITEM); - itemStack.writeToNBT(encodedStack); - } - else if (wrappedStack.getWrappedStack() instanceof OreStack) { - OreStack oreStack = (OreStack) wrappedStack.getWrappedStack(); - - encodedStack.setString(Strings.NBT_ENCODED_ATTR_TYPE, Strings.NBT_ENCODED_ATTR_TYPE_ORE); - encodedStack.setString(Strings.NBT_ENCODED_ATTR_ORE_NAME, oreStack.oreName); - encodedStack.setShort(Strings.NBT_ENCODED_ATTR_SIZE, (short) wrappedStack.getStackSize()); - } - else if (wrappedStack.getWrappedStack() instanceof EnergyStack) { - EnergyStack energyStack = (EnergyStack) wrappedStack.getWrappedStack(); - - encodedStack.setString(Strings.NBT_ENCODED_ATTR_TYPE, Strings.NBT_ENCODED_ATTR_TYPE_ENERGY); - encodedStack.setString(Strings.NBT_ENCODED_ATTR_ENERGY_NAME, energyStack.energyName); - encodedStack.setShort(Strings.NBT_ENCODED_ATTR_SIZE, (short) wrappedStack.getStackSize()); - } - } - - return encodedStack; - } - - public static NBTTagCompound encodeRecipeAsNBT(Object recipeOutput, List recipeInputs) { - - NBTTagCompound encodedRecipe = new NBTTagCompound(); - - NBTTagCompound recipeOutputNBTCompound = encodeStackAsNBT(Strings.NBT_ENCODED_RECIPE_OUTPUT, recipeOutput); - NBTTagList recipeInputsNBTList = new NBTTagList(Strings.NBT_ENCODED_RECIPE_INPUTS); - - for (int i = 0; i < recipeInputs.size(); i++) { - recipeInputsNBTList.appendTag(encodeStackAsNBT(Strings.NBT_ENCODED_RECIPE_INPUT_PREFIX.concat(Integer.toString(i)), recipeInputs.get(i))); - } - - encodedRecipe.setCompoundTag(Strings.NBT_ENCODED_RECIPE_OUTPUT, recipeOutputNBTCompound); - encodedRecipe.setTag(Strings.NBT_ENCODED_RECIPE_INPUTS, recipeInputsNBTList); - - return encodedRecipe; - } - - /** - * - * @param encodedStack - * A NBTTagCompound containing the encoded information of either - * a ItemStack, OreStack, or EnergyStack - * @return A CustomWrappedStack containing the encoded stack provided in the - * NBTTagCompound (could be ItemStack, OreStack, or EnergyStack). - * Returns null in the event that no valid stack was able to be - * parsed from the encoded NBTTagCompound. - */ - public static CustomWrappedStack decodeStackFromNBT(NBTTagCompound encodedStack) { - - CustomWrappedStack decodedStack = null; - - // If the encoded tag compound is of type ItemStack, parse out the ItemStack info - if (encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_TYPE)) { - if (encodedStack.getString(Strings.NBT_ENCODED_ATTR_TYPE).equalsIgnoreCase(Strings.NBT_ENCODED_ATTR_TYPE_ITEM)) { - - ItemStack itemStack = new ItemStack(0, 0, 0); - itemStack.readFromNBT(encodedStack); - decodedStack = new CustomWrappedStack(itemStack); - } - // Else if the encoded tag compound is of type OreStack, parse out the OreStack info - else if (encodedStack.getString(Strings.NBT_ENCODED_ATTR_TYPE).equalsIgnoreCase(Strings.NBT_ENCODED_ATTR_TYPE_ORE)) { - - if (encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_ORE_NAME) && encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_SIZE)) { - if ((encodedStack.getString(Strings.NBT_ENCODED_ATTR_ORE_NAME).length() > 0) && (encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE) >= 0)) { - decodedStack = new CustomWrappedStack(new OreStack(encodedStack.getString(Strings.NBT_ENCODED_ATTR_ORE_NAME), encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE))); - } - } - } - // Else if the encoded tag compound is of type EnergyStack, parse out the EnergyStack info - else if (encodedStack.getString(Strings.NBT_ENCODED_ATTR_TYPE).equalsIgnoreCase(Strings.NBT_ENCODED_ATTR_TYPE_ENERGY)) { - - if (encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_ENERGY_NAME) && encodedStack.hasKey(Strings.NBT_ENCODED_ATTR_SIZE)) { - if ((encodedStack.getString(Strings.NBT_ENCODED_ATTR_ENERGY_NAME).length() > 0) && (encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE) >= 0)) { - decodedStack = new CustomWrappedStack(new EnergyStack(encodedStack.getString(Strings.NBT_ENCODED_ATTR_ENERGY_NAME), encodedStack.getShort(Strings.NBT_ENCODED_ATTR_SIZE))); - } - } - } - } - - /* - * This will only return non-null in the event that a proper - * ItemStack|OreStack|EnergyStack was decoded from the encoded - * NBTTagCompound - */ - return decodedStack; - } - - public static Map> decodeRecipeFromNBT(NBTTagCompound encodedRecipe) { - - HashMap> decodedRecipe = new HashMap>(); - - CustomWrappedStack recipeOutput = null; - ArrayList recipeInputs = new ArrayList(); - - CustomWrappedStack decodedStack = null; - NBTTagCompound encodedStack = null; - - // Decode the recipe output - if (encodedRecipe.hasKey(Strings.NBT_ENCODED_RECIPE_OUTPUT)) { - - decodedStack = decodeStackFromNBT(encodedRecipe.getCompoundTag(Strings.NBT_ENCODED_RECIPE_OUTPUT)); - - if (decodedStack != null) { - recipeOutput = decodedStack; - } - } - - // Decode the recipe inputs - if (encodedRecipe.hasKey("recipeInputs")) { - NBTTagList recipeInputsTagList = encodedRecipe.getTagList(Strings.NBT_ENCODED_RECIPE_INPUTS); - - for (int i = 0; i < recipeInputsTagList.tagCount(); i++) { - if (recipeInputsTagList.tagAt(i) instanceof NBTTagCompound) { - - encodedStack = (NBTTagCompound) recipeInputsTagList.tagAt(i); - decodedStack = decodeStackFromNBT(encodedStack); - - if (decodedStack != null) { - recipeInputs.add(decodedStack); - } - } - } - } - - // If we decoded both a recipe output and some inputs for it, add it to the map - if (recipeOutput != null && recipeInputs.size() > 0) { - decodedRecipe.put(recipeOutput, recipeInputs); - } - - return decodedRecipe; - } - - /** - * Initializes the NBT Tag Compound for the given ItemStack if it is null - * - * @param itemStack - * The ItemStack for which its NBT Tag Compound is being checked - * for initialization - */ - private static void initNBTTagCompound(ItemStack itemStack) { - - if (itemStack.stackTagCompound == null) { - itemStack.setTagCompound(new NBTTagCompound()); - } - } - - public static boolean hasTag(ItemStack itemStack, String keyName) { - - if (itemStack.stackTagCompound != null) - return itemStack.stackTagCompound.hasKey(keyName); - - return false; - } - - public static void removeTag(ItemStack itemStack, String keyName) { - - if (itemStack.stackTagCompound != null) { - itemStack.stackTagCompound.removeTag(keyName); - } - } - - // String - public static String getString(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setString(itemStack, keyName, ""); - } - - return itemStack.stackTagCompound.getString(keyName); - } - - public static void setString(ItemStack itemStack, String keyName, String keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setString(keyName, keyValue); - } - - // boolean - public static boolean getBoolean(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setBoolean(itemStack, keyName, false); - } - - return itemStack.stackTagCompound.getBoolean(keyName); - } - - public static void setBoolean(ItemStack itemStack, String keyName, boolean keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setBoolean(keyName, keyValue); - } - - // byte - public static byte getByte(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setByte(itemStack, keyName, (byte) 0); - } - - return itemStack.stackTagCompound.getByte(keyName); - } - - public static void setByte(ItemStack itemStack, String keyName, byte keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setByte(keyName, keyValue); - } - - // short - public static short getShort(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setShort(itemStack, keyName, (short) 0); - } - - return itemStack.stackTagCompound.getShort(keyName); - } - - public static void setShort(ItemStack itemStack, String keyName, short keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setShort(keyName, keyValue); - } - - // int - public static int getInt(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setInteger(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getInteger(keyName); - } - - public static void setInteger(ItemStack itemStack, String keyName, int keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setInteger(keyName, keyValue); - } - - // long - public static long getLong(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setLong(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getLong(keyName); - } - - public static void setLong(ItemStack itemStack, String keyName, long keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setLong(keyName, keyValue); - } - - // float - public static float getFloat(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setFloat(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getFloat(keyName); - } - - public static void setFloat(ItemStack itemStack, String keyName, float keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setFloat(keyName, keyValue); - } - - // double - public static double getDouble(ItemStack itemStack, String keyName) { - - initNBTTagCompound(itemStack); - - if (!itemStack.stackTagCompound.hasKey(keyName)) { - setDouble(itemStack, keyName, 0); - } - - return itemStack.stackTagCompound.getDouble(keyName); - } - - public static void setDouble(ItemStack itemStack, String keyName, double keyValue) { - - initNBTTagCompound(itemStack); - - itemStack.stackTagCompound.setDouble(keyName, keyValue); - } - -} diff --git a/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java b/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java deleted file mode 100644 index 0fc0193b..00000000 --- a/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -import net.minecraft.network.INetworkManager; -import net.minecraftforge.common.ForgeDirection; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.network.PacketTypeHandler; - -import cpw.mods.fml.common.network.Player; - -public class PacketTileWithItemUpdate extends PacketEE { - - public int x, y, z; - public byte orientation; - public byte state; - public String customName; - public int itemID, metaData, stackSize, color; - - public PacketTileWithItemUpdate() { - - super(PacketTypeHandler.TILE_WITH_ITEM, true); - } - - public PacketTileWithItemUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { - - super(PacketTypeHandler.TILE_WITH_ITEM, true); - this.x = x; - this.y = y; - this.z = z; - this.orientation = (byte) orientation.ordinal(); - this.state = state; - this.customName = customName; - this.itemID = itemID; - this.metaData = metaData; - this.stackSize = stackSize; - this.color = color; - } - - @Override - public void writeData(DataOutputStream data) throws IOException { - - data.writeInt(x); - data.writeInt(y); - data.writeInt(z); - data.writeByte(orientation); - data.writeByte(state); - data.writeUTF(customName); - data.writeInt(itemID); - data.writeInt(metaData); - data.writeInt(stackSize); - data.writeInt(color); - } - - @Override - public void readData(DataInputStream data) throws IOException { - - x = data.readInt(); - y = data.readInt(); - z = data.readInt(); - orientation = data.readByte(); - state = data.readByte(); - customName = data.readUTF(); - itemID = data.readInt(); - metaData = data.readInt(); - stackSize = data.readInt(); - color = data.readInt(); - } - - @Override - public void execute(INetworkManager manager, Player player) { - - EquivalentExchange3.proxy.handleTileWithItemPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, itemID, metaData, stackSize, color); - } -} From aeff4de5bbc29179f83fab1b1e6017a5fb696c1e Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 16:35:31 +0200 Subject: [PATCH 08/16] Changed build.xml to accommodate for refactoring from ee3_common to common --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 020890ce..bb603335 100644 --- a/build.xml +++ b/build.xml @@ -18,7 +18,7 @@ - + From f104f4060441026d233431571c0d392c7602b75b Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:18:12 +0200 Subject: [PATCH 09/16] Revert build.xml change to prevent dupe of #415 --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index bb603335..020890ce 100644 --- a/build.xml +++ b/build.xml @@ -18,7 +18,7 @@ - + From 2b1861c851df9dc79f199654476b56d15dd7a556 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:22:18 +0200 Subject: [PATCH 10/16] Updated readme in response to #418 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 18b9529d..2bd36bb4 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ IMPORTANT: Please report any issues you have, there might be some problems with #### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. + * **WARNING: Use 77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work! (Later versions are for 1.6.2) 3. Right now, you should have a directory that looks something like: *** From 6d962bf8d24c3a9eaab59889706f4b8f9290b7ef Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:26:42 +0200 Subject: [PATCH 11/16] More changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bd36bb4..d49c670d 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ IMPORTANT: Please report any issues you have, there might be some problems with #### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. - * **WARNING: Use 77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work! (Later versions are for 1.6.2) + * **WARNING: Use 77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work!** (Later versions are for 1.6.2) 3. Right now, you should have a directory that looks something like: *** From d91c9aa51ee227c710a0a280e0338209e98f7433 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:27:55 +0200 Subject: [PATCH 12/16] Try to link sha correctly --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d49c670d..81f79b89 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ IMPORTANT: Please report any issues you have, there might be some problems with #### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. - * **WARNING: Use 77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work!** (Later versions are for 1.6.2) + * **WARNING: Use pahimar@77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work!** (Later versions are for 1.6.2) 3. Right now, you should have a directory that looks something like: *** From 42fe5341e6a05a43ca1b476d4fb399c3d4b0ee57 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:28:52 +0200 Subject: [PATCH 13/16] Still not linking --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81f79b89..2949d817 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ IMPORTANT: Please report any issues you have, there might be some problems with #### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. - * **WARNING: Use pahimar@77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work!** (Later versions are for 1.6.2) + * **WARNING: Use `77c1560c24083d9a6dfe864158eeee70b55088a0` or it will not work!** (Later versions are for 1.6.2) 3. Right now, you should have a directory that looks something like: *** From 00a3edc843954e3f5288d4463c6832aafbf388b8 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:32:00 +0200 Subject: [PATCH 14/16] ... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2949d817..202d9a47 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ IMPORTANT: Please report any issues you have, there might be some problems with #### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. - * **WARNING: Use `77c1560c24083d9a6dfe864158eeee70b55088a0` or it will not work!** (Later versions are for 1.6.2) + * **WARNING: Use SHA: 77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work!** (Later versions are for 1.6.2) 3. Right now, you should have a directory that looks something like: *** From 64efc6acf0c85d476519e5d5150ab9235d3fcaec Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 17:33:55 +0200 Subject: [PATCH 15/16] It refuses to link... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 202d9a47..2949d817 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ IMPORTANT: Please report any issues you have, there might be some problems with #### Setup EE3 1. Inside `mcdev`, create a directory named `source`. 2. Move/clone `Equivalent-Exchange-3` into `source`. - * **WARNING: Use SHA: 77c1560c24083d9a6dfe864158eeee70b55088a0 or it will not work!** (Later versions are for 1.6.2) + * **WARNING: Use `77c1560c24083d9a6dfe864158eeee70b55088a0` or it will not work!** (Later versions are for 1.6.2) 3. Right now, you should have a directory that looks something like: *** From 360115e3219634b636d1cfb140643558069cb2d6 Mon Sep 17 00:00:00 2001 From: Robotic-Brain Date: Sun, 1 Sep 2013 22:37:40 +0200 Subject: [PATCH 16/16] Revert OpenGL fix --- .../ee3/core/handlers/TransmutationTargetOverlayHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java b/common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java index 9498f1e9..11afbf0e 100644 --- a/common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java +++ b/common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java @@ -81,7 +81,7 @@ public class TransmutationTargetOverlayHandler implements ITickHandler { GL11.glPushMatrix(); ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight); - GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glClear(256); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);