diff --git a/build.gradle b/build.gradle index fbef2b2..855ce5e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import groovy.json.JsonOutput + def mainVersion = "1.7" def buildNumber = "26" @@ -123,3 +125,101 @@ processResources exclude 'mcmod.info' } } + +//Code for automatic update JSON generation +class GenerateUpdateJSON extends DefaultTask { + static def IW_VERSION_PREFIX = "####Version " + static def MC_VERSION_PREFIX = "###Minecraft " + static def UNFINISHED_SUFFIX = " - UNFINISHED" + static def RECOMMENDED = "-recommended" + static def LATEST = "-latest" + static def CF_URL = "https://minecraft.curseforge.com/projects/industrial-wires" + + int compareVersions(String vA, String vB) { + String[] vPartsA = vA.split("[\\D]") + String[] vPartsB = vB.split("[\\D]") + if (vPartsA.length==0&&vPartsB.length==0) + return vA <=> vB + else if (vPartsA.length==0) + return -1 + else if (vPartsB.length==0) + return 1 + + int length = Math.min(vPartsA.length, vPartsB.length) + for (int i = 0;ipB + } + } + if (vPartsA.length != vPartsB.length) + return vPartsA.length <=> vPartsB.length + return vA <=> vB + } + + def addChangelog(Map> changelogForVersions, Map promos, + String currentMCVersion, String currentVersion, String currentChangelog) { + if (!changelogForVersions.containsKey(currentMCVersion)) { + promos.put(currentMCVersion+RECOMMENDED, currentVersion) + promos.put(currentMCVersion+LATEST, currentVersion) + changelogForVersions[currentMCVersion] = new TreeMap<>({String s1, String s2-> + compareVersions(s1, s2)}) + } + changelogForVersions[currentMCVersion][currentVersion] = currentChangelog + } + + @TaskAction + def generate() { + File changelog = new File("changelog.md") + if (!changelog.exists()) + println "Changelog does not exist! Aborting!" + else { + String currentMCVersion = ""; + Map> changelogForVersions = new HashMap<>() + Map promos = new TreeMap<>({String s1, String s2-> + compareVersions(s1, s2)}) + String currentVersion = null + String currentChangelog = "" + changelog.eachLine {line -> + if (line.startsWith(IW_VERSION_PREFIX)) { + if (currentVersion!=null) { + addChangelog(changelogForVersions, promos, currentMCVersion, currentVersion, currentChangelog) + } + if (!line.endsWith(UNFINISHED_SUFFIX)) { + currentVersion = line.substring(IW_VERSION_PREFIX.length()) + } else { + currentVersion = (String) null + } + currentChangelog = "" + } else if (line.startsWith(MC_VERSION_PREFIX)) { + if (currentVersion!=null) { + addChangelog(changelogForVersions, promos, currentMCVersion, currentVersion, currentChangelog) + } + currentChangelog = "" + currentVersion = (String) null + currentMCVersion = line.substring(MC_VERSION_PREFIX.length()) + } else if (!line.isEmpty()) { + if (currentChangelog.length()==0) + currentChangelog += line + else + currentChangelog += "\n"+line + } + } + Map mainMap = new TreeMap<>({String s1, String s2-> + compareVersions(s1, s2)}) + mainMap.putAll(changelogForVersions) + mainMap["homepage"] = CF_URL + mainMap["promos"] = promos + def outJson = JsonOutput.toJson(mainMap) + outJson = JsonOutput.prettyPrint(outJson) + File outF = new File("changelog.json") + outF.delete() + outF << outJson + } + } +} + +task updateJson(type: GenerateUpdateJSON) + +build.finalizedBy updateJson \ No newline at end of file diff --git a/changelog.json b/changelog.json new file mode 100644 index 0000000..8d49eb7 --- /dev/null +++ b/changelog.json @@ -0,0 +1,42 @@ +{ + "homepage": "https://minecraft.curseforge.com/projects/industrial-wires", + "promos": { + "1.10.2-latest": "1.4-18", + "1.10.2-recommended": "1.4-18", + "1.11.2-latest": "1.5-19", + "1.11.2-recommended": "1.5-19", + "1.12.2-latest": "1.7-27", + "1.12.2-recommended": "1.7-27" + }, + "1.10.2": { + "1.1-3": " - fixed incompatibility with IE build 48\n - reduced the amount of calls to core IE classes to make such incompatibilities less likely\n - fixed localization of the creative tab", + "1.1-4": " - fixed an insane amount of log-spam in an edgecase (probably a Vanilla or Forge bug)\n - added config values for wire length per connection and per coil item\n ", + "1.2-5 (10,000 download celebratory release)": " - added mechanical converters and the rotational motor\n - they convert between IE rotational energy (windmill, dynamo etc) and IC2 kinetic energy\n - Rotational motor: produces IE rotational energy from IF\n - No lossless conversion\n - Can be disabled in the config\n - wire coils show when they are out of range (to match the behavior of IE coils in the latest dev version)", + "1.2-6": " - reduced the discrepancies between IC2 cables and Industrial Wires\n - machines don't explode when they shouldn't except in some corner cases\n - potentially fixed missing textures on the mechanical converters\n - added Chinese translations (thanks SihenZhang)", + "1.3-7": " - added Jacob's Ladders/High voltage travelling arcs\n - they don't have a particular purpose aside from looking nice", + "1.3-8": " - the converters and the motor don't have missing textures any more when using Chisel", + "1.4-9": " - added Control Panels\n - They can be used to control and monitor a lot of redstone signals from a few blocks", + "1.4-10": " - added lock switches for control panels (backport from 1.11)\n - Can only be turned on by someone with the correct key to prevent unauthorized access\n - up to 10 keys can be added to a keyring to reduce inventory spam\n - IC2 items can be added to the appropriate sections of the engineers toolbox (backport from 1.11)\n - Components (lighted button, indicator light, etc.) on panels now actually light up (backport from 1.11)\n - Fixed power loss when no energy is being transmitted", + "1.4-16": " - Backported a lot of fixes from 1.11 and 1.12", + "1.4-18": " - Fixed a crash with SpongeForge, chunk loading issues without\n - Fixed some components resetting on chunk unload" + }, + "1.11.2": { + "1.5-11": " - Updated to Minecraft 1.11.2\n - Added Panel Meters to monitor a redstone signal with reasonable accuracy\n - Multiple components on the same panel network can modify the same signal now without causing undefined behavior\n - Lock Switches no longer break the model cache", + "1.5-12": " - Added tilted control panels\n - Panels are no longer created from machine casings, there is a dedicated item for that now, the Unfinished Control Panel\n - Angle and height can be configured in the Engineer's Workbench\n - Fixed a CME when multi-threaded chunk rendering is enabled\n - Fixed control panels not connecting or disconnecting properly when a panel connector between the panel and the RS controller is broken/placed\n - Improved the performance of the control panel hitbox rendering", + "1.5-13": " - Labels no longer break the model cache and cause lag\n - Labels don't break on dedicated servers any more", + "1.5-17": " - Backported some fixes from 1.12", + "1.5-19": " - Fixed a crash with SpongeForge, chunk loading issues without\n - Fixed some components resetting on chunk unload" + }, + "1.12.2": { + "1.5-14": " - Updated to Minecraft 1.12\n - Added a recipe for the key ring. Kind of forgot about adding one when I added the ring itself...\n - Fixed wire length crafting leaving wrong coils when the output has maximum length\n - Fixed some more connection issues with control panels", + "1.5-15": " - Components can be placed in the world now to use the as conventional levers/etc.\n - Added documentation on the key ring. It also shows all attached keys on the tooltip now\n - Fixed some bugs with key ring crafting\n - Fixed control panels causing disconnects on servers", + "1.6-20": " - Added the Marx Generator, an alternative ore processing method\n - Hearing protection absolutely required!\n - You may need to do some math and measurements for ore processing to work. It will kill entites just fine without any science\n - IC2 is no longer a hard dependency. The wires and converters will obviously be disabled without it\n - Vastly improved snapping in the panel creator\n - Added some Mirage (Albedo) compat\n - IW is signed now!\n - Analog panel components can interact with 2 channels now, rough and fine control\n - Fixed GUI background and item tooltips\n - Fixed some components resetting when the chunk is unloaded\n - Chunks with control panels properly unload now", + "1.6-21": " - Added shaders for the Marx generator and Jacob's ladder\n - Fixed wires connected to a Marx generator on a server being invisible\n - The Marx generator actually gives output when processing ores now. Oops...\n - The \"safe distance\" formulas for the Marx generator in the manual now match the real safe distance\n - Improved rendering of the Marx generator in the manual. Some of this is only enabled with maven build 275+ or official build 75+ (not released yet)", + "1.6-22": " - Added a Seven-Segment display for control panels\n - Panel components update their values as soon as they are changed in the GUI\n - Fixed a crash when breaking a panel with buttons, locks or toggle switches on it under special circumstances\n - Fixed server crashes when using panel components with a second controller id, but no channel set\n - Fixed various NPE crashes with control panel models under heavy load\n - Fixed wrong panel component ordering with raytracing", + "1.6-23": " - Added a command to allow taking screenshots of Marx generator discharges (/ciw triggermarxscreenshot)\n - Panel components have to be shift-clicked to place them in the world\n - Fixed wire coil crafting\n - Added a recipe for the Seven-Segment displays", + "1.6-24": " - Fixed an infinite energy bug\n - Changed the default value for maximum energy conversion", + "1.6-25": " - Updated to IE build 77\n - IC2 wires cause damage\n - Added insulated versions of gold, copper and tin wires. Due to heat sensitive insulation the transfer capacity is half of the normal capacity\n - Added feedthrough insulators for all IC2 wire types\n - Wire coils now automatically \"merge\" when picked up\n - Config values are applied to the game directly now", + "1.7-26": " - Added Mechanical Multiblocks (energy storage and EU<->FE conversion)\n - There will be an explanation video for these once I have time to make one\n - Fixed the small mechanical converter blowing up tin wires\n - Fixed wires not joining their outputs correctly\n - Fixed wire connectors not breaking when the block they're on is broken", + "1.7-27": " - Fixed panel components causing issues on dedicated servers\n - Added an automatic update checker (Using the Forge update JSON)" + } +} \ No newline at end of file diff --git a/changelog.md b/changelog.md index 9795da7..de2fabe 100644 --- a/changelog.md +++ b/changelog.md @@ -1,11 +1,17 @@ -#####Version 1.7-26 +###Minecraft 1.12.2 + +####Version 1.7-27 + - Fixed panel components causing issues on dedicated servers + - Added an automatic update checker (Using the Forge update JSON) + +####Version 1.7-26 - Added Mechanical Multiblocks (energy storage and EU<->FE conversion) - There will be an explanation video for these once I have time to make one - Fixed the small mechanical converter blowing up tin wires - Fixed wires not joining their outputs correctly - Fixed wire connectors not breaking when the block they're on is broken -#####Version 1.6-25 +####Version 1.6-25 - Updated to IE build 77 - IC2 wires cause damage - Added insulated versions of gold, copper and tin wires. Due to heat sensitive insulation the transfer capacity is half of the normal capacity @@ -13,17 +19,17 @@ - Wire coils now automatically "merge" when picked up - Config values are applied to the game directly now -#####Version 1.6-24 +####Version 1.6-24 - Fixed an infinite energy bug - Changed the default value for maximum energy conversion -#####Version 1.6-23 +####Version 1.6-23 - Added a command to allow taking screenshots of Marx generator discharges (/ciw triggermarxscreenshot) - Panel components have to be shift-clicked to place them in the world - Fixed wire coil crafting - Added a recipe for the Seven-Segment displays -#####Version 1.6-22 +####Version 1.6-22 - Added a Seven-Segment display for control panels - Panel components update their values as soon as they are changed in the GUI - Fixed a crash when breaking a panel with buttons, locks or toggle switches on it under special circumstances @@ -31,14 +37,14 @@ - Fixed various NPE crashes with control panel models under heavy load - Fixed wrong panel component ordering with raytracing -#####Version 1.6-21 +####Version 1.6-21 - Added shaders for the Marx generator and Jacob's ladder - Fixed wires connected to a Marx generator on a server being invisible - The Marx generator actually gives output when processing ores now. Oops... - The "safe distance" formulas for the Marx generator in the manual now match the real safe distance - Improved rendering of the Marx generator in the manual. Some of this is only enabled with maven build 275+ or official build 75+ (not released yet) -#####Version 1.6-20 +####Version 1.6-20 - Added the Marx Generator, an alternative ore processing method - Hearing protection absolutely required! - You may need to do some math and measurements for ore processing to work. It will kill entites just fine without any science @@ -51,23 +57,32 @@ - Fixed some components resetting when the chunk is unloaded - Chunks with control panels properly unload now -#####Version 1.5-15 +####Version 1.5-15 - Components can be placed in the world now to use the as conventional levers/etc. - Added documentation on the key ring. It also shows all attached keys on the tooltip now - Fixed some bugs with key ring crafting - Fixed control panels causing disconnects on servers -#####Version 1.5-14 +####Version 1.5-14 - Updated to Minecraft 1.12 - Added a recipe for the key ring. Kind of forgot about adding one when I added the ring itself... - Fixed wire length crafting leaving wrong coils when the output has maximum length - Fixed some more connection issues with control panels -#####Version 1.5-13 +###Minecraft 1.11.2 + +####Version 1.5-19 + - Fixed a crash with SpongeForge, chunk loading issues without + - Fixed some components resetting on chunk unload + +####Version 1.5-17 + - Backported some fixes from 1.12 + +####Version 1.5-13 - Labels no longer break the model cache and cause lag - Labels don't break on dedicated servers any more -#####Version 1.5-12 +####Version 1.5-12 - Added tilted control panels - Panels are no longer created from machine casings, there is a dedicated item for that now, the Unfinished Control Panel - Angle and height can be configured in the Engineer's Workbench @@ -75,36 +90,48 @@ - Fixed control panels not connecting or disconnecting properly when a panel connector between the panel and the RS controller is broken/placed - Improved the performance of the control panel hitbox rendering -#####Version 1.5-11 +####Version 1.5-11 - Updated to Minecraft 1.11.2 - Added Panel Meters to monitor a redstone signal with reasonable accuracy - Multiple components on the same panel network can modify the same signal now without causing undefined behavior - Lock Switches no longer break the model cache -#####Version 1.4-10 +###Minecraft 1.10.2 + +####Version 1.4-18 + - Fixed a crash with SpongeForge, chunk loading issues without + - Fixed some components resetting on chunk unload + + +####Version 1.4-16 + - Backported a lot of fixes from 1.11 and 1.12 + +####Version 1.4-10 - added lock switches for control panels (backport from 1.11) - Can only be turned on by someone with the correct key to prevent unauthorized access - up to 10 keys can be added to a keyring to reduce inventory spam - IC2 items can be added to the appropriate sections of the engineers toolbox (backport from 1.11) - Components (lighted button, indicator light, etc.) on panels now actually light up (backport from 1.11) - Fixed power loss when no energy is being transmitted -#####Version 1.4-9 + +####Version 1.4-9 - added Control Panels - They can be used to control and monitor a lot of redstone signals from a few blocks -#####Version 1.3-8 +####Version 1.3-8 - the converters and the motor don't have missing textures any more when using Chisel -#####Version 1.3-7 + +####Version 1.3-7 - added Jacob's Ladders/High voltage travelling arcs - they don't have a particular purpose aside from looking nice -#####Version 1.2-6 +####Version 1.2-6 - reduced the discrepancies between IC2 cables and Industrial Wires - machines don't explode when they shouldn't except in some corner cases - potentially fixed missing textures on the mechanical converters - added Chinese translations (thanks SihenZhang) -#####Version 1.2-5 (10,000 download celebratory release) +####Version 1.2-5 (10,000 download celebratory release) - added mechanical converters and the rotational motor - they convert between IE rotational energy (windmill, dynamo etc) and IC2 kinetic energy - Rotational motor: produces IE rotational energy from IF @@ -112,16 +139,16 @@ - Can be disabled in the config - wire coils show when they are out of range (to match the behavior of IE coils in the latest dev version) -#####Version 1.1-4 +####Version 1.1-4 - fixed an insane amount of log-spam in an edgecase (probably a Vanilla or Forge bug) - added config values for wire length per connection and per coil item -#####Version 1.1-3 +####Version 1.1-3 - fixed incompatibility with IE build 48 - reduced the amount of calls to core IE classes to make such incompatibilities less likely - fixed localization of the creative tab -#####Version 1.1-2 +####Version 1.1-2 - wire coils now use a different amount of wire depending on how long the connection is - wire coils are crafted by placing any amount of IC2 cables and/or the corresponding wire coils in a crafting table now - added Glass Fiber Wire diff --git a/src/main/java/malte0811/industrialWires/IndustrialWires.java b/src/main/java/malte0811/industrialWires/IndustrialWires.java index 3177e98..97d8ebe 100644 --- a/src/main/java/malte0811/industrialWires/IndustrialWires.java +++ b/src/main/java/malte0811/industrialWires/IndustrialWires.java @@ -78,7 +78,8 @@ import static malte0811.industrialWires.mech_mb.MechMBPart.EXAMPLE_MECHMB_LOC; import static malte0811.industrialWires.wires.IC2Wiretype.*; @Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.12-77,);after:ic2", - certificateFingerprint = "7e11c175d1e24007afec7498a1616bef0000027d") + certificateFingerprint = "7e11c175d1e24007afec7498a1616bef0000027d", + updateJSON = "https://raw.githubusercontent.com/malte0811/IndustrialWires/MC1.12/changelog.json") @Mod.EventBusSubscriber public class IndustrialWires { public static final String MODID = "industrialwires";