├── .github ├── FUNDING.yml ├── scripts │ └── test-no-error-reports.sh └── workflows │ ├── build-and-test.yml │ └── release-tags.yml ├── .gitignore ├── COPYING ├── COPYING.LESSER ├── LICENSE ├── README.md ├── build.gradle ├── dependencies.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── repositories.gradle └── src └── main ├── java ├── com │ └── falsepattern │ │ └── gasstation │ │ ├── GasStation.java │ │ ├── IEarlyMixinLoader.java │ │ ├── ILateMixinLoader.java │ │ ├── MinecraftURLClassPath.java │ │ ├── Tags.java │ │ ├── core │ │ └── GasStationCore.java │ │ └── mixins │ │ ├── DevMixinPlugin.java │ │ ├── IModDiscovererMixin.java │ │ └── mixin │ │ ├── LoadControllerMixin.java │ │ └── dev │ │ ├── LoaderMixin.java │ │ └── ModDiscovererMixin.java ├── io │ └── github │ │ └── tox1cozz │ │ └── mixinbooterlegacy │ │ ├── IEarlyMixinLoader.java │ │ ├── ILateMixinLoader.java │ │ └── MixinBooterLegacyPlugin.java ├── makamys │ └── mixingasm │ │ ├── DefaultConfigHelper.java │ │ ├── MixinConfigPlugin.java │ │ ├── Mixingasm.java │ │ ├── api │ │ ├── IMixinSafeTransformer.java │ │ └── TransformerInclusions.java │ │ └── forge │ │ └── MixingasmMod.java └── ru │ └── timeconqueror │ └── spongemixins │ ├── MinecraftURLClassPath.java │ ├── SpongeMixins.java │ └── core │ └── SpongeMixinsCore.java └── resources ├── CREDITS ├── LICENSE ├── META-INF └── services │ ├── cpw.mods.modlauncher.api.ITransformationService │ ├── cpw.mods.modlauncher.serviceapi.ILaunchPluginService │ ├── javax.annotation.processing.Processor │ ├── org.spongepowered.asm.service.IGlobalPropertyService │ ├── org.spongepowered.asm.service.IMixinService │ ├── org.spongepowered.asm.service.IMixinServiceBootstrap │ └── org.spongepowered.tools.obfuscation.service.IObfuscationService ├── assets └── mixingasm │ └── default_config │ └── mixingasm │ ├── transformer_exclusion_list.txt │ ├── transformer_inclusion_list.txt │ └── transformer_inclusion_list_default.txt ├── gasstation_parity.txt ├── mcmod.info ├── mixins.gasstation.json ├── mixins.gasstation_mixinbooter.json ├── mixins.gasstation_mixingasm.json └── pack.mcmeta /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: falsepattern 2 | ko_fi: falsepattern -------------------------------------------------------------------------------- /.github/scripts/test-no-error-reports.sh: -------------------------------------------------------------------------------- 1 | if [[ -d "run/crash-reports" ]]; then 2 | echo "Crash reports detected:" 3 | cat $directory/* 4 | exit 1 5 | fi 6 | 7 | if grep --quiet "Fatal errors were detected" server.log; then 8 | echo "Fatal errors detected:" 9 | cat server.log 10 | exit 1 11 | fi 12 | 13 | if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then 14 | echo "Server force stopped:" 15 | cat server.log 16 | exit 1 17 | fi 18 | 19 | if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then 20 | echo "Server didn't finish startup:" 21 | cat server.log 22 | exit 1 23 | fi 24 | 25 | echo "No crash reports detected" 26 | exit 0 27 | 28 | -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Build and test 5 | 6 | on: 7 | pull_request: 8 | branches: [ master, main ] 9 | push: 10 | branches: [ master, main ] 11 | 12 | jobs: 13 | build-and-test: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v2 17 | with: 18 | fetch-depth: 0 19 | 20 | - name: Set up JDK 8 21 | uses: actions/setup-java@v2 22 | with: 23 | java-version: '8' 24 | distribution: 'adopt' 25 | cache: gradle 26 | 27 | - name: Grant execute permission for gradlew 28 | run: chmod +x gradlew 29 | 30 | - name: Setup the workspace 31 | run: ./gradlew setupCIWorkspace 32 | 33 | - name: Build the mod 34 | run: ./gradlew build 35 | 36 | - name: Run server for 1.5 minutes 37 | run: | 38 | mkdir run 39 | echo "eula=true" > run/eula.txt 40 | timeout 90 ./gradlew runServer | tee --append server.log || true 41 | 42 | - name: Test no errors reported during server run 43 | run: | 44 | chmod +x .github/scripts/test-no-error-reports.sh 45 | .github/scripts/test-no-error-reports.sh 46 | -------------------------------------------------------------------------------- /.github/workflows/release-tags.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Release tagged build 5 | 6 | on: 7 | push: 8 | tags: 9 | - '*' 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Set release version 20 | run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV 21 | 22 | - name: Set up JDK 8 23 | uses: actions/setup-java@v2 24 | with: 25 | java-version: '8' 26 | distribution: 'adopt' 27 | cache: gradle 28 | 29 | - name: Grant execute permission for gradlew 30 | run: chmod +x gradlew 31 | 32 | - name: Setup the workspace 33 | run: ./gradlew setupCIWorkspace 34 | 35 | - name: Publish to Maven, Modrinth, and CurseForge 36 | run: ./gradlew publish 37 | env: 38 | MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }} 39 | MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }} 40 | MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} 41 | CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} 42 | 43 | - name: Release under current tag 44 | uses: "marvinpinto/action-automatic-releases@latest" 45 | with: 46 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 47 | automatic_release_tag: "${{ env.RELEASE_VERSION }}" 48 | prerelease: false 49 | title: "${{ env.RELEASE_VERSION }}" 50 | files: build/libs/*.jar 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,gradle,forgegradle,java 4 | 5 | ### ForgeGradle ### 6 | # Minecraft client/server files 7 | run/ 8 | 9 | ### Intellij+all ### 10 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 11 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 12 | 13 | # User-specific stuff 14 | .idea/**/workspace.xml 15 | .idea/**/tasks.xml 16 | .idea/**/usage.statistics.xml 17 | .idea/**/dictionaries 18 | .idea/**/shelf 19 | 20 | # AWS User-specific 21 | .idea/**/aws.xml 22 | 23 | # Generated files 24 | .idea/**/contentModel.xml 25 | 26 | # Sensitive or high-churn files 27 | .idea/**/dataSources/ 28 | .idea/**/dataSources.ids 29 | .idea/**/dataSources.local.xml 30 | .idea/**/sqlDataSources.xml 31 | .idea/**/dynamic.xml 32 | .idea/**/uiDesigner.xml 33 | .idea/**/dbnavigator.xml 34 | 35 | # Gradle 36 | .idea/**/gradle.xml 37 | .idea/**/libraries 38 | 39 | # Gradle and Maven with auto-import 40 | # When using Gradle or Maven with auto-import, you should exclude module files, 41 | # since they will be recreated, and may cause churn. Uncomment if using 42 | # auto-import. 43 | .idea/artifacts 44 | .idea/compiler.xml 45 | .idea/jarRepositories.xml 46 | .idea/modules.xml 47 | .idea/*.iml 48 | .idea/modules 49 | *.iml 50 | *.ipr 51 | 52 | # CMake 53 | cmake-build-*/ 54 | 55 | # Mongo Explorer plugin 56 | .idea/**/mongoSettings.xml 57 | 58 | # File-based project format 59 | *.iws 60 | 61 | # IntelliJ 62 | out/ 63 | 64 | # mpeltonen/sbt-idea plugin 65 | .idea_modules/ 66 | 67 | # JIRA plugin 68 | atlassian-ide-plugin.xml 69 | 70 | # Cursive Clojure plugin 71 | .idea/replstate.xml 72 | 73 | # Crashlytics plugin (for Android Studio and IntelliJ) 74 | com_crashlytics_export_strings.xml 75 | crashlytics.properties 76 | crashlytics-build.properties 77 | fabric.properties 78 | 79 | # Editor-based Rest Client 80 | .idea/httpRequests 81 | 82 | # Android studio 3.1+ serialized cache file 83 | .idea/caches/build_file_checksums.ser 84 | 85 | ### Intellij+all Patch ### 86 | # Ignores the whole .idea folder and all .iml files 87 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 88 | 89 | .idea/ 90 | 91 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 92 | 93 | *.iml 94 | modules.xml 95 | .idea/misc.xml 96 | *.ipr 97 | 98 | # Sonarlint plugin 99 | .idea/sonarlint 100 | 101 | ### Java ### 102 | # Compiled class file 103 | *.class 104 | 105 | # Log file 106 | *.log 107 | 108 | # BlueJ files 109 | *.ctxt 110 | 111 | # Mobile Tools for Java (J2ME) 112 | .mtj.tmp/ 113 | 114 | # Package Files # 115 | *.jar 116 | *.war 117 | *.nar 118 | *.ear 119 | *.zip 120 | *.tar.gz 121 | *.rar 122 | 123 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 124 | hs_err_pid* 125 | 126 | ### Gradle ### 127 | .gradle 128 | build/ 129 | 130 | # Ignore Gradle GUI config 131 | gradle-app.setting 132 | 133 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 134 | !gradle-wrapper.jar 135 | 136 | # Cache of project 137 | .gradletasknamecache 138 | 139 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 140 | # gradle/wrapper/gradle-wrapper.properties 141 | 142 | ### Gradle Patch ### 143 | **/build/ 144 | 145 | # Eclipse Gradle plugin generated files 146 | # Eclipse Core 147 | .project 148 | # JDT-specific (Eclipse Java Development Tools) 149 | .classpath 150 | 151 | # End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java 152 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /COPYING.LESSER: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GasStation 2 | 3 | Copyright (C) 2022 FalsePattern 4 | All Rights Reserved 5 | 6 | The above copyright notice and this permission notice shall be included 7 | in all copies or substantial portions of the Software. 8 | 9 | This program is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with this program. If not, see . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # USE UNIMIXINS! 2 | At this point GasStation is obsolete, unmaintained, and has been completely superseeded by UniMixins, which can load all GasStation-requiring mods. 3 | 4 | https://github.com/LegacyModdingMC/UniMixins 5 | 6 | # GasStation 7 | 8 | GasStation is library that gives mods the ability of loading mixins without embedding the entire SpongePowered Mixins 9 | library inside themselves. 10 | 11 | This library is based on SpongeMixins, but with several significant differences: 12 | - This library provides Mixin 0.8.5 instead of 0.7.11 (new mixin features that are not available in mixin 0.7) 13 | - MixinExtras is included, which has some neat QoL utilities that can be used by mod developers. 14 | - The early/late mixin loading feature from mixin-booter-legacy is included as a part of the library 15 | - Mixingasm is included 16 | 17 | GasStation is designed to be 100% backwards compatible with SpongeMixins, and in most cases it's a simple delete and 18 | drag&drop upgrade. However, mods designed to run on GasStation *might not* work on SpongeMixins if they use any of the 19 | extra features included in this library. 20 | 21 | Integrated into the buildscript of https://github.com/FalsePattern/ExampleMod1.7.10 22 | 23 | ### Important: do not remove the 00 prefix from the jar, it's used for making forge load this mod first before others (alphabetical sorting when loading coremods) 24 | 25 | ## Licenses 26 | 27 | GasStation is licensed under LGPLv3.
28 | Full license notice here: https://github.com/FalsePattern/GasStation/blob/master/LICENSE 29 | 30 | ### Embedded code licenses: 31 | SpongePowered Mixins is licensed under MIT, and is compatible with LGPLv3.
32 | Full license notice here: https://github.com/SpongePowered/Mixin/blob/master/LICENSE.txt 33 | 34 | MixinExtras is licensed under MIT, and is compatible with LGPLv3.
35 | Full license notice here: https://github.com/LlamaLad7/MixinExtras/blob/master/LICENSE 36 | 37 | MixinBooterLegacy is licensed under LGPLv2.1+, and is compatible with LGPLv3.
38 | Full license notice here: https://github.com/tox1cozZ/mixin-booter-legacy/blob/master/LICENSE 39 | 40 | SpongeMixins is licensed under MIT, and is compatible with LGPLv3.
41 | Full license notice here: https://github.com/TimeConqueror/SpongeMixins/blob/master/LICENSE 42 | 43 | Mixingasm is licensed under Unlicense, and is compatible with LGPLv3.
44 | Full license notice here: https://github.com/makamys/Mixingasm/blob/master/UNLICENSE -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | //version: 1656003793falsepattern56 2 | /* 3 | DO NOT CHANGE THIS FILE! 4 | 5 | Also, you may replace this file at any time if there is an update available. 6 | Please check https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/build.gradle for updates. 7 | */ 8 | 9 | 10 | import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation 11 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 12 | import com.matthewprenger.cursegradle.CurseArtifact 13 | import com.matthewprenger.cursegradle.CurseRelation 14 | import com.modrinth.minotaur.dependencies.ModDependency 15 | import com.modrinth.minotaur.dependencies.VersionDependency 16 | import org.gradle.internal.logging.text.StyledTextOutput.Style 17 | import org.gradle.internal.logging.text.StyledTextOutputFactory 18 | 19 | import java.nio.file.Files 20 | import java.nio.file.Paths 21 | import java.util.concurrent.TimeUnit 22 | import java.util.zip.ZipEntry 23 | import java.util.zip.ZipInputStream 24 | import java.util.zip.ZipOutputStream 25 | 26 | buildscript { 27 | repositories { 28 | mavenLocal() 29 | maven { 30 | name = "forge" 31 | url = "https://mvn.falsepattern.com/forge" 32 | } 33 | maven { 34 | name = "sonatype" 35 | url = "https://oss.sonatype.org/content/repositories/snapshots/" 36 | } 37 | maven { 38 | name = "Scala CI dependencies" 39 | url = "https://repo1.maven.org/maven2/" 40 | } 41 | maven { 42 | name = "jitpack" 43 | url = "https://mvn.falsepattern.com/jitpack/" 44 | } 45 | maven { 46 | name = "mavenpattern" 47 | url = "https://mvn.falsepattern.com/releases/" 48 | } 49 | maven { 50 | name = "usrv" 51 | url = "https://mvn.falsepattern.com/usrv/" 52 | } 53 | } 54 | dependencies { 55 | classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.11' 56 | classpath 'com.falsepattern:jtweaker:0.2.1' 57 | } 58 | } 59 | 60 | plugins { 61 | id 'java-library' 62 | id 'idea' 63 | id 'eclipse' 64 | id 'scala' 65 | id 'maven-publish' 66 | id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false 67 | id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false 68 | id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false 69 | id 'org.ajoberstar.grgit' version '4.1.1' 70 | id 'com.github.johnrengelman.shadow' version '4.0.4' 71 | id 'com.palantir.git-version' version '0.13.0' 72 | id 'de.undercouch.download' version '5.0.1' 73 | id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false 74 | id 'com.modrinth.minotaur' version '2.+' apply false 75 | id 'com.matthewprenger.cursegradle' version '1.4.0' apply false 76 | } 77 | apply plugin: 'com.falsepattern.jtweaker' 78 | 79 | def out = services.get(StyledTextOutputFactory).create('an-output') 80 | 81 | apply plugin: 'forge' 82 | 83 | def projectJavaVersion = JavaLanguageVersion.of(8) 84 | 85 | java { 86 | toolchain { 87 | languageVersion.set(projectJavaVersion) 88 | } 89 | } 90 | 91 | idea { 92 | module { 93 | inheritOutputDirs = true 94 | downloadJavadoc = true 95 | downloadSources = true 96 | } 97 | } 98 | 99 | if(JavaVersion.current() != JavaVersion.VERSION_1_8) { 100 | throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) 101 | } 102 | 103 | checkPropertyExists("modName") 104 | checkPropertyExists("modId") 105 | checkPropertyExists("modGroup") 106 | checkPropertyExists("autoUpdateBuildScript") 107 | checkPropertyExists("minecraftVersion") 108 | checkPropertyExists("forgeVersion") 109 | checkPropertyExists("replaceGradleTokenInFile") 110 | checkPropertyExists("gradleTokenModId") 111 | checkPropertyExists("gradleTokenModName") 112 | checkPropertyExists("gradleTokenVersion") 113 | checkPropertyExists("gradleTokenGroupName") 114 | checkPropertyExists("apiPackage") 115 | checkPropertyExists("accessTransformersFile") 116 | checkPropertyExists("usesMixins") 117 | checkPropertyExists("mixinPlugin") 118 | checkPropertyExists("mixinsPackage") 119 | checkPropertyExists("coreModClass") 120 | checkPropertyExists("containsMixinsAndOrCoreModOnly") 121 | checkPropertyExists("usesShadowedDependencies") 122 | checkPropertyExists("developmentEnvironmentUserName") 123 | 124 | //Properties added in fork 125 | propertyDefaultIfUnset("skipBuildScriptUpdateCheck", false) 126 | propertyDefaultIfUnset("repositoryURL", "") 127 | propertyDefaultIfUnset("repositoryName", "") 128 | propertyDefaultIfUnset("mavenGroupId", "") 129 | propertyDefaultIfUnset("mavenArtifactId", "") 130 | propertyDefaultIfUnset("hasMixinDeps", false) 131 | propertyDefaultIfUnset("mixinConfigs", "") 132 | propertyDefaultIfUnset("mixinPluginPreInit", "") 133 | propertyDefaultIfUnset("mixinPluginMinimumVersion", "0.8.5") 134 | propertyDefaultIfUnset("remapStubs", false) 135 | 136 | propertyDefaultIfUnset("modrinthProjectId", "") 137 | propertyDefaultIfUnset("modrinthDependencies", "") 138 | propertyDefaultIfUnset("curseForgeProjectId", "") 139 | propertyDefaultIfUnset("curseForgeRelations", "") 140 | propertyDefaultIfUnset("changelog", "") 141 | 142 | propertyDefaultIfUnset("remoteMappings", "https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/") 143 | propertyDefaultIfUnset("mappingsChannel", "stable") 144 | propertyDefaultIfUnset("mappingsVersion", "12") 145 | 146 | String javaSourceDir = "src/main/java/" 147 | String scalaSourceDir = "src/main/scala/" 148 | String kotlinSourceDir = "src/main/kotlin/" 149 | 150 | String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") 151 | String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") 152 | String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") 153 | if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { 154 | throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) 155 | } 156 | 157 | if(apiPackage) { 158 | targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") 159 | targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") 160 | targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") 161 | if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { 162 | throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) 163 | } 164 | } 165 | 166 | if(accessTransformersFile) { 167 | String targetFile = "src/main/resources/META-INF/" + accessTransformersFile 168 | if(!getFile(targetFile).exists()) { 169 | throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) 170 | } 171 | } 172 | 173 | if(usesMixins.toBoolean()) { 174 | if(mixinsPackage.isEmpty()) { 175 | throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") 176 | } 177 | 178 | targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") 179 | targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") 180 | targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") 181 | if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { 182 | throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) 183 | } 184 | 185 | if (!mixinPlugin.isEmpty()) { 186 | String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" 187 | String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" 188 | String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" 189 | String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" 190 | if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { 191 | throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) 192 | } 193 | } 194 | } 195 | 196 | if(coreModClass) { 197 | String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" 198 | String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" 199 | String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" 200 | String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" 201 | if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { 202 | throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) 203 | } 204 | } 205 | 206 | configurations.all { 207 | resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) 208 | 209 | // Make sure GregTech build won't time out 210 | System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) 211 | System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) 212 | } 213 | 214 | // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version 215 | try { 216 | 'git config core.fileMode false'.execute() 217 | } 218 | catch (Exception ignored) { 219 | out.style(Style.Failure).println("git isn't installed at all") 220 | } 221 | 222 | // Pulls version first from the VERSION env and then git tag 223 | String identifiedVersion 224 | String versionOverride = System.getenv("VERSION") ?: null 225 | try { 226 | identifiedVersion = versionOverride == null ? gitVersion() : versionOverride 227 | } 228 | catch (Exception ignored) { 229 | out.style(Style.Failure).text( 230 | 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + 231 | 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + 232 | 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' 233 | ) 234 | versionOverride = 'NO-GIT-TAG-SET' 235 | identifiedVersion = versionOverride 236 | } 237 | version = identifiedVersion 238 | ext { 239 | modVersion = identifiedVersion 240 | } 241 | 242 | if(identifiedVersion == versionOverride) { 243 | out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') 244 | } 245 | 246 | group = modGroup 247 | if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { 248 | archivesBaseName = customArchiveBaseName 249 | } 250 | else { 251 | archivesBaseName = modId 252 | } 253 | archivesBaseName += "-mc" + minecraftVersion 254 | 255 | minecraft { 256 | version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion 257 | runDir = "run" 258 | 259 | if (replaceGradleTokenInFile) { 260 | replaceIn replaceGradleTokenInFile 261 | if(gradleTokenModId) { 262 | replace gradleTokenModId, modId 263 | } 264 | if(gradleTokenModName) { 265 | replace gradleTokenModName, modName 266 | } 267 | if(gradleTokenVersion) { 268 | replace gradleTokenVersion, modVersion 269 | } 270 | if(gradleTokenGroupName) { 271 | replace gradleTokenGroupName, modGroup 272 | } 273 | } 274 | } 275 | 276 | if(file("addon.gradle").exists()) { 277 | apply from: "addon.gradle" 278 | } 279 | 280 | apply from: 'repositories.gradle' 281 | 282 | configurations { 283 | implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored 284 | implementation.extendsFrom(shadowCompile) 285 | implementation.extendsFrom(shadeCompile) 286 | } 287 | 288 | repositories { 289 | maven { 290 | name = "Overmind forge repo mirror" 291 | url = "https://gregtech.overminddl1.com/" 292 | } 293 | if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) { 294 | maven { 295 | name = "sponge" 296 | url = "https://mvn.falsepattern.com/releases" 297 | } 298 | maven { 299 | name = "sponge2" 300 | url = "https://mvn.falsepattern.com/sponge" 301 | } 302 | } 303 | } 304 | 305 | dependencies { 306 | if(usesMixins.toBoolean()) { 307 | annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") 308 | annotationProcessor("com.google.guava:guava:24.1.1-jre") 309 | annotationProcessor("com.google.code.gson:gson:2.8.6") 310 | annotationProcessor("com.llamalad7:MixinExtras:0.1.1-gasstation") 311 | annotationProcessor("org.spongepowered:mixin:0.8.5-gasstation_6") 312 | } 313 | } 314 | 315 | apply from: 'dependencies.gradle' 316 | 317 | def mixinDir = new File(project.buildDir, 'mixins') 318 | if (!mixinDir.exists()) { 319 | mixinDir.mkdirs() 320 | } 321 | def mixingConfigRefMap = "mixins." + modId + ".refmap.json" 322 | def srgFile = new File(project.buildDir, 'srgs/mcp-srg.srg') 323 | def mixinSrg = new File(mixinDir, "${mixingConfigRefMap}.srg") 324 | def mixinRefMap = new File(mixinDir, mixingConfigRefMap) 325 | 326 | task generateAssets { 327 | if(usesMixins.toBoolean() && !mixinPlugin.isEmpty()) { 328 | getFile("/src/main/resources/mixins." + modId + ".json").text = """{ 329 | "required": true, 330 | "minVersion": "${mixinPluginMinimumVersion}", 331 | "package": "${modGroup}.${mixinsPackage}", 332 | "plugin": "${modGroup}.${mixinPlugin}", 333 | "refmap": "${mixingConfigRefMap}", 334 | "target": "@env(${mixinPluginPreInit.toBoolean() ? "PREINIT": "DEFAULT"})", 335 | "compatibilityLevel": "JAVA_8" 336 | } 337 | 338 | """ 339 | } 340 | } 341 | 342 | task relocateShadowJar(type: ConfigureShadowRelocation) { 343 | target = tasks.shadowJar 344 | prefix = modGroup + ".shadow" 345 | } 346 | 347 | shadowJar { 348 | if (remapStubs.toBoolean()) { 349 | dependsOn(removeStub) 350 | } 351 | project.configurations.shadeCompile.each { dep -> 352 | from(project.zipTree(dep)) { 353 | exclude 'META-INF', 'META-INF/**' 354 | } 355 | } 356 | 357 | manifest { 358 | attributes(getManifestAttributes()) 359 | } 360 | 361 | minimize() // This will only allow shading for actually used classes 362 | configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] 363 | dependsOn(relocateShadowJar) 364 | } 365 | 366 | jar { 367 | if (remapStubs.toBoolean()) { 368 | dependsOn(removeStub) 369 | } 370 | project.configurations.shadeCompile.each { dep -> 371 | from(project.zipTree(dep)) { 372 | exclude 'META-INF', 'META-INF/**' 373 | } 374 | } 375 | 376 | manifest { 377 | attributes(getManifestAttributes()) 378 | } 379 | 380 | if(usesShadowedDependencies.toBoolean()) { 381 | dependsOn(shadowJar) 382 | enabled = false 383 | } 384 | } 385 | 386 | reobf { 387 | if(usesMixins.toBoolean()) { 388 | addExtraSrgFile mixinSrg 389 | } 390 | } 391 | 392 | if(usesMixins.toBoolean()) { 393 | tasks.compileJava { 394 | options.compilerArgs += [ 395 | '-Xlint:-processing', 396 | "-AreobfSrgFile=${srgFile}", 397 | "-AoutSrgFile=${mixinSrg}", 398 | "-AoutRefMapFile=${mixinRefMap}" 399 | ] 400 | } 401 | } 402 | 403 | runClient { 404 | def arguments = [] 405 | def jvmArguments = [] 406 | 407 | if (usesMixins.toBoolean()) { 408 | arguments += [ 409 | "--mods=" + Paths.get("$projectDir").resolve(minecraft.runDir).normalize().relativize(Paths.get("$projectDir/build/libs/$archivesBaseName-${version}.jar")) 410 | ] 411 | } 412 | 413 | if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) { 414 | arguments += [ 415 | "--tweakClass", "org.spongepowered.asm.launch.MixinTweaker" 416 | ] 417 | jvmArguments += [ 418 | "-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" 419 | ] 420 | } 421 | 422 | if(developmentEnvironmentUserName) { 423 | arguments += [ 424 | "--username", 425 | developmentEnvironmentUserName 426 | ] 427 | } 428 | 429 | args(arguments) 430 | jvmArgs(jvmArguments) 431 | } 432 | 433 | runServer { 434 | def arguments = [] 435 | def jvmArguments = [] 436 | 437 | if (usesMixins.toBoolean()) { 438 | arguments += [ 439 | "--mods=" + Paths.get("$projectDir").resolve(minecraft.runDir).normalize().relativize(Paths.get("$projectDir/build/libs/$archivesBaseName-${version}.jar")) 440 | ] 441 | } 442 | 443 | if (usesMixins.toBoolean() || hasMixinDeps.toBoolean()) { 444 | arguments += [ 445 | "--tweakClass", "org.spongepowered.asm.launch.MixinTweaker" 446 | ] 447 | jvmArguments += [ 448 | "-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" 449 | ] 450 | } 451 | 452 | args(arguments) 453 | jvmArgs(jvmArguments) 454 | } 455 | 456 | tasks.withType(JavaExec).configureEach { 457 | javaLauncher.set( 458 | javaToolchains.launcherFor { 459 | languageVersion = projectJavaVersion 460 | } 461 | ) 462 | } 463 | 464 | processResources { 465 | // this will ensure that this task is redone when the versions change. 466 | inputs.property "version", project.version 467 | inputs.property "mcversion", project.minecraft.version 468 | 469 | // replace stuff in mcmod.info, nothing else 470 | from(sourceSets.main.resources.srcDirs) { 471 | include 'mcmod.info' 472 | 473 | // replace modVersion and minecraftVersion 474 | expand "minecraftVersion": project.minecraft.version, 475 | "modVersion": modVersion, 476 | "modId": modId, 477 | "modName": modName 478 | } 479 | 480 | if(usesMixins.toBoolean()) { 481 | from mixinRefMap 482 | } 483 | 484 | // copy everything else that's not the mcmod.info 485 | from(sourceSets.main.resources.srcDirs) { 486 | exclude 'mcmod.info' 487 | } 488 | } 489 | 490 | def getManifestAttributes() { 491 | def manifestAttributes = [:] 492 | if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { 493 | manifestAttributes += ["FMLCorePluginContainsFMLMod": true] 494 | } 495 | 496 | if(accessTransformersFile) { 497 | manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] 498 | } 499 | 500 | if(coreModClass) { 501 | manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] 502 | } 503 | 504 | if(usesMixins.toBoolean()) { 505 | String[] configs = []; 506 | if (!mixinPlugin.isEmpty()) { 507 | configs += ["mixins.${modId}.json"]; 508 | } 509 | if (!mixinConfigs.isEmpty()) { 510 | configs += [mixinConfigs]; 511 | } 512 | manifestAttributes += [ 513 | "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", 514 | "MixinConfigs" : String.join(",", configs), 515 | "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() 516 | ] 517 | } 518 | return manifestAttributes 519 | } 520 | 521 | task sourcesJar(type: Jar) { 522 | from (sourceSets.main.allSource) 523 | from (file("$projectDir/LICENSE")) 524 | getArchiveClassifier().set('sources') 525 | } 526 | 527 | task shadowDevJar(type: ShadowJar) { 528 | if (remapStubs.toBoolean()) { 529 | dependsOn(removeStub) 530 | } 531 | project.configurations.shadeCompile.each { dep -> 532 | from(project.zipTree(dep)) { 533 | exclude 'META-INF', 'META-INF/**' 534 | } 535 | } 536 | 537 | from sourceSets.main.output 538 | getArchiveClassifier().set("dev") 539 | 540 | manifest { 541 | attributes(getManifestAttributes()) 542 | } 543 | 544 | minimize() // This will only allow shading for actually used classes 545 | configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] 546 | } 547 | 548 | task relocateShadowDevJar(type: ConfigureShadowRelocation) { 549 | target = tasks.shadowDevJar 550 | prefix = modGroup + ".shadow" 551 | } 552 | 553 | task circularResolverJar(type: Jar) { 554 | dependsOn(relocateShadowDevJar) 555 | dependsOn(shadowDevJar) 556 | enabled = false 557 | } 558 | 559 | task devJar(type: Jar) { 560 | if (remapStubs.toBoolean()) { 561 | dependsOn(removeStub) 562 | } 563 | project.configurations.shadeCompile.each { dep -> 564 | from(project.zipTree(dep)) { 565 | exclude 'META-INF', 'META-INF/**' 566 | } 567 | } 568 | 569 | from sourceSets.main.output 570 | getArchiveClassifier().set("dev") 571 | 572 | manifest { 573 | attributes(getManifestAttributes()) 574 | } 575 | 576 | if(usesShadowedDependencies.toBoolean()) { 577 | dependsOn(circularResolverJar) 578 | enabled = false 579 | } 580 | } 581 | 582 | task apiJar(type: Jar) { 583 | from (sourceSets.main.allSource) { 584 | include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' 585 | } 586 | 587 | from (sourceSets.main.output) { 588 | include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' 589 | } 590 | 591 | from (sourceSets.main.resources.srcDirs) { 592 | include("LICENSE") 593 | } 594 | 595 | getArchiveClassifier().set('api') 596 | } 597 | 598 | task copySrgs(type: Copy, dependsOn: 'genSrgs') { 599 | from plugins.getPlugin('forge').delayedFile('{SRG_DIR}') 600 | include '**/*.srg' 601 | into layout.buildDirectory.file('srgs') 602 | } 603 | 604 | compileJava.dependsOn(copySrgs) 605 | 606 | artifacts { 607 | archives sourcesJar 608 | archives devJar 609 | if(apiPackage) { 610 | archives apiJar 611 | } 612 | } 613 | 614 | // The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), 615 | // and isn't strictly needed with the POM so just disable it. 616 | tasks.withType(GenerateModuleMetadata) { 617 | enabled = false 618 | } 619 | 620 | // workaround variable hiding in pom processing 621 | def projectConfigs = project.configurations 622 | 623 | // publishing 624 | 625 | def getMavenSettingsCredentials = { 626 | String userHome = System.getProperty( "user.home" ); 627 | File mavenSettings = new File(userHome, ".m2/settings.xml") 628 | def xmlSlurper = new XmlSlurper() 629 | def output = xmlSlurper.parse(mavenSettings) 630 | return output."servers"."server" 631 | } 632 | 633 | def getCredentials = { 634 | String username = System.getenv("MAVEN_DEPLOY_USER") 635 | String password = System.getenv("MAVEN_DEPLOY_PASSWORD") 636 | if (username == null) { 637 | try { 638 | def entries = getMavenSettingsCredentials() 639 | for (entry in entries) { 640 | if (entry."id".text() == repositoryName) { 641 | return [username: entry.username.text(), password: entry.password.text()] 642 | } 643 | } 644 | } catch (Exception ignored){} 645 | return [username: "none", password: "none"] 646 | } else { 647 | return [username: username, password: password] 648 | } 649 | } 650 | 651 | //Publishing 652 | publish.dependsOn(build) 653 | publishing { 654 | publications { 655 | maven(MavenPublication) { 656 | artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: "" 657 | artifact source: sourcesJar, classifier: "sources" 658 | artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" 659 | if (apiPackage) { 660 | artifact source: apiJar, classifier: "api" 661 | } 662 | 663 | groupId = mavenGroupId 664 | artifactId = mavenArtifactId + "-mc" + minecraftVersion 665 | version = modVersion 666 | 667 | // remove extra garbage from minecraft and minecraftDeps configuration 668 | pom.withXml { 669 | def badArtifacts = [:].withDefault {[] as Set} 670 | for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) { 671 | for (dependency in configuration.allDependencies) { 672 | badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name 673 | } 674 | } 675 | // example for specifying extra stuff to ignore 676 | // badArtifacts["org.example.group"] += "artifactName" 677 | 678 | Node pomNode = asNode() 679 | pomNode.dependencies.'*'.findAll() { 680 | badArtifacts[it.groupId.text()].contains(it.artifactId.text()) 681 | }.each() { 682 | it.parent().remove(it) 683 | } 684 | } 685 | } 686 | } 687 | 688 | repositories { 689 | if (repositoryURL.trim() != "") { 690 | maven { 691 | name = repositoryName 692 | url = repositoryURL 693 | def creds = getCredentials() 694 | credentials { 695 | username = creds?.username ?: "none" 696 | password = creds?.password ?: "none" 697 | } 698 | } 699 | } 700 | } 701 | } 702 | 703 | if (project.changelog == "") { 704 | File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") 705 | if (changelogFile.exists()) { 706 | project.changelog = changelogFile.getText("UTF-8") 707 | } else { 708 | project.changelog = "No changelog was provided." 709 | } 710 | } 711 | project.changelog = project.changelog.replace("{version}", modVersion) 712 | 713 | if (curseForgeProjectId != "" && System.getenv("CURSEFORGE_TOKEN") != null) { 714 | apply plugin: 'com.matthewprenger.cursegradle' 715 | curseforge { 716 | apiKey = System.getenv("CURSEFORGE_TOKEN") 717 | project { 718 | id = curseForgeProjectId 719 | changelogType = "markdown" 720 | changelog = project.changelog 721 | releaseType = modVersion.contains("-a") ? "alpha" : modVersion.contains("-b") ? "beta" : "release" 722 | addGameVersion project.minecraft.version 723 | addGameVersion "Forge" 724 | mainArtifact(jar) { 725 | displayName = "$modName version: $modVersion" 726 | } 727 | } 728 | options { 729 | javaIntegration = false 730 | forgeGradleIntegration = false 731 | } 732 | } 733 | if (curseForgeRelations.size() != 0) { 734 | String[] deps = curseForgeRelations.split(";") 735 | deps.each { dep -> 736 | if (dep.size() == 0) { 737 | return 738 | } 739 | String[] parts = dep.split(":") 740 | String type = parts[0] 741 | String name = parts[1] 742 | addCurseForgeRelation(type, name) 743 | } 744 | } 745 | tasks.curseforge.dependsOn(build) 746 | tasks.publish.dependsOn(tasks.curseforge) 747 | } 748 | 749 | if (modrinthProjectId != "" && System.getenv("MODRINTH_TOKEN") != null) { 750 | apply plugin: 'com.modrinth.minotaur' 751 | modrinth { 752 | token = System.getenv("MODRINTH_TOKEN") 753 | projectId = modrinthProjectId 754 | versionNumber = modVersion 755 | versionType = modVersion.contains("-a") ? "alpha" : modVersion.contains("-b") ? "beta" : "release" 756 | changelog = project.changelog 757 | uploadFile = jar 758 | gameVersions = [project.minecraft.version] 759 | loaders = ["forge"] 760 | } 761 | if (modrinthDependencies.size() != 0) { 762 | String[] deps = modrinthDependencies.split(";") 763 | deps.each { dep -> 764 | if (dep.size() == 0) { 765 | return 766 | } 767 | String[] parts = dep.split(":") 768 | String[] qual = parts[0].split("-") 769 | String scope = qual[0] 770 | String type = qual[1] 771 | String name = parts[1] 772 | addModrinthDep(scope, type, name) 773 | } 774 | } 775 | tasks.modrinth.dependsOn(build) 776 | tasks.publish.dependsOn(tasks.modrinth) 777 | } 778 | 779 | def addModrinthDep(scope, type, name) { 780 | com.modrinth.minotaur.dependencies.Dependency dep; 781 | if (!(scope in ["required", "optional", "incompatible", "embedded"])) { 782 | throw new Exception("Invalid modrinth dependency scope: " + scope) 783 | } 784 | switch (type) { 785 | case "project": 786 | dep = new ModDependency(name, scope) 787 | break 788 | case "version": 789 | dep = new VersionDependency(name, scope) 790 | break 791 | default: 792 | throw new Exception("Invalid modrinth dependency type: " + type) 793 | } 794 | project.modrinth.dependencies.add(dep) 795 | } 796 | 797 | def addCurseForgeRelation(type, name) { 798 | if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) { 799 | throw new Exception("Invalid CurseForge relation type: " + type) 800 | } 801 | CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact 802 | CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation())) 803 | rel."$type"(name) 804 | } 805 | 806 | // Updating 807 | task updateBuildScript { 808 | doLast { 809 | if (performBuildScriptUpdate(projectDir.toString())) return 810 | 811 | print("Build script already up-to-date!") 812 | } 813 | } 814 | 815 | if (!project.getGradle().startParameter.isOffline() && !skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(projectDir.toString())) { 816 | if (autoUpdateBuildScript.toBoolean()) { 817 | performBuildScriptUpdate(projectDir.toString()) 818 | } else { 819 | out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") 820 | } 821 | } 822 | 823 | static URL availableBuildScriptUrl() { 824 | new URL("https://raw.githubusercontent.com/FalsePattern/ExampleMod1.7.10/main/build.gradle") 825 | } 826 | 827 | boolean performBuildScriptUpdate(String projectDir) { 828 | if (isNewBuildScriptVersionAvailable(projectDir)) { 829 | def buildscriptFile = getFile("build.gradle") 830 | availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } 831 | out.println("Build script updated. Please REIMPORT the project or RESTART your IDE!") 832 | return true 833 | } 834 | return false 835 | } 836 | 837 | boolean isNewBuildScriptVersionAvailable(String projectDir) { 838 | Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] 839 | 840 | String currentBuildScript = getFile("build.gradle").getText() 841 | String currentBuildScriptHash = getVersionHash(currentBuildScript) 842 | String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() 843 | String availableBuildScriptHash = getVersionHash(availableBuildScript) 844 | 845 | boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash 846 | return !isUpToDate 847 | } 848 | 849 | static String getVersionHash(String buildScriptContent) { 850 | String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") 851 | if(versionLine != null) { 852 | return versionLine.split(": ").last() 853 | } 854 | return "" 855 | } 856 | 857 | configure(updateBuildScript) { 858 | group = 'forgegradle' 859 | description = 'Updates the build script to the latest version' 860 | } 861 | 862 | // Parameter Deobfuscation 863 | 864 | task deobfParams { 865 | doLast { 866 | 867 | String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$mappingsChannel/$mappingsVersion" 868 | String mcpZIP = "$mcpDir/mcp_$mappingsChannel-$mappingsVersion-${minecraftVersion}.zip" 869 | String paramsCSV = "$mcpDir/params.csv" 870 | 871 | download.run { 872 | src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$mappingsChannel/$mappingsVersion-$minecraftVersion/mcp_$mappingsChannel-$mappingsVersion-${minecraftVersion}.zip" 873 | dest mcpZIP 874 | overwrite false 875 | } 876 | 877 | if(!file(paramsCSV).exists()) { 878 | println("Extracting MCP archive ...") 879 | unzip(mcpZIP, mcpDir) 880 | } 881 | 882 | println("Parsing params.csv ...") 883 | Map params = new HashMap<>() 884 | Files.lines(Paths.get(paramsCSV)).forEach{line -> 885 | String[] cells = line.split(",") 886 | if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { 887 | params.put(cells[0], cells[1]) 888 | } 889 | } 890 | 891 | out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") 892 | out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") 893 | } 894 | } 895 | 896 | static int replaceParams(File file, Map params) { 897 | int fileCount = 0 898 | 899 | if(file.isDirectory()) { 900 | for(File f : file.listFiles()) { 901 | fileCount += replaceParams(f, params) 902 | } 903 | return fileCount 904 | } 905 | println("Visiting ${file.getName()} ...") 906 | try { 907 | String content = new String(Files.readAllBytes(file.toPath())) 908 | int hash = content.hashCode() 909 | params.forEach{key, value -> 910 | content = content.replaceAll(key, value) 911 | } 912 | if(hash != content.hashCode()) { 913 | Files.write(file.toPath(), content.getBytes("UTF-8")) 914 | return 1 915 | } 916 | } catch(Exception e) { 917 | e.printStackTrace() 918 | } 919 | return 0 920 | } 921 | 922 | // Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) 923 | static unzip(String zipFileName, String outputDir) { 924 | byte[] buffer = new byte[16384] 925 | ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) 926 | ZipEntry zipEntry = zis.getNextEntry() 927 | while (zipEntry != null) { 928 | File newFile = new File(outputDir + File.separator, zipEntry.name) 929 | if (zipEntry.isDirectory()) { 930 | if (!newFile.isDirectory() && !newFile.mkdirs()) { 931 | throw new IOException("Failed to create directory $newFile") 932 | } 933 | } else { 934 | // fix for Windows-created archives 935 | File parent = newFile.parentFile 936 | if (!parent.isDirectory() && !parent.mkdirs()) { 937 | throw new IOException("Failed to create directory $parent") 938 | } 939 | // write file content 940 | FileOutputStream fos = new FileOutputStream(newFile) 941 | int len = 0 942 | while ((len = zis.read(buffer)) > 0) { 943 | fos.write(buffer, 0, len) 944 | } 945 | fos.close() 946 | } 947 | zipEntry = zis.getNextEntry() 948 | } 949 | zis.closeEntry() 950 | zis.close() 951 | } 952 | 953 | configure(deobfParams) { 954 | group = 'forgegradle' 955 | description = 'Rename all obfuscated parameter names inherited from Minecraft classes' 956 | } 957 | 958 | // Dependency Deobfuscation 959 | 960 | def deobfMaven(mavenDep) { 961 | throw new GradleException("deobfMaven(mavenDep) is deprecated. " + 962 | "You must use the new deobfMaven(repoURL, mavenDep) method instead." + 963 | "The old method broke the buildscript when used.") 964 | } 965 | 966 | def deobfMaven(String repoURL, String mavenDep) { 967 | if (!repoURL.endsWith("/")) { 968 | repoURL += "/" 969 | } 970 | String[] parts = mavenDep.split(":") 971 | parts[0] = parts[0].replace('.', '/') 972 | def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar" 973 | return deobf(jarURL) 974 | } 975 | 976 | def deobf(String sourceURL) { 977 | try { 978 | URL url = new URL(sourceURL) 979 | String fileName = url.getFile() 980 | 981 | //get rid of directories: 982 | int lastSlash = fileName.lastIndexOf("/") 983 | if(lastSlash > 0) { 984 | fileName = fileName.substring(lastSlash + 1) 985 | } 986 | //get rid of extension: 987 | if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { 988 | fileName = fileName.substring(0, fileName.lastIndexOf(".")) 989 | } 990 | 991 | String hostName = url.getHost() 992 | if(hostName.startsWith("www.")) { 993 | hostName = hostName.substring(4) 994 | } 995 | List parts = Arrays.asList(hostName.split("\\.")) 996 | Collections.reverse(parts) 997 | hostName = String.join(".", parts) 998 | 999 | return deobf(sourceURL, "$hostName/$fileName") 1000 | } catch(Exception e) { 1001 | return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") 1002 | } 1003 | } 1004 | 1005 | // The method above is to be preferred. Use this method if the filename is not at the end of the URL. 1006 | def deobf(String sourceURL, String rawFileName) { 1007 | String bon2Version = "2.5.1" 1008 | String fileName = URLDecoder.decode(rawFileName, "UTF-8") 1009 | String cacheDir = "$project.gradle.gradleUserHomeDir/caches" 1010 | String bon2Dir = "$cacheDir/forge_gradle/deobf" 1011 | String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" 1012 | String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" 1013 | String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" 1014 | 1015 | if(file(deobfFile).exists()) { 1016 | return files(deobfFile) 1017 | } 1018 | 1019 | String mappingsVer 1020 | if(remoteMappings) { 1021 | String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" 1022 | String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" 1023 | 1024 | zipMappings(mappingsZIP, remoteMappings, bon2Dir) 1025 | 1026 | mappingsVer = "snapshot_$id" 1027 | } else { 1028 | mappingsVer = "${mappingsChannel}_$mappingsVersion" 1029 | } 1030 | 1031 | download.run { 1032 | src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" 1033 | dest bon2File 1034 | quiet true 1035 | overwrite false 1036 | } 1037 | 1038 | download.run { 1039 | src sourceURL 1040 | dest obfFile 1041 | quiet true 1042 | overwrite false 1043 | } 1044 | 1045 | exec { 1046 | commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' 1047 | workingDir bon2Dir 1048 | standardOutput = new FileOutputStream("${deobfFile}.log") 1049 | } 1050 | 1051 | return files(deobfFile) 1052 | } 1053 | 1054 | def zipMappings(String zipPath, String url, String bon2Dir) { 1055 | File zipFile = new File(zipPath) 1056 | if(zipFile.exists()) { 1057 | return 1058 | } 1059 | 1060 | String fieldsCache = "$bon2Dir/data/fields.csv" 1061 | String methodsCache = "$bon2Dir/data/methods.csv" 1062 | 1063 | download.run { 1064 | src "${url}fields.csv" 1065 | dest fieldsCache 1066 | quiet true 1067 | } 1068 | download.run { 1069 | src "${url}methods.csv" 1070 | dest methodsCache 1071 | quiet true 1072 | } 1073 | 1074 | zipFile.getParentFile().mkdirs() 1075 | ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) 1076 | 1077 | zos.putNextEntry(new ZipEntry("fields.csv")) 1078 | Files.copy(Paths.get(fieldsCache), zos) 1079 | zos.closeEntry() 1080 | 1081 | zos.putNextEntry(new ZipEntry("methods.csv")) 1082 | Files.copy(Paths.get(methodsCache), zos) 1083 | zos.closeEntry() 1084 | 1085 | zos.close() 1086 | } 1087 | 1088 | // Helper methods 1089 | 1090 | def checkPropertyExists(String propertyName) { 1091 | if (!project.hasProperty(propertyName)) { 1092 | throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/gradle.properties") 1093 | } 1094 | } 1095 | 1096 | def propertyDefaultIfUnset(String propertyName, defaultValue) { 1097 | if (!project.hasProperty(propertyName)) { 1098 | System.err.println("Your gradle.properties is missing the $propertyName entry. It has been automatically set to \"$defaultValue\" as fallback. You can find all properties and their description here: https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/gradle.properties") 1099 | } 1100 | if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { 1101 | project.ext.setProperty(propertyName, defaultValue) 1102 | } 1103 | } 1104 | 1105 | def getFile(String relativePath) { 1106 | return new File(projectDir, relativePath) 1107 | } 1108 | 1109 | if(file("addon_final.gradle").exists()) { 1110 | apply from: "addon_final.gradle" 1111 | } -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | // Add your dependencies here 2 | 3 | dependencies { 4 | shadeCompile("org.spongepowered:mixin:0.8.5-gasstation_7") 5 | shadeCompile("com.llamalad7:MixinExtras:0.1.1-gasstation") 6 | } 7 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Mod settings 2 | #region mod 3 | 4 | modName = GasStation 5 | 6 | # This is a case-sensitive string to identify your mod. Convention is to use lower case. 7 | modId = gasstation 8 | 9 | # The "root package" of your mod. All of your mod classes *should* be placed under this package for simplicity. 10 | modGroup = com.falsepattern.gasstation 11 | 12 | # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can 13 | # leave this property empty. 14 | # Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api 15 | apiPackage = 16 | 17 | # WHY is there no version field? 18 | # The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the 19 | # code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ 20 | # However, if you really want to, you can use the VERSION environment variable to override this. 21 | 22 | minecraftVersion = 1.7.10 23 | forgeVersion = 10.13.4.1614 24 | 25 | # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you 26 | # restart Minecraft in development. Choose this dependent on your mod: 27 | # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name 28 | # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty 29 | developmentEnvironmentUserName = Developer 30 | 31 | #endregion mod 32 | 33 | # Publishing settings 34 | #region publishing 35 | 36 | # Note: Both the modrinth and the curseforge publications are invoked by the "publish" gradle task 37 | # (when the respective publication's project ID is set up correctly, of course). You don't need to individually run 38 | # each of them. 39 | 40 | # Maven publishing 41 | #region maven 42 | 43 | # The maven server to upload the artifacts to 44 | repositoryURL = https://mvn.falsepattern.com/releases 45 | 46 | # What name is the login information inside ~/.m2/settings.xml stored under 47 | # (see https://gist.github.com/FalsePattern/82d93e3cfab01f671cc5f4a95931cfe3 for an example) 48 | # You can also use the MAVEN_DEPLOY_USER and MAVEN_DEPLOY_PASSWORD environment variables to set this information! 49 | repositoryName = mavenpattern 50 | 51 | # What the artifact should be called. These will be the "name" of the published package, suffixed with the minecraft 52 | # version with a -mc prefix (groupid:artifactid-mcminecraftVersion:version:qualifier). 53 | # For instance, the default values this example ships with would turn into com.myname:mymodid-mc1.7.10:version 54 | # The version is determined automatically from the git version. 55 | mavenGroupId = com.falsepattern 56 | mavenArtifactId = 00gasstation 57 | 58 | #endregion maven 59 | 60 | # Modrinth publishing 61 | #region modrinth 62 | 63 | # Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token. 64 | 65 | # The project's ID on Modrinth. Can be either the slug or the ID. 66 | # Leave this empty if you don't want to publish on Modrinth. 67 | modrinthProjectId = cdeAhgfp 68 | 69 | # The project's dependencies on Modrinth. You can use this to refer to other projects on Modrinth. 70 | # Syntax: scope1-type1:name1;scope2-type2:name2;... 71 | # Where scope can be one of [required, optional, incompatible, embedded], 72 | # type can be one of [project, version], 73 | # and the name is the Modrinth project or version slug/id of the other mod. 74 | # Example: required-project:fplib;optional-project:spongemixin1710;incompatible-project:gregtech 75 | modrinthDependencies = 76 | 77 | #endregion modrinth 78 | 79 | # CurseForge publishing 80 | #region curseforge 81 | 82 | # Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. 83 | 84 | # The project's numeric ID on CurseForge. You can find this in the About Project box. 85 | # Leave this empty if you don't want to publish on CurseForge. 86 | curseForgeProjectId = 667409 87 | 88 | # The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. 89 | # Syntax: type1:name1;type2:name2;... 90 | # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], 91 | # and the name is the CurseForge project id of the other mod. 92 | # Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft 93 | curseForgeRelations = 94 | 95 | #endregion curseforge 96 | 97 | # This will be inserted as the changelog text in the Modrinth/CurseForge publications. 98 | # If the text contains "{version}", it will be replaced with the current mod version. This is useful when the changelog 99 | # is just a URL pointing to a GitHub release tag. 100 | # If left empty, the changelog text will be set to "No changelog URL was provided." 101 | # Example: https://github.com/myname/mymod/releases/tag/{version} 102 | changelog = https://github.com/FalsePattern/GasStation/releases/tag/{version} 103 | 104 | # endregion publishing 105 | 106 | # Buildscript automatic update checker settings 107 | #region autoupdates 108 | 109 | # Will update your build.gradle automatically whenever an update is available 110 | autoUpdateBuildScript = false 111 | # Disable checking of buildscript updates. 112 | skipBuildScriptUpdateCheck = true 113 | 114 | #endregion autoupdates 115 | 116 | # Gradle token strings 117 | #region gradletokens 118 | 119 | # Define a source file of your project with: 120 | # public static final String VERSION = "GRADLETOKEN_VERSION"; 121 | # The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's 122 | # version in @Mod([...], version = VERSION, [...]) 123 | # Leave these properties empty to skip individual token replacements 124 | replaceGradleTokenInFile = Tags.java 125 | gradleTokenModId = GRADLETOKEN_MODID 126 | gradleTokenModName = GRADLETOKEN_MODNAME 127 | gradleTokenVersion = GRADLETOKEN_VERSION 128 | gradleTokenGroupName = GRADLETOKEN_GROUPNAME 129 | 130 | #endregion gradletokens 131 | 132 | # Mixins 133 | #region mixins 134 | 135 | # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! 136 | usesMixins = true 137 | # Enable this if one of the dependencies uses SpongeMixins. 138 | hasMixinDeps = false 139 | # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. 140 | mixinPlugin = 141 | # Whether you want the plugin to be configured as a PREINIT mixin 142 | mixinPluginPreInit = false 143 | # The minimum SpongePowered Mixins version required by the plugin. Internal default is 0.8.5 (GasStation) 144 | mixinPluginMinimumVersion = 145 | # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! 146 | mixinsPackage = mixins.mixin 147 | # Specify any custom mixin .json configs here. If you have multiple, comma-separate them. If you don't want to load 148 | # any jsons manually, leave this empty. You can use custom configs even if you already have a plugin added. 149 | # note: mixins..json is used by the mixinPlugin's autogenerated config. Additionally, the refmap from the mixinsPackage 150 | # is always put into mixins..refmap.json. 151 | # example: mixins.foo.json,mixins.bar.json 152 | mixinConfigs = mixins.gasstation_mixinbooter.json,mixins.gasstation_mixingasm.json,mixins.gasstation.json 153 | 154 | #endregion mixins 155 | 156 | # Coremod and access transformers 157 | #region core 158 | 159 | # Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ 160 | # Example value: mymodid_at.cfg 161 | accessTransformersFile = 162 | 163 | # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! 164 | # This parameter is for legacy compatibility only 165 | # Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin 166 | coreModClass = core.GasStationCore 167 | 168 | #endregion core 169 | 170 | # Dependency deobfuscation settings (advanced) 171 | #region ddeobf 172 | 173 | # These 3 entries specify the location where the SRG mappings should be fetched from. Only set these if you know 174 | # what you're doing. The defaults inside the buildscript should just work without any extra configuration. 175 | remoteMappings = 176 | mappingsChannel = 177 | mappingsVersion = 178 | 179 | #endregion ddeobf 180 | 181 | # Miscellaneous settings 182 | #region misc 183 | 184 | # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class 185 | # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! 186 | containsMixinsAndOrCoreModOnly = false 187 | 188 | # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your 189 | # responsibility check the licence and request permission for distribution, if required. 190 | usesShadowedDependencies = true 191 | 192 | # If enabled, class stubbing will be enabled. In this mode, all classes with a package named "stubpackage" in their 193 | # path will be removed, and all classes that refer to said classes will be modified so that the "stubpackage" will map 194 | # to the root package instead. This is useful for referring to compile-time inaccessible classes, such as classes in the 195 | # default package 196 | remapStubs = false 197 | 198 | # Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older 199 | # projects. New projects should not use this parameter. 200 | customArchiveBaseName = 00gasstation 201 | 202 | #endregion misc 203 | 204 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FalsePattern/GasStation/38bf2d78c394b78d4391fddb26bc09b5307013be/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /repositories.gradle: -------------------------------------------------------------------------------- 1 | // Add any additional repositories for your dependencies here 2 | 3 | repositories { 4 | maven { 5 | name = "mavenpattern" 6 | url = "https://mvn.falsepattern.com/releases" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/GasStation.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation; 2 | 3 | import cpw.mods.fml.common.Mod; 4 | 5 | @Mod(modid = Tags.MODID, 6 | version = Tags.VERSION, 7 | name = Tags.MODNAME, 8 | acceptableRemoteVersions = "*") 9 | public class GasStation { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/IEarlyMixinLoader.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Early mixins are defined as mixins that affects vanilla or forge classes. 7 | * Or technically, classes that can be queried via the current state of {@link net.minecraft.launchwrapper.LaunchClassLoader} 8 | *

