From 245465dc8c357fdae3d5f461b42545e83aec6017 Mon Sep 17 00:00:00 2001 From: aidancbrady Date: Mon, 5 Sep 2016 15:28:55 -0400 Subject: [PATCH 1/2] Bump up Dynamic Tank max storage, fixed Factory container issue --- .../content/tank/TankUpdateProtocol.java | 2 +- .../inventory/container/ContainerFactory.java | 24 ++++--------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java b/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java index 12cebf11d..995051974 100644 --- a/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java +++ b/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java @@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack; public class TankUpdateProtocol extends UpdateProtocol { - public static final int FLUID_PER_TANK = 16000; + public static final int FLUID_PER_TANK = 64000; public TankUpdateProtocol(TileEntityDynamicTank tileEntity) { diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFactory.java b/src/main/java/mekanism/common/inventory/container/ContainerFactory.java index 088e03932..03643cb52 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFactory.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFactory.java @@ -116,7 +116,7 @@ public class ContainerFactory extends Container { ItemStack stack = null; Slot currentSlot = (Slot)inventorySlots.get(slotID); - + if(currentSlot != null && currentSlot.getHasStack()) { ItemStack slotStack = currentSlot.getStack(); @@ -178,7 +178,7 @@ public class ContainerFactory extends Container } else if(tileEntity.recipeType.getItemGas(slotStack) != null) { - if(slotID > tileEntity.inventory.length-1) + if(slotID >= tileEntity.inventory.length-1) { if(!mergeItemStack(slotStack, 3, 4, false)) { @@ -194,7 +194,7 @@ public class ContainerFactory extends Container } else if(tileEntity.recipeType == RecipeType.INFUSING && InfuseRegistry.getObject(slotStack) != null && (tileEntity.infuseStored.type == null || tileEntity.infuseStored.type == InfuseRegistry.getObject(slotStack).type)) { - if(slotID > tileEntity.inventory.length-1) + if(slotID >= tileEntity.inventory.length-1) { if(!mergeItemStack(slotStack, 3, 4, false)) { @@ -267,25 +267,11 @@ public class ContainerFactory extends Container public boolean isInputSlot(int slot) { - if(tileEntity.tier == Tier.FactoryTier.BASIC) - return slot >= 4 && slot <= 6; - if(tileEntity.tier == Tier.FactoryTier.ADVANCED) - return slot >= 4 && slot <= 8; - if(tileEntity.tier == Tier.FactoryTier.ELITE) - return slot >= 4 && slot <= 10; - - return false; + return slot >= 4 && slot < 4+tileEntity.tier.processes; } public boolean isOutputSlot(int slot) { - if(tileEntity.tier == Tier.FactoryTier.BASIC) - return slot >= 7 && slot <= 9; - if(tileEntity.tier == Tier.FactoryTier.ADVANCED) - return slot >= 9 && slot <= 13; - if(tileEntity.tier == Tier.FactoryTier.ELITE) - return slot >= 11 && slot <= 17; - - return false; + return slot >= 4+tileEntity.tier.processes && slot < 4+tileEntity.tier.processes*2; } } From ddc9e68f8ef81f5ae3979be0cecf4cce016a2ab2 Mon Sep 17 00:00:00 2001 From: aidancbrady Date: Thu, 11 Aug 2016 12:15:16 -0400 Subject: [PATCH 2/2] Added version-based handling, bump version to 9.1.1 --- build.properties | 2 +- src/main/java/mekanism/common/Mekanism.java | 4 +-- .../java/mekanism/common/ThreadGetData.java | 27 ++++++++++++++-- src/main/java/mekanism/common/Version.java | 27 +++++++++++++++- .../mekanism/common/util/MekanismUtils.java | 31 ++----------------- .../generators/common/MekanismGenerators.java | 4 +-- .../mekanism/tools/common/MekanismTools.java | 4 +-- 7 files changed, 60 insertions(+), 39 deletions(-) diff --git a/build.properties b/build.properties index cd60cf117..b8e16c745 100644 --- a/build.properties +++ b/build.properties @@ -4,4 +4,4 @@ FMP_version=1.1.2.331 CCLIB_version=1.1.3.136 NEI_version=1.0.4.101 CCC_version=1.0.6.39 -mod_version=9.1.0 +mod_version=9.1.1 diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index db1e15eee..b7a597646 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -142,7 +142,7 @@ import cpw.mods.fml.common.registry.GameRegistry; * @author AidanBrady * */ -@Mod(modid = "Mekanism", name = "Mekanism", version = "9.1.0", guiFactory = "mekanism.client.gui.ConfigGuiFactory", +@Mod(modid = "Mekanism", name = "Mekanism", version = "9.1.1", guiFactory = "mekanism.client.gui.ConfigGuiFactory", dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" + "after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore") public class Mekanism @@ -168,7 +168,7 @@ public class Mekanism public static Configuration configuration; /** Mekanism version number */ - public static Version versionNumber = new Version(9, 1, 0); + public static Version versionNumber = new Version(9, 1, 1); /** MultiblockManagers for various structrures */ public static MultiblockManager tankManager = new MultiblockManager("dynamicTank"); diff --git a/src/main/java/mekanism/common/ThreadGetData.java b/src/main/java/mekanism/common/ThreadGetData.java index 310154f54..40e4bb4fd 100644 --- a/src/main/java/mekanism/common/ThreadGetData.java +++ b/src/main/java/mekanism/common/ThreadGetData.java @@ -1,6 +1,9 @@ package mekanism.common; +import java.util.List; + import mekanism.common.util.MekanismUtils; +import cpw.mods.fml.relauncher.FMLInjectionData; /** * Thread used to retrieve data from the Mekanism server. @@ -18,9 +21,27 @@ public class ThreadGetData extends Thread @Override public void run() { - Mekanism.latestVersionNumber = MekanismUtils.getLatestVersion(); - Mekanism.recentNews = MekanismUtils.getRecentNews(); - + List ret = MekanismUtils.getHTML("https://dl.dropbox.com/u/90411166/Versions/Mekanism.txt"); + + Mekanism.latestVersionNumber = "null"; + Mekanism.recentNews = "null"; + + for(String s : ret) + { + String[] text = s.split(":"); + + if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) + { + if(Version.get(text[0]) != null && Version.get(text[0]).equals(Version.get((String)FMLInjectionData.data()[4]))) + { + Mekanism.latestVersionNumber = text[1]; + Mekanism.recentNews = text[2]; + + break; + } + } + } + MekanismUtils.updateDonators(); } } diff --git a/src/main/java/mekanism/common/Version.java b/src/main/java/mekanism/common/Version.java index ee5b058cd..ff1eb97e1 100644 --- a/src/main/java/mekanism/common/Version.java +++ b/src/main/java/mekanism/common/Version.java @@ -1,7 +1,7 @@ package mekanism.common; /** - * Version v1.0.4. Simple version handling for Mekanism. + * Version v2.0.0. Simple version handling for Mekanism. * @author AidanBrady * */ @@ -127,4 +127,29 @@ public class Version return major + "." + minor + "." + build; } } + + @Override + public int hashCode() + { + int result = 1; + + result = 31 * result + build; + result = 31 * result + major; + result = 31 * result + minor; + + return result; + } + + @Override + public boolean equals(Object obj) + { + if(obj == null || getClass() != obj.getClass()) + { + return false; + } + + Version other = (Version)obj; + + return build == other.build && major == other.major && minor == other.minor; + } } diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index c1eff4ca5..a658157ec 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -160,28 +160,6 @@ public final class MekanismUtils return false; } - /** - * Gets the latest version using getHTML and returns it as a string. - * @return latest version - */ - public static String getLatestVersion() - { - String[] text = merge(getHTML("https://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt")).split(":"); - if(text.length > 1 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) return text[0]; - return "null"; - } - - /** - * Gets the recent news using getHTML and returns it as a string. - * @return recent news - */ - public static String getRecentNews() - { - String[] text = merge(getHTML("https://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt")).split(":"); - if(text.length > 1 && !text[1].contains("UTF-8") && !text[1].contains("HTML") && !text[1].contains("http")) return text[1]; - return "null"; - } - /** * Updates the donator list by retrieving the most recent information from a foreign document. */ @@ -202,17 +180,14 @@ public final class MekanismUtils */ public static List getHTML(String urlToRead) { - URL url; - HttpURLConnection conn; - BufferedReader rd; String line; List result = new ArrayList(); try { - url = new URL(urlToRead); - conn = (HttpURLConnection)url.openConnection(); + URL url = new URL(urlToRead); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("GET"); - rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); while((line = rd.readLine()) != null) { diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index 8a39f918c..e2203bc66 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -44,7 +44,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.1.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") +@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.1.1", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") public class MekanismGenerators implements IModule { @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") @@ -54,7 +54,7 @@ public class MekanismGenerators implements IModule public static MekanismGenerators instance; /** MekanismGenerators version number */ - public static Version versionNumber = new Version(9, 1, 0); + public static Version versionNumber = new Version(9, 1, 1); public static MultiblockManager turbineManager = new MultiblockManager("industrialTurbine"); diff --git a/src/main/java/mekanism/tools/common/MekanismTools.java b/src/main/java/mekanism/tools/common/MekanismTools.java index 36e5b72bf..88fa2cdf4 100644 --- a/src/main/java/mekanism/tools/common/MekanismTools.java +++ b/src/main/java/mekanism/tools/common/MekanismTools.java @@ -29,7 +29,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.1.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") +@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.1.1", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") public class MekanismTools implements IModule { @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy") @@ -39,7 +39,7 @@ public class MekanismTools implements IModule public static MekanismTools instance; /** MekanismTools version number */ - public static Version versionNumber = new Version(9, 1, 0); + public static Version versionNumber = new Version(9, 1, 1); //Enums: Tools public static ToolMaterial toolOBSIDIAN;