9 | * If you want to add mixins that affect mods, use {@link ILateMixinLoader} 10 | *

11 | * Implement this in your {@link cpw.mods.fml.relauncher.IFMLLoadingPlugin}. 12 | * Return all early mixin configs you want MixinBooter to queue and send to Mixin library. 13 | */ 14 | public interface IEarlyMixinLoader { 15 | 16 | /** 17 | * @return mixin configurations to be queued and sent to Mixin library. 18 | */ 19 | List getMixinConfigs(); 20 | 21 | /** 22 | * Runs when a mixin config is successfully queued and sent to Mixin library. 23 | * 24 | * @param mixinConfig mixin config name, queried via {@link IEarlyMixinLoader#getMixinConfigs()}. 25 | * @return true if the mixinConfig should be queued, false if it should not. 26 | */ 27 | default boolean shouldMixinConfigQueue(String mixinConfig) { 28 | return true; 29 | } 30 | 31 | /** 32 | * Runs when a mixin config is successfully queued and sent to Mixin library. 33 | * 34 | * @param mixinConfig mixin config name, queried via {@link IEarlyMixinLoader#getMixinConfigs()}. 35 | */ 36 | default void onMixinConfigQueued(String mixinConfig) { 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/ILateMixinLoader.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Late mixins are defined as mixins that affects mod classes. 7 | * Or technically, classes that can be queried via the current state of 8 | * {@link net.minecraft.launchwrapper.LaunchClassLoader} 9 | *

10 | * Majority if not all vanilla and forge classes would have been loaded here. 11 | * If you want to add mixins that affect vanilla or forge, use and consult {@link IEarlyMixinLoader} 12 | *

13 | * Implement this in any arbitrary class. Said class will be constructed when mixins are ready to be queued. 14 | * Return all late mixin configs you want MixinBooter to queue and send to Mixin library. 15 | */ 16 | public interface ILateMixinLoader { 17 | 18 | /** 19 | * @return mixin configurations to be queued and sent to Mixin library. 20 | */ 21 | List getMixinConfigs(); 22 | 23 | /** 24 | * Runs when a mixin config is successfully queued and sent to Mixin library. 25 | * 26 | * @param mixinConfig mixin config name, queried via {@link ILateMixinLoader#getMixinConfigs()}. 27 | * @return true if the mixinConfig should be queued, false if it should not. 28 | */ 29 | default boolean shouldMixinConfigQueue(String mixinConfig) { 30 | return true; 31 | } 32 | 33 | /** 34 | * Runs when a mixin config is successfully queued and sent to Mixin library. 35 | * 36 | * @param mixinConfig mixin config name, queried via {@link ILateMixinLoader#getMixinConfigs()}. 37 | */ 38 | default void onMixinConfigQueued(String mixinConfig) { 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/MinecraftURLClassPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 TimeConqueror 3 | *

4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | *

6 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | *

8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | */ 10 | package com.falsepattern.gasstation; 11 | 12 | import com.google.common.io.Files; 13 | import sun.misc.URLClassPath; 14 | 15 | import net.minecraft.launchwrapper.Launch; 16 | import net.minecraft.launchwrapper.LaunchClassLoader; 17 | 18 | import java.io.File; 19 | import java.io.IOException; 20 | import java.lang.reflect.Field; 21 | import java.net.URL; 22 | import java.nio.file.Path; 23 | 24 | public class MinecraftURLClassPath { 25 | /** 26 | * Utility to manipulate the minecraft URL ClassPath 27 | */ 28 | private static final Path MOD_DIRECTORY_PATH = new File(Launch.minecraftHome, "mods/").toPath(); 29 | private static final URLClassPath ucp; 30 | 31 | static { 32 | try { 33 | Field ucpField = LaunchClassLoader.class.getSuperclass().getDeclaredField("ucp"); 34 | ucpField.setAccessible(true); 35 | 36 | ucp = (URLClassPath)ucpField.get(Launch.classLoader); 37 | } catch (NoSuchFieldException | IllegalAccessException e) { 38 | throw new RuntimeException(e.getMessage()); 39 | } 40 | } 41 | 42 | /** 43 | * Get a jar within the minecraft mods directory 44 | */ 45 | @SuppressWarnings("All") 46 | public static File getJarInModPath(final String jarname) { 47 | try { 48 | return java.nio.file.Files.walk(MOD_DIRECTORY_PATH) 49 | .filter( p -> { 50 | final String filename = p.toString(); 51 | final String extension = Files.getFileExtension(filename); 52 | 53 | return Files.getNameWithoutExtension(filename).contains(jarname) && ("jar".equals(extension) || "litemod".equals(extension)); 54 | }) 55 | .map(Path::toFile) 56 | .findFirst() 57 | .orElse(null); 58 | } catch (IOException e) { 59 | e.printStackTrace(); 60 | return null; 61 | } 62 | } 63 | 64 | /** 65 | * Returns true if the given mod is found within the class path; generally useful for identifying if a mod has been loaded 66 | * while running in dev due to a compile dependency 67 | */ 68 | @SuppressWarnings("All") 69 | public static boolean findJarInClassPath(final String jarname) { 70 | for(URL url : ucp.getURLs()) { 71 | final String filename = url.getFile(); 72 | final String extension = Files.getFileExtension(filename); 73 | 74 | if(Files.getNameWithoutExtension(filename).contains(jarname) && ("jar".equals(extension) || "litemod".equals(extension))) { 75 | return true; 76 | } 77 | } 78 | return false; 79 | } 80 | 81 | /** 82 | * Adds a Jar to the Minecraft URL ClassPath 83 | * - Needed when using mixins on classes outside of Minecraft or other coremods 84 | */ 85 | public static void addJar(File pathToJar) throws Exception { 86 | ucp.addURL(pathToJar.toURI().toURL()); 87 | } 88 | 89 | private MinecraftURLClassPath() { 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/Tags.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation; 2 | 3 | // Use this class for Strings only. Do not import any classes here. It will lead to issues with Mixins if in use! 4 | 5 | public class Tags { 6 | 7 | // GRADLETOKEN_* will be replaced by your configuration values at build time 8 | public static final String MODID = "GRADLETOKEN_MODID"; 9 | public static final String MODNAME = "GRADLETOKEN_MODNAME"; 10 | public static final String VERSION = "GRADLETOKEN_VERSION"; 11 | public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME"; 12 | } -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/core/GasStationCore.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation.core; 2 | 3 | import cpw.mods.fml.relauncher.IFMLLoadingPlugin; 4 | import net.minecraft.launchwrapper.Launch; 5 | 6 | import com.falsepattern.gasstation.Tags; 7 | import com.llamalad7.mixinextras.MixinExtrasBootstrap; 8 | import com.falsepattern.gasstation.IEarlyMixinLoader; 9 | import org.apache.logging.log4j.LogManager; 10 | import org.apache.logging.log4j.Logger; 11 | import org.spongepowered.asm.launch.MixinBootstrap; 12 | import org.spongepowered.asm.mixin.Mixins; 13 | import sun.misc.URLClassPath; 14 | 15 | import java.lang.reflect.Field; 16 | import java.net.URL; 17 | import java.net.URLClassLoader; 18 | import java.util.Arrays; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.Map; 22 | 23 | @IFMLLoadingPlugin.MCVersion("1.7.10") 24 | @IFMLLoadingPlugin.SortingIndex(Integer.MIN_VALUE + 5) 25 | @IFMLLoadingPlugin.Name(GasStationCore.PLUGIN_NAME) 26 | @IFMLLoadingPlugin.TransformerExclusions("com.falsepattern.gasstation.core") 27 | public class GasStationCore implements IFMLLoadingPlugin { 28 | public static final String PLUGIN_NAME = Tags.MODNAME + " Core Plugin"; 29 | public static final Logger LOGGER = LogManager.getLogger(PLUGIN_NAME); 30 | 31 | static { 32 | LOGGER.info("Initializing " + Tags.MODNAME + "Core"); 33 | fixMixinClasspathOrder(); 34 | MixinBootstrap.init(); 35 | MixinExtrasBootstrap.init(); 36 | } 37 | 38 | private static void fixMixinClasspathOrder() { 39 | // Borrowed from VanillaFix -- Move jar up in the classloader's URLs to make sure that the latest version of Mixin is used 40 | URL url = GasStationCore.class.getProtectionDomain().getCodeSource().getLocation(); 41 | givePriorityInClasspath(url, Launch.classLoader); 42 | givePriorityInClasspath(url, (URLClassLoader) ClassLoader.getSystemClassLoader()); 43 | } 44 | 45 | private static void givePriorityInClasspath(URL url, URLClassLoader classLoader) { 46 | try { 47 | Field ucpField = URLClassLoader.class.getDeclaredField("ucp"); 48 | ucpField.setAccessible(true); 49 | 50 | List urls = new ArrayList<>(Arrays.asList(classLoader.getURLs())); 51 | urls.remove(url); 52 | urls.add(0, url); 53 | URLClassPath ucp = new URLClassPath(urls.toArray(new URL[0])); 54 | 55 | ucpField.set(classLoader, ucp); 56 | } catch (ReflectiveOperationException e) { 57 | throw new AssertionError(e); 58 | } 59 | } 60 | 61 | 62 | @Override 63 | public String[] getASMTransformerClass() { 64 | return new String[0]; 65 | } 66 | 67 | @Override 68 | public String getModContainerClass() { 69 | return null; 70 | } 71 | 72 | @Override 73 | public String getSetupClass() { 74 | return null; 75 | } 76 | 77 | @Override 78 | public void injectData(Map data) { 79 | Object coremodList = data.get("coremodList"); 80 | if (coremodList instanceof List) { 81 | // noinspection rawtypes 82 | for (Object coremod : (List)coremodList) { 83 | try { 84 | Field field = coremod.getClass().getField("coreModInstance"); 85 | field.setAccessible(true); 86 | Object theMod = field.get(coremod); 87 | if (theMod instanceof IEarlyMixinLoader) { 88 | IEarlyMixinLoader loader = (IEarlyMixinLoader)theMod; 89 | for (String mixinConfig : loader.getMixinConfigs()) { 90 | if (loader.shouldMixinConfigQueue(mixinConfig)) { 91 | LOGGER.info("Adding {} mixin configuration.", mixinConfig); 92 | Mixins.addConfiguration(mixinConfig); 93 | loader.onMixinConfigQueued(mixinConfig); 94 | } 95 | } 96 | } 97 | } catch (Exception e) { 98 | LOGGER.error("Unexpected error", e); 99 | } 100 | } 101 | } 102 | } 103 | 104 | @Override 105 | public String getAccessTransformerClass() { 106 | return null; 107 | } 108 | } 109 | 110 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/mixins/DevMixinPlugin.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation.mixins; 2 | 3 | import com.falsepattern.gasstation.core.GasStationCore; 4 | import org.spongepowered.asm.lib.tree.ClassNode; 5 | import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 6 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 7 | 8 | import net.minecraft.launchwrapper.Launch; 9 | 10 | import java.io.IOException; 11 | import java.util.Arrays; 12 | import java.util.Collections; 13 | import java.util.List; 14 | import java.util.Set; 15 | 16 | public class DevMixinPlugin implements IMixinConfigPlugin { 17 | @Override 18 | public void onLoad(String mixinPackage) { 19 | 20 | } 21 | 22 | @Override 23 | public String getRefMapperConfig() { 24 | return null; 25 | } 26 | 27 | @Override 28 | public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { 29 | return true; 30 | } 31 | 32 | @Override 33 | public void acceptTargets(Set myTargets, Set otherTargets) { 34 | 35 | } 36 | 37 | @Override 38 | public List getMixins() { 39 | boolean isDev = false; 40 | try { 41 | if (Launch.classLoader.getClassBytes("net.minecraft.world.World") != null) 42 | isDev = true; 43 | } catch (IOException ignored) {} 44 | if (isDev) { 45 | GasStationCore.LOGGER.info("Development environment detected! Loading dev hotfixes..."); 46 | return Arrays.asList("dev.LoaderMixin", "dev.ModDiscovererMixin"); 47 | } else { 48 | GasStationCore.LOGGER.info("Development environment NOT detected! Skipping dev hotfixes..."); 49 | return Collections.emptyList(); 50 | } 51 | } 52 | 53 | @Override 54 | public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { 55 | 56 | } 57 | 58 | @Override 59 | public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/mixins/IModDiscovererMixin.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation.mixins; 2 | 3 | import cpw.mods.fml.common.discovery.ModCandidate; 4 | 5 | import java.util.List; 6 | 7 | public interface IModDiscovererMixin { 8 | List getCandidates(); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/mixins/mixin/LoadControllerMixin.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation.mixins.mixin; 2 | 3 | import cpw.mods.fml.common.*; 4 | import cpw.mods.fml.common.discovery.ASMDataTable; 5 | 6 | import com.falsepattern.gasstation.core.GasStationCore; 7 | import net.minecraft.launchwrapper.Launch; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.MixinEnvironment; 10 | import org.spongepowered.asm.mixin.Mixins; 11 | import org.spongepowered.asm.mixin.Shadow; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | import org.spongepowered.asm.mixin.injection.Inject; 14 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 15 | import org.spongepowered.asm.mixin.transformer.Proxy; 16 | import com.falsepattern.gasstation.ILateMixinLoader; 17 | 18 | import java.lang.reflect.Field; 19 | import java.lang.reflect.Method; 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | @Mixin(value = LoadController.class, remap = false) 24 | public abstract class LoadControllerMixin { 25 | 26 | @Shadow 27 | private Loader loader; 28 | 29 | @Inject(method = "distributeStateMessage(Lcpw/mods/fml/common/LoaderState;[Ljava/lang/Object;)V", 30 | at = @At("HEAD")) 31 | private void beforeConstructing(LoaderState state, Object[] eventData, CallbackInfo ci) throws Throwable { 32 | // This state is where Forge adds mod files to ModClassLoader 33 | if (state != LoaderState.CONSTRUCTING) { 34 | return; 35 | } 36 | 37 | ModClassLoader modClassLoader = (ModClassLoader)eventData[0]; 38 | ASMDataTable asmDataTable = (ASMDataTable)eventData[1]; 39 | 40 | GasStationCore.LOGGER.info("Instantiating all ILateMixinLoader implemented classes..."); 41 | List asmDatas = new ArrayList<>(asmDataTable.getAll(ILateMixinLoader.class.getName().replace('.', '/'))); 42 | asmDatas.addAll(asmDataTable.getAll(io.github.tox1cozz.mixinbooterlegacy.ILateMixinLoader.class.getName().replace('.', '/'))); 43 | for (ASMDataTable.ASMData asmData : asmDatas) { 44 | modClassLoader.addFile(asmData.getCandidate().getModContainer()); // Add to path before `newInstance` 45 | Class clazz = Class.forName(asmData.getClassName().replace('/', '.')); 46 | GasStationCore.LOGGER.info("Instantiating {} for its mixins.", clazz); 47 | ILateMixinLoader loader = (ILateMixinLoader)clazz.newInstance(); 48 | for (String mixinConfig : loader.getMixinConfigs()) { 49 | if (loader.shouldMixinConfigQueue(mixinConfig)) { 50 | GasStationCore.LOGGER.info("Adding {} mixin configuration.", mixinConfig); 51 | Mixins.addConfiguration(mixinConfig); 52 | loader.onMixinConfigQueued(mixinConfig); 53 | } 54 | } 55 | } 56 | 57 | for (ModContainer container : loader.getActiveModList()) { 58 | modClassLoader.addFile(container.getSource()); 59 | } 60 | 61 | Field transformerField = Proxy.class.getDeclaredField("transformer"); 62 | transformerField.setAccessible(true); 63 | @SuppressWarnings("OptionalGetWithoutIsPresent") 64 | Object transformer = transformerField.get(Launch.classLoader.getTransformers().stream().filter(Proxy.class::isInstance).findFirst().get()); 65 | 66 | Class mixinTransformerClass = Class.forName("org.spongepowered.asm.mixin.transformer.MixinTransformer"); 67 | 68 | Field processorField = mixinTransformerClass.getDeclaredField("processor"); 69 | processorField.setAccessible(true); 70 | Object processor = processorField.get(transformer); 71 | 72 | Class mixinProcessorClass = Class.forName("org.spongepowered.asm.mixin.transformer.MixinProcessor"); 73 | 74 | Method selectConfigsMethod = mixinProcessorClass.getDeclaredMethod("selectConfigs", MixinEnvironment.class); 75 | selectConfigsMethod.setAccessible(true); 76 | 77 | MixinEnvironment env = MixinEnvironment.getCurrentEnvironment(); 78 | selectConfigsMethod.invoke(processor, env); 79 | 80 | try { 81 | Method prepareConfigsMethod = mixinProcessorClass.getDeclaredMethod("prepareConfigs", MixinEnvironment.class); 82 | prepareConfigsMethod.setAccessible(true); 83 | prepareConfigsMethod.invoke(processor, env); 84 | } catch (NoSuchMethodException e) { // 0.8.3+ 85 | Class extensionsClass = Class.forName("org.spongepowered.asm.mixin.transformer.ext.Extensions"); 86 | @SuppressWarnings("JavaReflectionMemberAccess") 87 | Method prepareConfigsMethod = mixinProcessorClass.getDeclaredMethod("prepareConfigs", MixinEnvironment.class, extensionsClass); 88 | prepareConfigsMethod.setAccessible(true); 89 | 90 | Field extensionsField = mixinProcessorClass.getDeclaredField("extensions"); 91 | extensionsField.setAccessible(true); 92 | Object extensions = extensionsField.get(processor); 93 | 94 | //noinspection JavaReflectionInvocation 95 | prepareConfigsMethod.invoke(processor, env, extensions); 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/mixins/mixin/dev/LoaderMixin.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation.mixins.mixin.dev; 2 | 3 | import com.falsepattern.gasstation.mixins.IModDiscovererMixin; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Redirect; 7 | 8 | import cpw.mods.fml.common.Loader; 9 | import cpw.mods.fml.common.ModContainer; 10 | import cpw.mods.fml.common.discovery.ModCandidate; 11 | import cpw.mods.fml.common.discovery.ModDiscoverer; 12 | 13 | import java.io.File; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @Mixin(value = Loader.class, 18 | remap = false) 19 | public abstract class LoaderMixin { 20 | @Redirect(method = "identifyMods", 21 | at = @At(value = "INVOKE", 22 | target = "Lcpw/mods/fml/common/discovery/ModDiscoverer;identifyMods()Ljava/util/List;"), 23 | require = 1) 24 | private List removeDuplicateFiles(ModDiscoverer instance) { 25 | List candidates = ((IModDiscovererMixin)instance).getCandidates(); 26 | List uniques = new ArrayList<>(); 27 | List dupes = new ArrayList<>(); 28 | for(ModCandidate candidate: candidates) { 29 | File file = candidate.getModContainer().getAbsoluteFile().toPath().normalize().toFile(); 30 | boolean isUnique = true; 31 | for (ModCandidate uniqueCandidate: uniques) { 32 | File uniqueFile = uniqueCandidate.getModContainer().getAbsoluteFile().toPath().normalize().toFile(); 33 | if (file.equals(uniqueFile)) { 34 | isUnique = false; 35 | break; 36 | } 37 | } 38 | if (isUnique) { 39 | uniques.add(candidate); 40 | } else { 41 | dupes.add(candidate); 42 | } 43 | } 44 | candidates.removeAll(dupes); 45 | return instance.identifyMods(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/falsepattern/gasstation/mixins/mixin/dev/ModDiscovererMixin.java: -------------------------------------------------------------------------------- 1 | package com.falsepattern.gasstation.mixins.mixin.dev; 2 | 3 | import com.falsepattern.gasstation.mixins.IModDiscovererMixin; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 11 | 12 | import cpw.mods.fml.common.FMLLog; 13 | import cpw.mods.fml.common.ModClassLoader; 14 | import cpw.mods.fml.common.discovery.ContainerType; 15 | import cpw.mods.fml.common.discovery.ModCandidate; 16 | import cpw.mods.fml.common.discovery.ModDiscoverer; 17 | 18 | import java.io.File; 19 | import java.util.List; 20 | 21 | @Mixin(value = ModDiscoverer.class, 22 | remap = false) 23 | public abstract class ModDiscovererMixin implements IModDiscovererMixin { 24 | @Shadow private List candidates; 25 | 26 | @Override 27 | public List getCandidates() { 28 | return candidates; 29 | } 30 | 31 | @Inject(method = "findClasspathMods", 32 | at = @At(value = "INVOKE", 33 | target = "Lcpw/mods/fml/common/FMLLog;finer(Ljava/lang/String;[Ljava/lang/Object;)V"), 34 | locals = LocalCapture.CAPTURE_FAILHARD, 35 | require = 1) 36 | private void smartCheck(ModClassLoader modClassLoader, CallbackInfo ci, List knownLibraries, File[] minecraftSources, int i) { 37 | FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", minecraftSources[i].getAbsolutePath()); 38 | candidates.add(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.JAR, i == 0, true)); 39 | } 40 | 41 | @Redirect(method = "findClasspathMods", 42 | at = @At(value = "INVOKE", 43 | target = "Lcpw/mods/fml/common/FMLLog;finer(Ljava/lang/String;[Ljava/lang/Object;)V"), 44 | require = 1) 45 | private void noLog(String format, Object[] data) { 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/io/github/tox1cozz/mixinbooterlegacy/IEarlyMixinLoader.java: -------------------------------------------------------------------------------- 1 | package io.github.tox1cozz.mixinbooterlegacy; 2 | 3 | /** 4 | * This is here for mixin-booter-legacy backwards compat 5 | */ 6 | @SuppressWarnings("unused") 7 | public interface IEarlyMixinLoader extends com.falsepattern.gasstation.IEarlyMixinLoader { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/github/tox1cozz/mixinbooterlegacy/ILateMixinLoader.java: -------------------------------------------------------------------------------- 1 | package io.github.tox1cozz.mixinbooterlegacy; 2 | 3 | /** 4 | * This is here for mixin-booter-legacy backwards compat 5 | */ 6 | @SuppressWarnings("unused") 7 | public interface ILateMixinLoader extends com.falsepattern.gasstation.ILateMixinLoader { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/github/tox1cozz/mixinbooterlegacy/MixinBooterLegacyPlugin.java: -------------------------------------------------------------------------------- 1 | package io.github.tox1cozz.mixinbooterlegacy; 2 | 3 | import org.apache.logging.log4j.LogManager; 4 | import org.apache.logging.log4j.Logger; 5 | 6 | import cpw.mods.fml.common.Mod; 7 | 8 | /** 9 | * This is here for mixin-booter-legacy backwards compat 10 | */ 11 | @SuppressWarnings("unused") 12 | public class MixinBooterLegacyPlugin { 13 | public static final Logger LOGGER = LogManager.getLogger("MixinBooter"); 14 | 15 | @Mod(modid = "mixinbooterlegacy", 16 | version = "1.1.2", 17 | name = "MixinBooterLegacy", 18 | acceptableRemoteVersions = "*") 19 | public static class Container { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/makamys/mixingasm/DefaultConfigHelper.java: -------------------------------------------------------------------------------- 1 | package makamys.mixingasm; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.net.URI; 6 | import java.net.URL; 7 | import java.nio.file.FileSystems; 8 | import java.nio.file.Files; 9 | import java.nio.file.Path; 10 | import java.nio.file.Paths; 11 | import java.nio.file.StandardCopyOption; 12 | 13 | import org.apache.logging.log4j.LogManager; 14 | import org.apache.logging.log4j.Logger; 15 | 16 | import net.minecraft.launchwrapper.Launch; 17 | 18 | public class DefaultConfigHelper { 19 | 20 | private final String MODID; 21 | private final Logger LOGGER; 22 | 23 | public DefaultConfigHelper(String modid) { 24 | this.MODID = modid; 25 | this.LOGGER = LogManager.getLogger(MODID); 26 | } 27 | 28 | public Path getDefaultConfigFilePath(Path relPath) throws IOException { 29 | String resourceRelPath = Paths.get("assets/" + MODID + "/default_config/").resolve(relPath).toString().replace('\\', '/'); 30 | URL resourceURL = new Object() { }.getClass().getEnclosingClass().getClassLoader().getResource(resourceRelPath); 31 | 32 | switch(resourceURL.getProtocol()) { 33 | case "jar": 34 | String urlString = resourceURL.getPath(); 35 | int lastExclamation = urlString.lastIndexOf('!'); 36 | String newURLString = urlString.substring(0, lastExclamation); 37 | return FileSystems.newFileSystem(new File(URI.create(newURLString)).toPath(), null).getPath(resourceRelPath); 38 | case "file": 39 | return new File(URI.create(resourceURL.toString())).toPath(); 40 | default: 41 | return null; 42 | } 43 | } 44 | 45 | private void copyDefaultConfigFile(Path src, Path dest) throws IOException { 46 | Files.createDirectories(getParentSafe(dest)); 47 | LOGGER.debug("Copying " + src + " -> " + dest); 48 | Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING); 49 | } 50 | 51 | public boolean createDefaultConfigFileIfMissing(File destFile, boolean overwrite) { 52 | Path destConfigFolderPath = Paths.get(new File(Launch.minecraftHome, "config").getPath()); 53 | Path destFilePath = Paths.get(destFile.getPath()); 54 | 55 | Path destRelPath = destConfigFolderPath.relativize(destFilePath); 56 | 57 | if (destFilePath.startsWith(destConfigFolderPath)) { 58 | try { 59 | Path srcConfigPath = getDefaultConfigFilePath(destRelPath).toAbsolutePath(); 60 | if(Files.isRegularFile(srcConfigPath)) { 61 | if(!destFile.exists() || overwrite) { 62 | copyDefaultConfigFile(srcConfigPath, destFile.toPath()); 63 | } 64 | } else if(Files.isDirectory(srcConfigPath)) { 65 | Files.createDirectories(Paths.get(destFile.getPath())); 66 | // create contents of directory as well 67 | for(Path srcChildPath : Files.walk(srcConfigPath).toArray(Path[]::new)) { 68 | Path destPath = destFile.toPath().resolve(srcConfigPath.relativize(srcChildPath).toString()); 69 | if(!srcChildPath.equals(srcConfigPath) && srcChildPath.startsWith(srcConfigPath)) { 70 | if(!createDefaultConfigFileIfMissing(destPath.toFile(), overwrite)) { 71 | return false; 72 | } 73 | } 74 | } 75 | } 76 | } catch (IOException e) { 77 | LOGGER.error("Failed to create default config file for " + destRelPath.toString() + ": " + e.getMessage()); 78 | return false; 79 | } 80 | } else { 81 | LOGGER.debug("Invalid argument for creating default config file: " + destRelPath.toString() 82 | + " (file is not in the config directory)"); 83 | return false; 84 | } 85 | return true; 86 | } 87 | 88 | public Path getParentSafe(Path p) { 89 | if(p == null || p.getParent() == null) { 90 | return Paths.get(""); 91 | } else { 92 | return p.getParent(); 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /src/main/java/makamys/mixingasm/MixinConfigPlugin.java: -------------------------------------------------------------------------------- 1 | package makamys.mixingasm; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.Set; 6 | import org.spongepowered.asm.lib.tree.ClassNode; 7 | import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 8 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 9 | 10 | public class MixinConfigPlugin implements IMixinConfigPlugin { 11 | @Override 12 | public void onLoad(String mixinPackage) { 13 | Mixingasm.run(); 14 | } 15 | 16 | @Override 17 | public String getRefMapperConfig() { 18 | return null; 19 | } 20 | 21 | @Override 22 | public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { 23 | return true; 24 | } 25 | 26 | @Override 27 | public void acceptTargets(Set myTargets, Set otherTargets) { 28 | 29 | } 30 | 31 | @Override 32 | public List getMixins() { 33 | return Arrays.asList(); 34 | } 35 | 36 | @Override 37 | public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { 38 | 39 | } 40 | 41 | @Override 42 | public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { 43 | 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/main/java/makamys/mixingasm/Mixingasm.java: -------------------------------------------------------------------------------- 1 | package makamys.mixingasm; 2 | 3 | import java.io.File; 4 | import java.io.FileReader; 5 | import java.util.ArrayList; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | import java.util.regex.Pattern; 9 | import java.util.stream.Collectors; 10 | import java.util.stream.Stream; 11 | 12 | import org.apache.commons.io.IOUtils; 13 | import org.apache.logging.log4j.LogManager; 14 | import org.apache.logging.log4j.Logger; 15 | import org.spongepowered.asm.mixin.MixinEnvironment; 16 | 17 | import makamys.mixingasm.api.IMixinSafeTransformer; 18 | import makamys.mixingasm.api.TransformerInclusions; 19 | import net.minecraft.launchwrapper.IClassTransformer; 20 | import net.minecraft.launchwrapper.Launch; 21 | 22 | public class Mixingasm { 23 | 24 | public static final String MODID = "mixingasm"; 25 | public static final Logger LOGGER = LogManager.getLogger(MODID); 26 | 27 | public static void run() { 28 | List badTransformers = getBadTransformers(); 29 | LOGGER.debug("Excluding transformers: " + badTransformers); 30 | for(String badTransformer : badTransformers) { 31 | MixinEnvironment.getCurrentEnvironment().addTransformerExclusion(badTransformer); 32 | } 33 | } 34 | 35 | private static boolean isValidClassPattern(String pattern) { 36 | return !pattern.startsWith(":"); 37 | } 38 | 39 | private static List getBadTransformers() { 40 | List dynamicTransformerInclusionPatterns = TransformerInclusions.getTransformerInclusionList(); 41 | LOGGER.debug("Dynamic transformer inclusion pattern list: " + dynamicTransformerInclusionPatterns); 42 | 43 | List badTransformers = new ArrayList<>(); 44 | 45 | List transformerInclusionPatterns = Stream.of( 46 | readConfig("transformer_inclusion_list_default.txt").stream(), 47 | readConfig("transformer_inclusion_list.txt").stream(), 48 | dynamicTransformerInclusionPatterns.stream()) 49 | .flatMap(i -> i) 50 | .filter(Mixingasm::isValidClassPattern) 51 | .collect(Collectors.toList()); 52 | 53 | List transformerExclusionPatterns = 54 | readConfig("transformer_exclusion_list.txt").stream() 55 | .filter(Mixingasm::isValidClassPattern) 56 | .collect(Collectors.toList()); 57 | 58 | for(IClassTransformer trans : Launch.classLoader.getTransformers()) { 59 | String name = trans.getClass().getCanonicalName(); 60 | boolean included = false; 61 | if((included = (transformerInclusionPatterns.stream().anyMatch(p -> patternMatches(name, p)) || trans instanceof IMixinSafeTransformer)) 62 | && transformerExclusionPatterns.stream().noneMatch(p -> patternMatches(name, p))) { 63 | LOGGER.debug(" Trusting transformer " + name); 64 | } else { 65 | LOGGER.debug(" Not trusting transformer " + name + (included ? " (because it was excluded via the config)" : "")); 66 | badTransformers.add(name); 67 | } 68 | } 69 | return badTransformers; 70 | } 71 | 72 | private static boolean patternMatches(String str, String patternStr) { 73 | Pattern pattern = Pattern.compile(patternStr.replace(".", "\\.").replace("*", ".*")); 74 | return pattern.matcher(str).matches(); 75 | } 76 | 77 | private static List readConfig(String name){ 78 | DefaultConfigHelper helper = new DefaultConfigHelper(MODID); 79 | File listFile = new File(Launch.minecraftHome, "config/" + MODID + "/" + name); 80 | 81 | listFile.getParentFile().mkdirs(); 82 | 83 | List lines = listFile.exists() ? readConfigLines(listFile) : null; 84 | boolean overwrite = lines != null && lines.contains(":replaceableFile"); 85 | 86 | if(lines == null || overwrite) { 87 | helper.createDefaultConfigFileIfMissing(listFile, overwrite); 88 | lines = readConfigLines(listFile); 89 | } 90 | 91 | return lines; 92 | } 93 | 94 | private static List readConfigLines(File file){ 95 | try (FileReader fr = new FileReader(file)){ 96 | return IOUtils.readLines(fr).stream() 97 | .map(l -> l.contains("#") ? l.substring(0, l.indexOf('#')) : l) 98 | .map(l -> l.trim()) 99 | .filter(l -> !l.isEmpty()) 100 | .collect(Collectors.toList()); 101 | } catch(Exception e) { 102 | System.out.println("Failed to read " + file); 103 | e.printStackTrace(); 104 | } 105 | return Arrays.asList(); 106 | } 107 | 108 | } -------------------------------------------------------------------------------- /src/main/java/makamys/mixingasm/api/IMixinSafeTransformer.java: -------------------------------------------------------------------------------- 1 | package makamys.mixingasm.api; 2 | 3 | /** Implement this interface to signal that your transformer is "Mixin-safe", i.e. it does not cause issues when run by Mixin's preprocessor. This will be used as a hint that it shouldn't get excluded from the mixin preprocessor's transformer list by Mixingasm. */ 4 | 5 | public interface IMixinSafeTransformer { 6 | 7 | } -------------------------------------------------------------------------------- /src/main/java/makamys/mixingasm/api/TransformerInclusions.java: -------------------------------------------------------------------------------- 1 | package makamys.mixingasm.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import net.minecraft.launchwrapper.Launch; 7 | 8 | public class TransformerInclusions { 9 | 10 | private static final String INCLUSION_LIST_BLACKBOARD_KEY = "mixingasm.transformerInclusionList"; 11 | 12 | /** Returns Mixingasm's dynamic transformer inclusion list. Add transformer name patterns to this list if you want to spare them from being added to 13 | * the mixin environment's transformer exclusion list, for example if you need to mix into a version of a class that has been transformed by them. 14 | *

15 | * Note: this needs to be called before the DEFAULT phase. 16 | */ 17 | public static List getTransformerInclusionList(){ 18 | List list = (List)Launch.blackboard.get(INCLUSION_LIST_BLACKBOARD_KEY); 19 | if(list == null) { 20 | Launch.blackboard.put(INCLUSION_LIST_BLACKBOARD_KEY, list = new ArrayList()); 21 | } 22 | return list; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /src/main/java/makamys/mixingasm/forge/MixingasmMod.java: -------------------------------------------------------------------------------- 1 | package makamys.mixingasm.forge; 2 | 3 | import cpw.mods.fml.common.Mod; 4 | import makamys.mixingasm.Mixingasm; 5 | 6 | @Mod(modid = Mixingasm.MODID, version = "0.2.2") 7 | public class MixingasmMod { 8 | } -------------------------------------------------------------------------------- /src/main/java/ru/timeconqueror/spongemixins/MinecraftURLClassPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 TimeConqueror 3 | *

4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | *

6 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | *

8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | */ 10 | package ru.timeconqueror.spongemixins; 11 | 12 | import java.io.File; 13 | 14 | /** 15 | * This is here for SpongeMixins backwards compat 16 | */ 17 | @SuppressWarnings("unused") 18 | public final class MinecraftURLClassPath { 19 | public static File getJarInModPath(final String jarname) { 20 | return com.falsepattern.gasstation.MinecraftURLClassPath.getJarInModPath(jarname); 21 | } 22 | 23 | public static boolean findJarInClassPath(final String jarname) { 24 | return com.falsepattern.gasstation.MinecraftURLClassPath.findJarInClassPath(jarname); 25 | } 26 | 27 | public static void addJar(File pathToJar) throws Exception { 28 | com.falsepattern.gasstation.MinecraftURLClassPath.addJar(pathToJar); 29 | } 30 | 31 | private MinecraftURLClassPath() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/ru/timeconqueror/spongemixins/SpongeMixins.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 TimeConqueror 3 | *

4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | *

6 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | *

8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | */ 10 | package ru.timeconqueror.spongemixins; 11 | 12 | import cpw.mods.fml.common.Mod; 13 | import org.apache.logging.log4j.LogManager; 14 | import org.apache.logging.log4j.Logger; 15 | 16 | /** 17 | * This is here for SpongeMixins backwards compat 18 | */ 19 | @SuppressWarnings("unused") 20 | @Mod(modid = SpongeMixins.MODID, version = "1.5.0", name = SpongeMixins.NAME, acceptableRemoteVersions = "*") 21 | public class SpongeMixins { 22 | public static final String NAME = "SpongeMixins Loader"; 23 | public static final String MODID = "spongemixins"; 24 | public static final Logger LOGGER = LogManager.getLogger(NAME); 25 | } -------------------------------------------------------------------------------- /src/main/java/ru/timeconqueror/spongemixins/core/SpongeMixinsCore.java: -------------------------------------------------------------------------------- 1 | package ru.timeconqueror.spongemixins.core; 2 | 3 | import org.apache.logging.log4j.LogManager; 4 | import org.apache.logging.log4j.Logger; 5 | 6 | /** 7 | * This is here for SpongeMixins backwards compat 8 | */ 9 | public class SpongeMixinsCore { 10 | public static final String PLUGIN_NAME = "SpongeMixin Core Plugin"; 11 | public static final Logger LOGGER = LogManager.getLogger(PLUGIN_NAME); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/CREDITS: -------------------------------------------------------------------------------- 1 | Embedded code licenses: 2 | 3 | SpongePowered Mixins is licensed under MIT, and is compatible with LGPLv3. 4 | Full license notice here: https://github.com/SpongePowered/Mixin/blob/master/LICENSE.txt 5 | 6 | MixinExtras is licensed under MIT, and is compatible with LGPLv3. 7 | Full license notice here: https://github.com/LlamaLad7/MixinExtras/blob/master/LICENSE 8 | 9 | MixinBooterLegacy is licensed under LGPLv2.1+, and is compatible with LGPLv3. 10 | Full license notice here: https://github.com/tox1cozZ/mixin-booter-legacy/blob/master/LICENSE 11 | 12 | SpongeMixins is licensed under MIT, and is compatible with LGPLv3. 13 | Full license notice here: https://github.com/TimeConqueror/SpongeMixins/blob/master/LICENSE 14 | 15 | Mixingasm is licensed under Unlicense, and is compatible with LGPLv3. 16 | https://github.com/makamys/Mixingasm/blob/master/UNLICENSE -------------------------------------------------------------------------------- /src/main/resources/LICENSE: -------------------------------------------------------------------------------- 1 | GasStation 2 | 3 | Copyright (C) 2022 FalsePattern 4 | All Rights Reserved 5 | 6 | The above copyright notice, this permission notice and the word "SNEED" 7 | shall be included in all copies or substantial portions of the Software. 8 | 9 | This program is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with this program. If not, see . -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ITransformationService: -------------------------------------------------------------------------------- 1 | org.spongepowered.asm.launch.MixinTransformationService -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService: -------------------------------------------------------------------------------- 1 | org.spongepowered.asm.launch.MixinLaunchPlugin -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | org.spongepowered.tools.obfuscation.MixinObfuscationProcessorInjection 2 | org.spongepowered.tools.obfuscation.MixinObfuscationProcessorTargets 3 | com.llamalad7.mixinextras.MixinExtrasAP -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.spongepowered.asm.service.IGlobalPropertyService: -------------------------------------------------------------------------------- 1 | org.spongepowered.asm.service.mojang.Blackboard 2 | org.spongepowered.asm.service.modlauncher.Blackboard -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.spongepowered.asm.service.IMixinService: -------------------------------------------------------------------------------- 1 | org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper 2 | org.spongepowered.asm.service.modlauncher.MixinServiceModLauncher -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.spongepowered.asm.service.IMixinServiceBootstrap: -------------------------------------------------------------------------------- 1 | org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapperBootstrap 2 | org.spongepowered.asm.service.modlauncher.MixinServiceModLauncherBootstrap -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.spongepowered.tools.obfuscation.service.IObfuscationService: -------------------------------------------------------------------------------- 1 | org.spongepowered.tools.obfuscation.mcp.ObfuscationServiceMCP 2 | org.spongepowered.tools.obfuscation.fg3.ObfuscationServiceFG3 -------------------------------------------------------------------------------- /src/main/resources/assets/mixingasm/default_config/mixingasm/transformer_exclusion_list.txt: -------------------------------------------------------------------------------- 1 | # Classes listed in this file will be considered "untrusted" by Mixingasm and 2 | # added to the mixin environment's transformer exclusion list. 3 | # See transformer_inclusion_list_default.txt for more info. 4 | 5 | 6 | # --- Untrusted transformers --- -------------------------------------------------------------------------------- /src/main/resources/assets/mixingasm/default_config/mixingasm/transformer_inclusion_list.txt: -------------------------------------------------------------------------------- 1 | # Classes listed in this file will be considered "trusted" by Mixingasm and 2 | # may be spared from the mixin environment's transformer exclusion list. 3 | # See transformer_inclusion_list_default.txt for more info. 4 | 5 | 6 | # --- Additional trusted transformers --- -------------------------------------------------------------------------------- /src/main/resources/assets/mixingasm/default_config/mixingasm/transformer_inclusion_list_default.txt: -------------------------------------------------------------------------------- 1 | :replaceableFile # This file will get OVERWRITTEN at launch, nullifying any changes made to it, unless you delete this line. It is recommended to edit transformer_inclusion_list.txt and transformer_exclusion_list.txt instead, though. 2 | 3 | # Mixingasm adds all transformers it doesn't "trust" to be Mixin-safe to the 4 | # mixin environment's transformer exclusion list, avoiding running them an 5 | # additional time when processing mixins at startup. 6 | 7 | # This fixes issues that can arise from non-Mixin-aware transformers being run 8 | # in that way. For example, some transformers break when run more than once. 9 | 10 | # A transformer is considered "trusted" if one of these are true... 11 | # * It's matched by a pattern in this file 12 | # * It's matched by a pattern in transformer_inclusion_list.txt 13 | # * It was added to Mixingasm's dynamic inclusion list by a mod using the API at startup 14 | # * The transformer implements IMixinSafeTransformer 15 | # AND the transformer is not matched by a pattern in transformer_exclusion_list.txt 16 | 17 | # '*' can be used as a wildcard character. 18 | 19 | 20 | # --- Trusted transformers --- 21 | 22 | cpw.mods.fml.common.asm.* 23 | net.minecraftforge.* 24 | codechicken.core.asm.* 25 | codechicken.lib.asm.* 26 | org.spongepowered.asm.* -------------------------------------------------------------------------------- /src/main/resources/gasstation_parity.txt: -------------------------------------------------------------------------------- 1 | This file is here for tracking feature parity with upstream projects we pulled in code from. 2 | 3 | MBL: 3997fe943aab26bc916bb745f229b12651d769d3 4 | SM: c372c9010f9854dc80415a8fd1ff414fd0822f00 5 | MGASM: 0295a8243255e0dd63d8a995d61c0295f14834db -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "${modId}", 4 | "name": "${modName}", 5 | "description": "Just another mixin library with some extras", 6 | "version": "${modVersion}", 7 | "mcversion": "${minecraftVersion}", 8 | "url": "https://github.com/FalsePattern/GasStation", 9 | "updateUrl": "", 10 | "authorList": [ 11 | "FalsePattern" 12 | ], 13 | "credits": "", 14 | "logoFile": "", 15 | "screenshots": [], 16 | "dependencies": [] 17 | }, 18 | { 19 | "modid": "mixinbooterlegacy", 20 | "name": "MixinBooterLegacy", 21 | "description": "GasStation's MixinBooterLegacy stub for mods that depend on it", 22 | "version": "1.1.2", 23 | "mcversion": "${minecraftVersion}", 24 | "url": "https://github.com/tox1cozZ/mixin-booter-legacy", 25 | "updateUrl": "", 26 | "authorList": [ 27 | "Rongmario", 28 | "tox1cozZ" 29 | ], 30 | "credits": "Thanks Rongmario for a MixinBooter on Minecraft 1.12.2.", 31 | "logoFile": "", 32 | "screenshots": [], 33 | "parent": "${modId}", 34 | "dependencies": [] 35 | }, 36 | { 37 | "modid": "spongemixins", 38 | "name": "SpongeMixins", 39 | "description": "GasStation's SpongeMixins stub for mods that depend on it", 40 | "version": "1.5.0", 41 | "mcversion": "${minecraftVersion}", 42 | "url": "", 43 | "updateUrl": "", 44 | "authorList": [ 45 | "Time_Conqueror" 46 | ], 47 | "credits": "SpongePowered Team", 48 | "logoFile": "", 49 | "screenshots": [], 50 | "parent": "${modId}", 51 | "dependencies": [] 52 | }, 53 | { 54 | "modid": "mixingasm", 55 | "name": "Mixingasm", 56 | "description": "Improves compatibility between mixin mods and ASM mods", 57 | "version": "0.2.2", 58 | "mcversion": "${minecraftVersion}", 59 | "url": "", 60 | "updateUrl": "", 61 | "authorList": ["makamys"], 62 | "logoFile": "", 63 | "screenshots": [], 64 | "parent": "${modId}", 65 | "dependencies": [] 66 | } 67 | ] 68 | -------------------------------------------------------------------------------- /src/main/resources/mixins.gasstation.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8.3", 4 | "package": "com.falsepattern.gasstation.mixins.mixin", 5 | "refmap": "mixins.gasstation.refmap.json", 6 | "target": "@env(PREINIT)", 7 | "compatibilityLevel": "JAVA_8", 8 | "mixins": [ 9 | 10 | ], 11 | "plugin": "com.falsepattern.gasstation.mixins.DevMixinPlugin" 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/main/resources/mixins.gasstation_mixinbooter.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8.3", 4 | "package": "com.falsepattern.gasstation.mixins.mixin", 5 | "refmap": "mixins.gasstation.refmap.json", 6 | "target": "@env(PREINIT)", 7 | "compatibilityLevel": "JAVA_8", 8 | "mixins": ["LoadControllerMixin"] 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/mixins.gasstation_mixingasm.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.6", 4 | "package": "com.falsepattern.gasstation.mixins.mixin", 5 | "compatibilityLevel": "JAVA_8", 6 | "mixins": [ 7 | 8 | ], 9 | "plugin": "makamys.mixingasm.MixinConfigPlugin" 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | {} --------------------------------------------------------------------------------