├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── nounusedchunks-2-fabric-1.18.2 ├── .github │ └── workflows │ │ └── build.yml ├── .gitignore ├── LICENSE ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── java │ ├── io │ │ └── github │ │ │ └── thecsdev │ │ │ └── nounusedchunks │ │ │ ├── NoUnusedChunks.java │ │ │ ├── NoUnusedChunksConfig.java │ │ │ ├── NoUnusedChunksFabric.java │ │ │ ├── NoUnusedChunksForge.java │ │ │ ├── client │ │ │ ├── NoUnusedChunksClient.java │ │ │ ├── gui │ │ │ │ ├── util │ │ │ │ │ └── GuiUtils.java │ │ │ │ └── widgets │ │ │ │ │ └── ActionCheckboxWidget.java │ │ │ └── mixin │ │ │ │ ├── addons │ │ │ │ └── AddonBackupPromptScreen.java │ │ │ │ ├── events │ │ │ │ └── MixinBackupPromptScreen.java │ │ │ │ └── hooks │ │ │ │ └── AccessorScreen.java │ │ │ ├── mixin │ │ │ └── events │ │ │ │ └── MixinWorldUpdater.java │ │ │ └── server │ │ │ └── NoUnusedChunksServer.java │ ├── net │ │ └── minecraftforge │ │ │ ├── api │ │ │ └── distmarker │ │ │ │ └── Dist.java │ │ │ └── fml │ │ │ ├── common │ │ │ └── Mod.java │ │ │ └── loading │ │ │ └── FMLEnvironment.java │ └── readme.txt │ └── resources │ ├── META-INF │ └── mods.toml │ ├── assets │ └── nounusedchunks │ │ ├── icon.png │ │ └── lang │ │ └── en_us.json │ ├── fabric.mod.json │ ├── nounusedchunks.client.mixin.events.json │ ├── nounusedchunks.client.mixin.hooks.json │ ├── nounusedchunks.mixin.events.json │ └── pack.mcmeta ├── nounusedchunks-2-fabric-1.19.2 ├── .github │ └── workflows │ │ └── build.yml ├── .gitignore ├── LICENSE ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── java │ ├── io │ │ └── github │ │ │ └── thecsdev │ │ │ └── nounusedchunks │ │ │ ├── NoUnusedChunks.java │ │ │ ├── NoUnusedChunksConfig.java │ │ │ ├── NoUnusedChunksFabric.java │ │ │ ├── NoUnusedChunksForge.java │ │ │ ├── client │ │ │ ├── NoUnusedChunksClient.java │ │ │ ├── gui │ │ │ │ ├── util │ │ │ │ │ └── GuiUtils.java │ │ │ │ └── widgets │ │ │ │ │ └── ActionCheckboxWidget.java │ │ │ └── mixin │ │ │ │ ├── addons │ │ │ │ └── AddonBackupPromptScreen.java │ │ │ │ ├── events │ │ │ │ └── MixinBackupPromptScreen.java │ │ │ │ └── hooks │ │ │ │ └── AccessorScreen.java │ │ │ ├── mixin │ │ │ └── events │ │ │ │ └── MixinWorldUpdater.java │ │ │ └── server │ │ │ └── NoUnusedChunksServer.java │ ├── net │ │ └── minecraftforge │ │ │ ├── api │ │ │ └── distmarker │ │ │ │ └── Dist.java │ │ │ └── fml │ │ │ ├── common │ │ │ └── Mod.java │ │ │ └── loading │ │ │ └── FMLEnvironment.java │ └── readme.txt │ └── resources │ ├── META-INF │ └── mods.toml │ ├── assets │ └── nounusedchunks │ │ ├── icon.png │ │ └── lang │ │ └── en_us.json │ ├── fabric.mod.json │ ├── nounusedchunks.client.mixin.events.json │ ├── nounusedchunks.client.mixin.hooks.json │ ├── nounusedchunks.mixin.events.json │ └── pack.mcmeta ├── nounusedchunks-2-fabric-1.19.3 ├── .github │ └── workflows │ │ └── build.yml ├── .gitignore ├── LICENSE ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── java │ ├── io │ │ └── github │ │ │ └── thecsdev │ │ │ └── nounusedchunks │ │ │ ├── NoUnusedChunks.java │ │ │ ├── NoUnusedChunksConfig.java │ │ │ ├── NoUnusedChunksFabric.java │ │ │ ├── NoUnusedChunksForge.java │ │ │ ├── client │ │ │ ├── NoUnusedChunksClient.java │ │ │ ├── gui │ │ │ │ └── widgets │ │ │ │ │ └── ActionCheckboxWidget.java │ │ │ └── mixin │ │ │ │ ├── addons │ │ │ │ └── AddonBackupPromptScreen.java │ │ │ │ ├── events │ │ │ │ └── MixinBackupPromptScreen.java │ │ │ │ └── hooks │ │ │ │ └── AccessorScreen.java │ │ │ ├── mixin │ │ │ └── events │ │ │ │ └── MixinWorldUpdater.java │ │ │ └── server │ │ │ └── NoUnusedChunksServer.java │ ├── net │ │ └── minecraftforge │ │ │ ├── api │ │ │ └── distmarker │ │ │ │ └── Dist.java │ │ │ └── fml │ │ │ ├── common │ │ │ └── Mod.java │ │ │ └── loading │ │ │ └── FMLEnvironment.java │ └── readme.txt │ └── resources │ ├── META-INF │ └── mods.toml │ ├── assets │ └── nounusedchunks │ │ ├── icon.png │ │ └── lang │ │ └── en_us.json │ ├── fabric.mod.json │ ├── nounusedchunks.client.mixin.events.json │ ├── nounusedchunks.client.mixin.hooks.json │ ├── nounusedchunks.mixin.events.json │ └── pack.mcmeta ├── nounusedchunks-2-fabric-1.19.4 ├── .github │ └── workflows │ │ └── build.yml ├── .gitignore ├── LICENSE ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── java │ ├── io │ │ └── github │ │ │ └── thecsdev │ │ │ └── nounusedchunks │ │ │ ├── NoUnusedChunks.java │ │ │ ├── NoUnusedChunksConfig.java │ │ │ ├── NoUnusedChunksFabric.java │ │ │ ├── NoUnusedChunksForge.java │ │ │ ├── client │ │ │ ├── NoUnusedChunksClient.java │ │ │ ├── gui │ │ │ │ └── widgets │ │ │ │ │ └── ActionCheckboxWidget.java │ │ │ └── mixin │ │ │ │ ├── addons │ │ │ │ └── AddonBackupPromptScreen.java │ │ │ │ ├── events │ │ │ │ └── MixinBackupPromptScreen.java │ │ │ │ └── hooks │ │ │ │ └── AccessorScreen.java │ │ │ ├── mixin │ │ │ └── events │ │ │ │ └── MixinWorldUpdater.java │ │ │ └── server │ │ │ └── NoUnusedChunksServer.java │ ├── net │ │ └── minecraftforge │ │ │ ├── api │ │ │ └── distmarker │ │ │ │ └── Dist.java │ │ │ └── fml │ │ │ ├── common │ │ │ └── Mod.java │ │ │ └── loading │ │ │ └── FMLEnvironment.java │ └── readme.txt │ └── resources │ ├── META-INF │ └── mods.toml │ ├── assets │ └── nounusedchunks │ │ ├── icon.png │ │ └── lang │ │ └── en_us.json │ ├── fabric.mod.json │ ├── nounusedchunks.client.mixin.events.json │ ├── nounusedchunks.client.mixin.hooks.json │ ├── nounusedchunks.mixin.events.json │ └── pack.mcmeta └── nounusedchunks-2-fabric-1.20.1 ├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java ├── io │ └── github │ │ └── thecsdev │ │ └── nounusedchunks │ │ ├── NoUnusedChunks.java │ │ ├── NoUnusedChunksConfig.java │ │ ├── NoUnusedChunksFabric.java │ │ ├── NoUnusedChunksForge.java │ │ ├── client │ │ ├── NoUnusedChunksClient.java │ │ ├── gui │ │ │ └── widgets │ │ │ │ └── ActionCheckboxWidget.java │ │ └── mixin │ │ │ ├── addons │ │ │ └── AddonBackupPromptScreen.java │ │ │ ├── events │ │ │ └── MixinBackupPromptScreen.java │ │ │ └── hooks │ │ │ └── AccessorScreen.java │ │ ├── mixin │ │ └── events │ │ │ └── MixinWorldUpdater.java │ │ └── server │ │ └── NoUnusedChunksServer.java ├── net │ └── minecraftforge │ │ ├── api │ │ └── distmarker │ │ │ └── Dist.java │ │ └── fml │ │ ├── common │ │ └── Mod.java │ │ └── loading │ │ └── FMLEnvironment.java └── readme.txt └── resources ├── META-INF └── mods.toml ├── assets └── nounusedchunks │ ├── icon.png │ └── lang │ └── en_us.json ├── fabric.mod.json ├── nounusedchunks.client.mixin.events.json ├── nounusedchunks.client.mixin.hooks.json ├── nounusedchunks.mixin.events.json └── pack.mcmeta /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # -------------------- Eclipse IDE ------------------- 2 | .metadata 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .settings/ 11 | .loadpath 12 | .recommenders 13 | 14 | # External tool builders 15 | .externalToolBuilders/ 16 | 17 | # Locally stored "Eclipse launch configurations" 18 | *.launch 19 | 20 | # PyDev specific (Python IDE for Eclipse) 21 | *.pydevproject 22 | 23 | # CDT-specific (C/C++ Development Tooling) 24 | .cproject 25 | 26 | # CDT- autotools 27 | .autotools 28 | 29 | # Java annotation processor (APT) 30 | .factorypath 31 | 32 | # PDT-specific (PHP Development Tools) 33 | .buildpath 34 | 35 | # sbteclipse plugin 36 | .target 37 | 38 | # Tern plugin 39 | .tern-project 40 | 41 | # TeXlipse plugin 42 | .texlipse 43 | 44 | # STS (Spring Tool Suite) 45 | .springBeans 46 | 47 | # Code Recommenders 48 | .recommenders/ 49 | 50 | # Annotation Processing 51 | .apt_generated/ 52 | .apt_generated_test/ 53 | 54 | # Scala IDE specific (Scala & Java development for Eclipse) 55 | .cache-main 56 | .scala_dependencies 57 | .worksheet 58 | 59 | # Uncomment this line if you wish to ignore the project description file. 60 | # Typically, this file would be tracked if it contains build/dependency configurations: 61 | #.project 62 | 63 | # ----------------------- Java ----------------------- 64 | # Compiled class file 65 | *.class 66 | 67 | # Log file 68 | *.log 69 | 70 | # BlueJ files 71 | *.ctxt 72 | 73 | # Mobile Tools for Java (J2ME) 74 | .mtj.tmp/ 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.nar 80 | *.ear 81 | *.zip 82 | *.tar.gz 83 | *.rar 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | /.gradle/ 88 | /build/ 89 | 90 | # ----------------------- Gradle ----------------------- 91 | .gradle 92 | **/build/ 93 | !src/**/build/ 94 | 95 | # Ignore Gradle GUI config 96 | gradle-app.setting 97 | 98 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 99 | !gradle-wrapper.jar 100 | 101 | # Avoid ignore Gradle wrappper properties 102 | !gradle-wrapper.properties 103 | 104 | # Cache of project 105 | .gradletasknamecache 106 | 107 | # Eclipse Gradle plugin generated files 108 | # Eclipse Core 109 | .project 110 | # JDT-specific (Eclipse Java Development Tools) 111 | .classpath 112 | 113 | # ----------------------- Fabric ----------------------- 114 | run/ 115 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheCSDev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## No unused chunks 2 | This Minecraft mod reduces world size by discarding unused chunks. 3 | 4 | Important: Please back-up your world if you are planning on using this mod on an already existing world. 5 | This mod shouldn't cause any issues, but it is still a good idea to back-up worlds, just in case. 6 | 7 | ### How to use this mod: 8 | 1. Go to the world selection screen 9 | 2. Select a world of your choice 10 | 3. Click on the "Edit" button 11 | 4. Click on the "Optimize World" button 12 | 5. There should be a checkbox called "Remove uninhabited chunks". Check it it. 13 | 6. Click on "Create backup and Load". This will back-up your world just in case something goes wrong. 14 | 7. That's it. It's best to also verify everything went to plan and that no data loss took place. 15 | 16 | ## How well does the mod do? 17 | I performed a few tests in Minecraft 1.18.2 by generating an 18x18 chunk area with 18 render distance in a few worlds with and without the mod. I then measured the world sizes after each chunk generation to see what the world size was after generating was done. 18 | ```cs 19 | ------------------------------------------------ 20 | # Default (18x18) (100% unflag) (Seed: -4665624743998437880) 21 | - Without mod: ~23.9 MB 22 | - With mod: ~14.4 MB 23 | - Saved: ~9.5 MB (-39.75%) 24 | ------------------------------------------------ 25 | # Default (18x18) (100% unflag) (Seed: 2419730229291416458) 26 | - Without mod: ~24 MB 27 | - With mod: ~14.4 MB 28 | - Saved: ~9.6 MB (-40%) 29 | ------------------------------------------------ 30 | # Superflat (18x18) (no features) (no entities) (100% unflag) (Seed: idk) 31 | - Without mod: ~15.5 MB 32 | - With mod: ~6.25 MB 33 | - Saved: ~9.25 MB (-59.7%) 34 | ------------------------------------------------ 35 | # Amplified (18x18) (100% unflag) (Seed: -2757405298360622893) 36 | - Without mod: ~25.5 MB 37 | - With mod: ~15.8 MB 38 | - Saved: ~9.7 MB (-38.04%) 39 | ------------------------------------------------ 40 | ``` 41 | 42 | ### Important notice: 43 | - The game keeps track of which chunks players have interacted with using a special variable called "InhabitedTime". Whenever a player enters a chunk or does something to a chunk, the value of "InhabitedTime" increases. The way this feature works is by going through every chunk in every region file of a given world, and removing all chunks whose "InhabitedTime" value is set to "0". This means that any and all chunks whose "InhabitedTime" is "0" will get removed. It is important to keep in mind that if you used a creative tool/mod/program to modify chunks without ever entering them as an in-game player and making changes to them manually, or if the game fails to keep track of "InhabitedTime", there is a high chance those chunks will get removed anyways. Always back up your worlds before doing this, and immediately make sure no chunks you needed somehow got removed. 44 | - If there are any issues/bugs or if you do spot this mod's feature removing chunks it isn't suppoed to remove, please let me know so I can see if something can be done to resolve it. 45 | 46 | ## 47 |

48 | CurseForge 49 | Modrinth 50 |

51 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17, # Current Java LTS & minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-2022] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: Artifacts 39 | path: build/libs/ 40 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/.gitignore: -------------------------------------------------------------------------------- 1 | # -------------------- Eclipse IDE ------------------- 2 | .metadata 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .settings/ 11 | .loadpath 12 | .recommenders 13 | 14 | # External tool builders 15 | .externalToolBuilders/ 16 | 17 | # Locally stored "Eclipse launch configurations" 18 | *.launch 19 | 20 | # PyDev specific (Python IDE for Eclipse) 21 | *.pydevproject 22 | 23 | # CDT-specific (C/C++ Development Tooling) 24 | .cproject 25 | 26 | # CDT- autotools 27 | .autotools 28 | 29 | # Java annotation processor (APT) 30 | .factorypath 31 | 32 | # PDT-specific (PHP Development Tools) 33 | .buildpath 34 | 35 | # sbteclipse plugin 36 | .target 37 | 38 | # Tern plugin 39 | .tern-project 40 | 41 | # TeXlipse plugin 42 | .texlipse 43 | 44 | # STS (Spring Tool Suite) 45 | .springBeans 46 | 47 | # Code Recommenders 48 | .recommenders/ 49 | 50 | # Annotation Processing 51 | .apt_generated/ 52 | .apt_generated_test/ 53 | 54 | # Scala IDE specific (Scala & Java development for Eclipse) 55 | .cache-main 56 | .scala_dependencies 57 | .worksheet 58 | 59 | # Uncomment this line if you wish to ignore the project description file. 60 | # Typically, this file would be tracked if it contains build/dependency configurations: 61 | #.project 62 | 63 | # ----------------------- Java ----------------------- 64 | # Compiled class file 65 | *.class 66 | 67 | # Log file 68 | *.log 69 | 70 | # BlueJ files 71 | *.ctxt 72 | 73 | # Mobile Tools for Java (J2ME) 74 | .mtj.tmp/ 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.nar 80 | *.ear 81 | *.zip 82 | *.tar.gz 83 | *.rar 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | /.gradle/ 88 | /build/ 89 | 90 | # ----------------------- Gradle ----------------------- 91 | .gradle 92 | **/build/ 93 | !src/**/build/ 94 | 95 | # Ignore Gradle GUI config 96 | gradle-app.setting 97 | 98 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 99 | !gradle-wrapper.jar 100 | 101 | # Avoid ignore Gradle wrappper properties 102 | !gradle-wrapper.properties 103 | 104 | # Cache of project 105 | .gradletasknamecache 106 | 107 | # Eclipse Gradle plugin generated files 108 | # Eclipse Core 109 | .project 110 | # JDT-specific (Eclipse Java Development Tools) 111 | .classpath 112 | 113 | # ----------------------- Fabric ----------------------- 114 | run/ 115 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheCSDev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/build.gradle: -------------------------------------------------------------------------------- 1 | import com.google.gson.Gson 2 | import com.google.gson.reflect.TypeToken 3 | import java.lang.reflect.Type 4 | 5 | plugins 6 | { 7 | id 'fabric-loom' version '1.0-SNAPSHOT' 8 | id 'maven-publish' 9 | } 10 | 11 | sourceCompatibility = JavaVersion.VERSION_17 12 | targetCompatibility = JavaVersion.VERSION_17 13 | 14 | archivesBaseName = project.mod_id 15 | version = project.mod_version 16 | group = project.maven_group 17 | 18 | repositories 19 | { 20 | // Add repositories to retrieve artifacts from in here. 21 | // You should only use this when depending on other mods because 22 | // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. 23 | // See https://docs.gradle.org/current/userguide/declaring_repositories.html 24 | // for more information about repositories. 25 | maven { url "https://maven.shedaniel.me/" } 26 | maven { url "https://maven.terraformersmc.com/releases/" } 27 | } 28 | 29 | dependencies 30 | { 31 | // To change the versions see the gradle.properties file 32 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 33 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 34 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 35 | 36 | // Fabric API 37 | // modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 38 | // Don't forget to declare | "fabric":"*" | as a dependency in fabric.mod.json 39 | 40 | // Mod Menu 41 | modApi "com.terraformersmc:modmenu:${project.modmenu_version}" 42 | 43 | // Roughly Enough Items 44 | // modApi "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" 45 | 46 | // Uncomment the following line to enable the deprecated Fabric API modules. 47 | // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. 48 | // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" 49 | } 50 | 51 | processResources 52 | { 53 | // inputs.property "version", project.version 54 | filesMatching(["fabric.mod.json", "**/mods.toml"]) { expand project.properties } 55 | } 56 | 57 | //this task includes `MixinConfigs` metadata for the Forge platform 58 | //(it is important that this task runs AFTER the `processResources` task) 59 | task updateMixinConfigs 60 | { 61 | doLast 62 | { 63 | // 1. Read the `fabric.mod.json` file and parse the JSON. 64 | File jsonFile = file('src/main/resources/fabric.mod.json') 65 | String jsonString = jsonFile.text 66 | Gson gson = new Gson() 67 | Type type = new TypeToken>(){}.getType() 68 | Map jsonMap = gson.fromJson(jsonString, type) 69 | 70 | // Check if the `mixins` property exists 71 | if (!jsonMap.containsKey("mixins")) { return } 72 | 73 | // 2. Extract the `mixins` array and convert it to a string. 74 | List mixinList = (List) jsonMap.get("mixins") 75 | String mixinConfigs = String.join(",", mixinList) 76 | 77 | // 3. Add the resulting string to the `MixinConfigs` property in the `MANIFEST.MF` file. 78 | jar { manifest { attributes 'MixinConfigs': mixinConfigs } } 79 | } 80 | } 81 | updateMixinConfigs.mustRunAfter processResources //this task depends on that task being run first 82 | jar.dependsOn updateMixinConfigs //important to execute before the `jar` task 83 | 84 | tasks.withType(JavaCompile).configureEach 85 | { 86 | // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. 87 | it.options.release = 17 88 | } 89 | 90 | java 91 | { 92 | // Loom will automatically attach sourcesJar to a RemapSourcesJar 93 | // task and to the "build" task if it is present. 94 | // If you remove this line, sources will not be generated. 95 | withSourcesJar() 96 | 97 | // Generate Java docs. 98 | javadoc.options.addStringOption('Xdoclint:none', '-quiet') 99 | withJavadocJar() 100 | } 101 | 102 | jar 103 | { 104 | //exclude all .class files outside of the maven group 105 | def includeOnlyPackage = project.maven_group.replaceAll('\\.', '/') 106 | eachFile { fileCopyDetails -> 107 | if (fileCopyDetails.name.endsWith('.class') && !fileCopyDetails.relativePath.pathString.startsWith(includeOnlyPackage)) { 108 | fileCopyDetails.exclude() 109 | } 110 | } 111 | 112 | //handle the license file 113 | from("LICENSE") { rename { "${it}_${project.archivesBaseName}"} } 114 | } 115 | 116 | // configure the maven publication 117 | publishing 118 | { 119 | publications 120 | { 121 | mavenJava(MavenPublication) { from components.java } 122 | } 123 | 124 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 125 | repositories 126 | { 127 | // Add repositories to publish to here. 128 | // Notice: This block does NOT have the same function as the block in the top level. 129 | // The repositories here will be used for publishing your artifact, not for 130 | // retrieving dependencies. 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/develop 6 | minecraft_version=1.18.2 7 | yarn_mappings=1.18.2+build.4 8 | loader_version=0.14.21 9 | 10 | # Mod Properties 11 | # the maven group 12 | maven_group = io.github.thecsdev 13 | # the mod id as well as the archives base name 14 | mod_id = nounusedchunks 15 | 16 | mod_name = No Unused Chunks 17 | mod_description = Reduces world size by discarding unused chunks. 18 | mod_author = TheCSDev 19 | mod_version = 2.1+1.18.2 20 | 21 | mod_contact_homepage = https://github.com/TheCSDev 22 | mod_contact_sources = https://github.com/TheCSDev/mc-no-unused-chunks 23 | mod_contact_issues = https://github.com/TheCSDev/mc-no-unused-chunks/issues 24 | 25 | modmenu_link_curseforge = https://www.curseforge.com/projects/711539 26 | modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 27 | modmenu_link_kofi = https://ko-fi.com/TheCSDev 28 | modmenu_link_youtube = https://www.youtube.com/@TheCSDev 29 | 30 | mod_license = MIT 31 | mod_icon = assets/nounusedchunks/icon.png 32 | 33 | mod_entrypoint_client = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 34 | mod_entrypoint_server = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 35 | 36 | mod_depends_minecraft = 1.18.2 37 | mod_depends_java = >=17 38 | 39 | # Dependencies 40 | # If you choose to use any of the following mods as dependencies, 41 | # uncomment them in build.gradle, and don't forget to list them 42 | # as dependencies in fabric.mod.json 43 | fabric_version=0.76.0+1.18.2 44 | modmenu_version=3.2.5 45 | architectury_version=4.11.93 46 | rei_version=8.3.618 47 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.18.2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement 2 | { 3 | repositories 4 | { 5 | maven 6 | { 7 | name = 'Fabric' 8 | url = 'https://maven.fabricmc.net/' 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunks.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import net.minecraft.nbt.NbtCompound; 7 | import net.minecraft.nbt.NbtElement; 8 | 9 | public abstract class NoUnusedChunks extends Object 10 | { 11 | // ================================================== 12 | public static final Logger LOGGER = LoggerFactory.getLogger(getModID()); 13 | // -------------------------------------------------- 14 | static final String ModName = "No Unused Chunks"; 15 | static final String ModID = "nounusedchunks"; 16 | private static NoUnusedChunks Instance; 17 | // -------------------------------------------------- 18 | //protected final ModContainer modInfo; 19 | // ================================================== 20 | public NoUnusedChunks() 21 | { 22 | //validate instance first 23 | if(isModInitialized()) 24 | throw new IllegalStateException(getModID() + " has already been initialized."); 25 | else if(!isInstanceValid(this)) 26 | throw new UnsupportedOperationException("Invalid " + getModID() + " type: " + this.getClass().getName()); 27 | 28 | //assign instance 29 | Instance = this; 30 | //modInfo = FabricLoader.getInstance().getModContainer(getModID()).get(); 31 | 32 | //log stuff 33 | /*LOGGER.info("Initializing '" + getModName() + "' " + modInfo.getMetadata().getVersion() + 34 | " as '" + getClass().getSimpleName() + "'.");*/ 35 | LOGGER.info("Initializing '" + getModName() + "' as '" + getClass().getSimpleName() + "'."); 36 | 37 | //init stuff 38 | //TODO - Initialize common stuff here (client/dedicated-server/internal-server) 39 | } 40 | // ================================================== 41 | public static NoUnusedChunks getInstance() { return Instance; } 42 | //public ModContainer getModInfo() { return modInfo; } 43 | // -------------------------------------------------- 44 | public static String getModName() { return ModName; } 45 | public static String getModID() { return ModID; } 46 | // -------------------------------------------------- 47 | public static boolean isModInitialized() { return isInstanceValid(Instance); } 48 | private static boolean isInstanceValid(NoUnusedChunks instance) { return isServer(instance) || isClient(instance); } 49 | // -------------------------------------------------- 50 | public static boolean isServer() { return isServer(Instance); } 51 | public static boolean isClient() { return isClient(Instance); } 52 | 53 | private static boolean isServer(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; } 54 | private static boolean isClient(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; } 55 | // ================================================== 56 | /** 57 | * Returns true if a chunk is unused. 58 | *

59 | * Checks are done based off the Chunk's NBT data. 60 | * 61 | * @param chunkNbt The Chunk's {@link NbtCompound} data. 62 | */ 63 | public static boolean isChunkUnused(NbtCompound chunkNbt) 64 | { 65 | return chunkNbt.contains("InhabitedTime", NbtElement.LONG_TYPE) && 66 | chunkNbt.getLong("InhabitedTime") == 0; 67 | } 68 | // ================================================== 69 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | public final class NoUnusedChunksConfig 4 | { 5 | /** 6 | * Optimize world screen - Remove unused chunks.
7 | * Temporary variable with a temporary value. 8 | *

9 | * Indicates whether or not the user checked the "Remove uninhaited chunks" 10 | * checkbox in the "Optimize world" screen. 11 | */ 12 | public static boolean TEMP_OWS_RUC = false; 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksFabric.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import net.fabricmc.api.ClientModInitializer; 4 | import net.fabricmc.api.DedicatedServerModInitializer; 5 | 6 | /** 7 | * Fabric Mod Loader entry-points for this mod. 8 | */ 9 | public final class NoUnusedChunksFabric implements ClientModInitializer, DedicatedServerModInitializer 10 | { 11 | // ================================================== 12 | public @Override void onInitializeClient() { new io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient(); } 13 | public @Override void onInitializeServer() { new io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer(); } 14 | // ================================================== 15 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksForge.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; 4 | import io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; 5 | import net.minecraftforge.fml.common.Mod; 6 | import net.minecraftforge.fml.loading.FMLEnvironment; 7 | 8 | /** 9 | * Forge Mod Loader entry-points for this mod. 10 | */ 11 | @Mod(NoUnusedChunks.ModID) 12 | public final class NoUnusedChunksForge 13 | { 14 | // ================================================== 15 | public NoUnusedChunksForge() 16 | { 17 | //*literal black magic...* 18 | //(it's amazing this actually works) 19 | if(FMLEnvironment.dist.isClient()) 20 | new NoUnusedChunksClient(); 21 | else if(FMLEnvironment.dist.isDedicatedServer()) 22 | new NoUnusedChunksServer(); 23 | } 24 | // ================================================== 25 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/client/NoUnusedChunksClient.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksClient extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksClient() 9 | { 10 | //TODO - Initialize client-side-only stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/util/GuiUtils.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.util; 2 | 3 | import static net.minecraft.client.gui.DrawableHelper.drawTextWithShadow; 4 | import static net.minecraft.client.gui.DrawableHelper.fill; 5 | 6 | import java.awt.Color; 7 | import java.awt.Dimension; 8 | 9 | import net.minecraft.client.MinecraftClient; 10 | import net.minecraft.client.font.TextRenderer; 11 | import net.minecraft.client.util.math.MatrixStack; 12 | import net.minecraft.text.LiteralText; 13 | import net.minecraft.text.Text; 14 | 15 | public final class GuiUtils 16 | { 17 | // ================================================== 18 | private final static MinecraftClient MC; 19 | static { MC = MinecraftClient.getInstance(); } 20 | private GuiUtils() {} 21 | // ================================================== 22 | public static final int COLOR_BLACK = Color.black.getRGB(); 23 | public static final int COLOR_WHITE = Color.white.getRGB(); 24 | public static final int COLOR_TOOLTIP_OUTLINE = new Color(27,0,62).getRGB(); 25 | public static final int COLOR_TOOLTIP_BGROUND = new Color(15,0,15).getRGB(); 26 | // -------------------------------------------------- 27 | public static void drawTooltip(MatrixStack matrices, int mouseX, int mouseY, float delta, Text text) 28 | { 29 | TextRenderer tr = MC.textRenderer; 30 | 31 | //get text size so we can know how big the tooltip will be 32 | Dimension textSize = getTextSize(tr, text); 33 | textSize = new Dimension(textSize.width + 10, textSize.height + 10); 34 | 35 | //offset the X for the tooltip 36 | mouseX += 5; 37 | if(MC.currentScreen != null) 38 | { 39 | int aX = mouseX + textSize.width; 40 | if(aX > MC.currentScreen.width) 41 | mouseX -= (textSize.width + 5); 42 | } 43 | 44 | //fill in a tooltip square background 45 | fill(matrices, mouseX, mouseY, mouseX + textSize.width, mouseY + textSize.height, COLOR_TOOLTIP_OUTLINE); 46 | fill(matrices, mouseX + 2, mouseY + 2, mouseX + textSize.width - 2, mouseY + textSize.height - 2, COLOR_TOOLTIP_BGROUND); 47 | 48 | //draw text 49 | String textStr = text.getString(); 50 | String[] lines = textStr.split("(\\r?\\n)|(\\\\n)"); 51 | 52 | int lineY = 0; 53 | for (String line : lines) 54 | { 55 | drawTextWithShadow(matrices, tr, new LiteralText(line), mouseX + 5, mouseY + 5 + lineY, COLOR_WHITE); 56 | lineY += tr.getWrappedLinesHeight(line, textSize.width); 57 | } 58 | } 59 | // -------------------------------------------------- 60 | public static Dimension getTextSize(TextRenderer tr, Text text) 61 | { 62 | String textStr = text.getString(); 63 | String[] lines = textStr.split("(\\r?\\n)|(\\\\n)"); 64 | int maxWidth = 0; 65 | for (String line : lines) 66 | { 67 | int lineWidth = tr.getWidth(line); 68 | if(lineWidth > maxWidth) 69 | maxWidth = lineWidth; 70 | } 71 | return new Dimension(maxWidth, tr.getWrappedLinesHeight(textStr, maxWidth)); 72 | } 73 | // ================================================== 74 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/widgets/ActionCheckboxWidget.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.widgets; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import io.github.thecsdev.nounusedchunks.client.gui.util.GuiUtils; 6 | import net.minecraft.client.gui.widget.CheckboxWidget; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | import net.minecraft.text.Text; 9 | 10 | public class ActionCheckboxWidget extends CheckboxWidget 11 | { 12 | // -------------------------------------------------- 13 | public final Consumer callback; 14 | public Text tooltip; 15 | // -------------------------------------------------- 16 | public ActionCheckboxWidget( 17 | int x, int y, int width, int height, 18 | Text message, boolean checked, boolean showMessage, 19 | Consumer callback) 20 | { 21 | super(x, y, width, height, message, checked, showMessage); 22 | this.callback = callback; 23 | } 24 | public void setTooltip(Text text) { this.tooltip = text; } 25 | // -------------------------------------------------- 26 | public @Override void onPress() 27 | { 28 | super.onPress(); 29 | if(this.callback != null) 30 | this.callback.accept(this); 31 | } 32 | 33 | public @Override void render(MatrixStack matrices, int mouseX, int mouseY, float delta) 34 | { 35 | super.render(matrices, mouseX, mouseY, delta); 36 | if(isHovered()) 37 | GuiUtils.drawTooltip(matrices, mouseX, mouseY, delta, tooltip); 38 | } 39 | // -------------------------------------------------- 40 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/addons/AddonBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.addons; 2 | 3 | public interface AddonBackupPromptScreen 4 | { 5 | public boolean nounusedchunks_getRemoveUnusedChunks(); 6 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/events/MixinBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.events; 2 | 3 | import static io.github.thecsdev.nounusedchunks.NoUnusedChunksConfig.TEMP_OWS_RUC; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import io.github.thecsdev.nounusedchunks.client.gui.widgets.ActionCheckboxWidget; 13 | import io.github.thecsdev.nounusedchunks.client.mixin.addons.AddonBackupPromptScreen; 14 | import io.github.thecsdev.nounusedchunks.client.mixin.hooks.AccessorScreen; 15 | import net.minecraft.client.gui.screen.BackupPromptScreen; 16 | import net.minecraft.client.gui.screen.Screen; 17 | import net.minecraft.client.gui.widget.CheckboxWidget; 18 | import net.minecraft.client.gui.widget.ClickableWidget; 19 | import net.minecraft.text.Text; 20 | import net.minecraft.text.TranslatableText; 21 | 22 | @Mixin(BackupPromptScreen.class) 23 | public abstract class MixinBackupPromptScreen extends Screen implements AddonBackupPromptScreen 24 | { 25 | // ================================================== 26 | protected MixinBackupPromptScreen(Text title) { super(title); } 27 | // ================================================== 28 | private @Unique ActionCheckboxWidget nounusedchunks_removeUnusedChunksCheckbox; 29 | // -------------------------------------------------- 30 | @Accessor("showEraseCacheCheckbox") 31 | public abstract boolean getShowEraseCacheCheckbox(); 32 | 33 | @Accessor("eraseCacheCheckbox") 34 | public abstract CheckboxWidget getEraseCacheCheckbox(); 35 | // ================================================== 36 | @Inject(method = "init", at = @At("TAIL")) 37 | public void init(CallbackInfo callback) 38 | { 39 | //define fields 40 | TEMP_OWS_RUC = false; //HIGHLY IMPORTANT TO RESET THE FLAG - PREVENTS POTENTIAL CORRUPTIONS AND ERRORS 41 | final int i = getEraseCacheCheckbox().y, j = getEraseCacheCheckbox().getHeight() + 5; 42 | 43 | //define the check-box 44 | nounusedchunks_removeUnusedChunksCheckbox = new ActionCheckboxWidget( 45 | this.width / 2 - 155 + 80, i + j, //x and y 46 | 250, 20, //width and height 47 | new TranslatableText("nounusedchunks.backupprompt.removeuninhabitedchunks"), //text 48 | TEMP_OWS_RUC, //current value 49 | true, //show message 50 | checkbox -> TEMP_OWS_RUC = checkbox.isChecked()); //on-click 51 | 52 | nounusedchunks_removeUnusedChunksCheckbox.setTooltip( 53 | new TranslatableText("nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip")); 54 | 55 | //if showing the check-boxes, add the check-box below the 56 | //vanilla one, and move the buttons down 57 | if(getShowEraseCacheCheckbox()) 58 | { 59 | //add the check-box 60 | addDrawableChild(nounusedchunks_removeUnusedChunksCheckbox); 61 | 62 | //move the stuff below it a bit down 63 | ((AccessorScreen)(Object)this).getDrawables().forEach(drawable -> 64 | { 65 | //ignore non-clickables 66 | //ignore the removeUnusedChunks checkbox 67 | if(!(drawable instanceof ClickableWidget) || drawable == nounusedchunks_removeUnusedChunksCheckbox) 68 | return; 69 | ClickableWidget cw = (ClickableWidget)drawable; 70 | 71 | //ignore above ones 72 | if(cw.y < nounusedchunks_removeUnusedChunksCheckbox.y - 5) 73 | return; 74 | 75 | //move a bit down 76 | cw.y = cw.y + j + 10; 77 | }); 78 | } 79 | } 80 | // ================================================== 81 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/hooks/AccessorScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.hooks; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import net.minecraft.client.gui.Drawable; 9 | import net.minecraft.client.gui.screen.Screen; 10 | 11 | @Mixin(Screen.class) 12 | public interface AccessorScreen 13 | { 14 | @Accessor("drawables") 15 | public abstract List getDrawables(); 16 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/io/github/thecsdev/nounusedchunks/server/NoUnusedChunksServer.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.server; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksServer extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksServer() 9 | { 10 | //TODO - Initialize dedicated-server-side stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/net/minecraftforge/api/distmarker/Dist.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.api.distmarker; 2 | 3 | public class Dist 4 | { 5 | public boolean isClient() { return isDedicatedServer(); } 6 | public boolean isDedicatedServer() { throw new AssertionError("Nope."); } 7 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/net/minecraftforge/fml/common/Mod.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.common; 2 | 3 | import static java.lang.annotation.ElementType.TYPE; 4 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.Target; 8 | 9 | @Retention(RUNTIME) 10 | @Target(TYPE) 11 | public @interface Mod 12 | { 13 | String value(); 14 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.loading; 2 | 3 | import net.minecraftforge.api.distmarker.Dist; 4 | 5 | public class FMLEnvironment 6 | { 7 | public static final Dist dist = new Dist(); 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/java/readme.txt: -------------------------------------------------------------------------------- 1 | In `gradle.properties`, there's a property that looks like this: 2 | maven_group = io.github.thecsdev 3 | 4 | In `build.gradle`, the project has been configured to discard all `.class` 5 | files outside of the `maven_group`. This means that packages such as 6 | `net.minecraftforge` are only there during "compile-time", and not "run-time". 7 | This allows the mod to be written in a way that allows it to interact with 8 | Minecraft Forge, without Forge actually being present. 9 | 10 | # Important node: 11 | Because of this, all `.class` files created outside of the `maven_group` will 12 | be discarded once the jar file is compiled aka built! -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | # This is an example mods.toml file. It contains the data relating to the loading mods. 2 | # There are several mandatory fields (#mandatory), and many more that are optional (#optional). 3 | # The overall format is standard TOML format, v0.5.0. 4 | # Note that there are a couple of TOML lists in this file. 5 | # Find more information on toml format here: https://github.com/toml-lang/toml 6 | 7 | modLoader="javafml" #mandatory 8 | loaderVersion="[40,)" #mandatory 9 | license="${project.mod_license}" #mandatory 10 | issueTrackerURL="${project.mod_contact_issues}" #optional 11 | 12 | # A list of mods - how many allowed here is determined by the individual mod loader 13 | [[mods]] #mandatory 14 | displayName="${project.mod_name}" #mandatory 15 | modId="${project.mod_id}" #mandatory 16 | version="${project.mod_version}" #mandatory 17 | description='''${project.mod_description}''' 18 | displayURL="${project.mod_contact_sources}" #optional 19 | authors="${project.mod_author}" #optional 20 | # logoFile="${project.mod_icon}" #optional - removed - syntax not allowed 21 | 22 | [[dependencies.nounusedchunks]] 23 | modId="forge" 24 | mandatory=true 25 | versionRange="[40,)" 26 | ordering="NONE" 27 | side="BOTH" 28 | 29 | [[dependencies.nounusedchunks]] 30 | modId="minecraft" 31 | mandatory=true 32 | versionRange="[1.18.2,1.19)" 33 | ordering="NONE" 34 | side="BOTH" 35 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/assets/nounusedchunks/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.18.2/src/main/resources/assets/nounusedchunks/icon.png -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/assets/nounusedchunks/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "nounusedchunks.backupprompt.removeuninhabitedchunks": "Remove uninhabited chunks", 3 | "nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip": "Removes all chunks that were never inhabited by a player.\nWhile this may reduce the world size by a lot, keep in\nmind that this may also remove chunks you might need,\nwithout actually having visited them. For example, this\nmay end up removing chunks modified by another mod or a\ntool or a program. Please back up your world before\ndoing this, and make sure the chunks got removed properly." 4 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${project.mod_id}", 4 | "version": "${project.mod_version}", 5 | 6 | "name": "${project.mod_name}", 7 | "description": "${project.mod_description}", 8 | "authors": ["${project.mod_author}"], 9 | "contact": 10 | { 11 | "homepage": "${project.mod_contact_homepage}", 12 | "sources": "${project.mod_contact_sources}", 13 | "issues": "${project.mod_contact_issues}" 14 | }, 15 | 16 | "license": "${project.mod_license}", 17 | "icon": "${mod_icon}", 18 | 19 | "environment": "client", 20 | "entrypoints": 21 | { 22 | "client": ["${project.mod_entrypoint_client}"], 23 | "server": ["${project.mod_entrypoint_server}"] 24 | }, 25 | "mixins": 26 | [ 27 | "nounusedchunks.client.mixin.events.json", 28 | "nounusedchunks.client.mixin.hooks.json", 29 | "nounusedchunks.mixin.events.json" 30 | ], 31 | 32 | "depends": 33 | { 34 | "fabricloader": ">=${project.loader_version}", 35 | "minecraft": "${project.mod_depends_minecraft}", 36 | "java": "${project.mod_depends_java}" 37 | }, 38 | 39 | "custom": 40 | { 41 | "modmenu": 42 | { 43 | "links": 44 | { 45 | "modmenu.curseforge": "${project.modmenu_link_curseforge}", 46 | "modmenu.modrinth": "${project.modmenu_link_modrinth}", 47 | "modmenu.kofi": "${project.modmenu_link_kofi}", 48 | "modmenu.youtube": "${project.modmenu_link_youtube}" 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/nounusedchunks.client.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinBackupPromptScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/nounusedchunks.client.mixin.hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.hooks", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["AccessorScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/nounusedchunks.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinWorldUpdater"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.18.2/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": 3 | { 4 | "description": "nounusedchunks resources", 5 | "pack_format": 8 6 | } 7 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17, # Current Java LTS & minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-2022] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: Artifacts 39 | path: build/libs/ 40 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/.gitignore: -------------------------------------------------------------------------------- 1 | # -------------------- Eclipse IDE ------------------- 2 | .metadata 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .settings/ 11 | .loadpath 12 | .recommenders 13 | 14 | # External tool builders 15 | .externalToolBuilders/ 16 | 17 | # Locally stored "Eclipse launch configurations" 18 | *.launch 19 | 20 | # PyDev specific (Python IDE for Eclipse) 21 | *.pydevproject 22 | 23 | # CDT-specific (C/C++ Development Tooling) 24 | .cproject 25 | 26 | # CDT- autotools 27 | .autotools 28 | 29 | # Java annotation processor (APT) 30 | .factorypath 31 | 32 | # PDT-specific (PHP Development Tools) 33 | .buildpath 34 | 35 | # sbteclipse plugin 36 | .target 37 | 38 | # Tern plugin 39 | .tern-project 40 | 41 | # TeXlipse plugin 42 | .texlipse 43 | 44 | # STS (Spring Tool Suite) 45 | .springBeans 46 | 47 | # Code Recommenders 48 | .recommenders/ 49 | 50 | # Annotation Processing 51 | .apt_generated/ 52 | .apt_generated_test/ 53 | 54 | # Scala IDE specific (Scala & Java development for Eclipse) 55 | .cache-main 56 | .scala_dependencies 57 | .worksheet 58 | 59 | # Uncomment this line if you wish to ignore the project description file. 60 | # Typically, this file would be tracked if it contains build/dependency configurations: 61 | #.project 62 | 63 | # ----------------------- Java ----------------------- 64 | # Compiled class file 65 | *.class 66 | 67 | # Log file 68 | *.log 69 | 70 | # BlueJ files 71 | *.ctxt 72 | 73 | # Mobile Tools for Java (J2ME) 74 | .mtj.tmp/ 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.nar 80 | *.ear 81 | *.zip 82 | *.tar.gz 83 | *.rar 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | /.gradle/ 88 | /build/ 89 | 90 | # ----------------------- Gradle ----------------------- 91 | .gradle 92 | **/build/ 93 | !src/**/build/ 94 | 95 | # Ignore Gradle GUI config 96 | gradle-app.setting 97 | 98 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 99 | !gradle-wrapper.jar 100 | 101 | # Avoid ignore Gradle wrappper properties 102 | !gradle-wrapper.properties 103 | 104 | # Cache of project 105 | .gradletasknamecache 106 | 107 | # Eclipse Gradle plugin generated files 108 | # Eclipse Core 109 | .project 110 | # JDT-specific (Eclipse Java Development Tools) 111 | .classpath 112 | 113 | # ----------------------- Fabric ----------------------- 114 | run/ 115 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheCSDev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/build.gradle: -------------------------------------------------------------------------------- 1 | import com.google.gson.Gson 2 | import com.google.gson.reflect.TypeToken 3 | import java.lang.reflect.Type 4 | 5 | plugins 6 | { 7 | id 'fabric-loom' version '1.0-SNAPSHOT' 8 | id 'maven-publish' 9 | } 10 | 11 | sourceCompatibility = JavaVersion.VERSION_17 12 | targetCompatibility = JavaVersion.VERSION_17 13 | 14 | archivesBaseName = project.mod_id 15 | version = project.mod_version 16 | group = project.maven_group 17 | 18 | repositories 19 | { 20 | // Add repositories to retrieve artifacts from in here. 21 | // You should only use this when depending on other mods because 22 | // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. 23 | // See https://docs.gradle.org/current/userguide/declaring_repositories.html 24 | // for more information about repositories. 25 | maven { url "https://maven.shedaniel.me/" } 26 | maven { url "https://maven.terraformersmc.com/releases/" } 27 | } 28 | 29 | dependencies 30 | { 31 | // To change the versions see the gradle.properties file 32 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 33 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 34 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 35 | 36 | // Fabric API 37 | // modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 38 | // Don't forget to declare | "fabric":"*" | as a dependency in fabric.mod.json 39 | 40 | // Mod Menu 41 | modApi "com.terraformersmc:modmenu:${project.modmenu_version}" 42 | 43 | // Roughly Enough Items 44 | // modApi "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" 45 | 46 | // Uncomment the following line to enable the deprecated Fabric API modules. 47 | // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. 48 | // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" 49 | } 50 | 51 | processResources 52 | { 53 | // inputs.property "version", project.version 54 | filesMatching(["fabric.mod.json", "**/mods.toml"]) { expand project.properties } 55 | } 56 | 57 | //this task includes `MixinConfigs` metadata for the Forge platform 58 | //(it is important that this task runs AFTER the `processResources` task) 59 | task updateMixinConfigs 60 | { 61 | doLast 62 | { 63 | // 1. Read the `fabric.mod.json` file and parse the JSON. 64 | File jsonFile = file('src/main/resources/fabric.mod.json') 65 | String jsonString = jsonFile.text 66 | Gson gson = new Gson() 67 | Type type = new TypeToken>(){}.getType() 68 | Map jsonMap = gson.fromJson(jsonString, type) 69 | 70 | // Check if the `mixins` property exists 71 | if (!jsonMap.containsKey("mixins")) { return } 72 | 73 | // 2. Extract the `mixins` array and convert it to a string. 74 | List mixinList = (List) jsonMap.get("mixins") 75 | String mixinConfigs = String.join(",", mixinList) 76 | 77 | // 3. Add the resulting string to the `MixinConfigs` property in the `MANIFEST.MF` file. 78 | jar { manifest { attributes 'MixinConfigs': mixinConfigs } } 79 | } 80 | } 81 | updateMixinConfigs.mustRunAfter processResources //this task depends on that task being run first 82 | jar.dependsOn updateMixinConfigs //important to execute before the `jar` task 83 | 84 | tasks.withType(JavaCompile).configureEach 85 | { 86 | // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. 87 | it.options.release = 17 88 | } 89 | 90 | java 91 | { 92 | // Loom will automatically attach sourcesJar to a RemapSourcesJar 93 | // task and to the "build" task if it is present. 94 | // If you remove this line, sources will not be generated. 95 | withSourcesJar() 96 | 97 | // Generate Java docs. 98 | javadoc.options.addStringOption('Xdoclint:none', '-quiet') 99 | withJavadocJar() 100 | } 101 | 102 | jar 103 | { 104 | //exclude all .class files outside of the maven group 105 | def includeOnlyPackage = project.maven_group.replaceAll('\\.', '/') 106 | eachFile { fileCopyDetails -> 107 | if (fileCopyDetails.name.endsWith('.class') && !fileCopyDetails.relativePath.pathString.startsWith(includeOnlyPackage)) { 108 | fileCopyDetails.exclude() 109 | } 110 | } 111 | 112 | //handle the license file 113 | from("LICENSE") { rename { "${it}_${project.archivesBaseName}"} } 114 | } 115 | 116 | // configure the maven publication 117 | publishing 118 | { 119 | publications 120 | { 121 | mavenJava(MavenPublication) { from components.java } 122 | } 123 | 124 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 125 | repositories 126 | { 127 | // Add repositories to publish to here. 128 | // Notice: This block does NOT have the same function as the block in the top level. 129 | // The repositories here will be used for publishing your artifact, not for 130 | // retrieving dependencies. 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/develop 6 | minecraft_version=1.19.2 7 | yarn_mappings=1.19.2+build.28 8 | loader_version=0.14.21 9 | 10 | # Mod Properties 11 | # the maven group 12 | maven_group = io.github.thecsdev 13 | # the mod id as well as the archives base name 14 | mod_id = nounusedchunks 15 | 16 | mod_name = No Unused Chunks 17 | mod_description = Reduces world size by discarding unused chunks. 18 | mod_author = TheCSDev 19 | mod_version = 2.1+1.19.2 20 | 21 | mod_contact_homepage = https://github.com/TheCSDev 22 | mod_contact_sources = https://github.com/TheCSDev/mc-no-unused-chunks 23 | mod_contact_issues = https://github.com/TheCSDev/mc-no-unused-chunks/issues 24 | 25 | modmenu_link_curseforge = https://www.curseforge.com/projects/711539 26 | modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 27 | modmenu_link_kofi = https://ko-fi.com/TheCSDev 28 | modmenu_link_youtube = https://www.youtube.com/@TheCSDev 29 | 30 | mod_license = MIT 31 | mod_icon = assets/nounusedchunks/icon.png 32 | 33 | mod_entrypoint_client = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 34 | mod_entrypoint_server = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 35 | 36 | mod_depends_minecraft = 1.19.x 37 | mod_depends_java = >=17 38 | 39 | # Dependencies 40 | # If you choose to use any of the following mods as dependencies, 41 | # uncomment them in build.gradle, and don't forget to list them 42 | # as dependencies in fabric.mod.json 43 | fabric_version=0.76.0+1.19.2 44 | modmenu_version=4.2.0-beta.2 45 | architectury_version=6.5.85 46 | rei_version=9.1.619 47 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.19.2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement 2 | { 3 | repositories 4 | { 5 | maven 6 | { 7 | name = 'Fabric' 8 | url = 'https://maven.fabricmc.net/' 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunks.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import net.minecraft.nbt.NbtCompound; 7 | import net.minecraft.nbt.NbtElement; 8 | 9 | public abstract class NoUnusedChunks extends Object 10 | { 11 | // ================================================== 12 | public static final Logger LOGGER = LoggerFactory.getLogger(getModID()); 13 | // -------------------------------------------------- 14 | static final String ModName = "No Unused Chunks"; 15 | static final String ModID = "nounusedchunks"; 16 | private static NoUnusedChunks Instance; 17 | // -------------------------------------------------- 18 | //protected final ModContainer modInfo; 19 | // ================================================== 20 | public NoUnusedChunks() 21 | { 22 | //validate instance first 23 | if(isModInitialized()) 24 | throw new IllegalStateException(getModID() + " has already been initialized."); 25 | else if(!isInstanceValid(this)) 26 | throw new UnsupportedOperationException("Invalid " + getModID() + " type: " + this.getClass().getName()); 27 | 28 | //assign instance 29 | Instance = this; 30 | //modInfo = FabricLoader.getInstance().getModContainer(getModID()).get(); 31 | 32 | //log stuff 33 | /*LOGGER.info("Initializing '" + getModName() + "' " + modInfo.getMetadata().getVersion() + 34 | " as '" + getClass().getSimpleName() + "'.");*/ 35 | LOGGER.info("Initializing '" + getModName() + "' as '" + getClass().getSimpleName() + "'."); 36 | 37 | //init stuff 38 | //TODO - Initialize common stuff here (client/dedicated-server/internal-server) 39 | } 40 | // ================================================== 41 | public static NoUnusedChunks getInstance() { return Instance; } 42 | //public ModContainer getModInfo() { return modInfo; } 43 | // -------------------------------------------------- 44 | public static String getModName() { return ModName; } 45 | public static String getModID() { return ModID; } 46 | // -------------------------------------------------- 47 | public static boolean isModInitialized() { return isInstanceValid(Instance); } 48 | private static boolean isInstanceValid(NoUnusedChunks instance) { return isServer(instance) || isClient(instance); } 49 | // -------------------------------------------------- 50 | public static boolean isServer() { return isServer(Instance); } 51 | public static boolean isClient() { return isClient(Instance); } 52 | 53 | private static boolean isServer(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; } 54 | private static boolean isClient(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; } 55 | // ================================================== 56 | /** 57 | * Returns true if a chunk is unused. 58 | *

59 | * Checks are done based off the Chunk's NBT data. 60 | * 61 | * @param chunkNbt The Chunk's {@link NbtCompound} data. 62 | */ 63 | public static boolean isChunkUnused(NbtCompound chunkNbt) 64 | { 65 | return chunkNbt.contains("InhabitedTime", NbtElement.LONG_TYPE) && 66 | chunkNbt.getLong("InhabitedTime") == 0; 67 | } 68 | // ================================================== 69 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | public final class NoUnusedChunksConfig 4 | { 5 | /** 6 | * Optimize world screen - Remove unused chunks.
7 | * Temporary variable with a temporary value. 8 | *

9 | * Indicates whether or not the user checked the "Remove uninhaited chunks" 10 | * checkbox in the "Optimize world" screen. 11 | */ 12 | public static boolean TEMP_OWS_RUC = false; 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksFabric.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import net.fabricmc.api.ClientModInitializer; 4 | import net.fabricmc.api.DedicatedServerModInitializer; 5 | 6 | /** 7 | * Fabric Mod Loader entry-points for this mod. 8 | */ 9 | public final class NoUnusedChunksFabric implements ClientModInitializer, DedicatedServerModInitializer 10 | { 11 | // ================================================== 12 | public @Override void onInitializeClient() { new io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient(); } 13 | public @Override void onInitializeServer() { new io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer(); } 14 | // ================================================== 15 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksForge.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; 4 | import io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; 5 | import net.minecraftforge.fml.common.Mod; 6 | import net.minecraftforge.fml.loading.FMLEnvironment; 7 | 8 | /** 9 | * Forge Mod Loader entry-points for this mod. 10 | */ 11 | @Mod(NoUnusedChunks.ModID) 12 | public final class NoUnusedChunksForge 13 | { 14 | // ================================================== 15 | public NoUnusedChunksForge() 16 | { 17 | //*literal black magic...* 18 | //(it's amazing this actually works) 19 | if(FMLEnvironment.dist.isClient()) 20 | new NoUnusedChunksClient(); 21 | else if(FMLEnvironment.dist.isDedicatedServer()) 22 | new NoUnusedChunksServer(); 23 | } 24 | // ================================================== 25 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/client/NoUnusedChunksClient.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksClient extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksClient() 9 | { 10 | //TODO - Initialize client-side-only stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/util/GuiUtils.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.util; 2 | 3 | import static net.minecraft.client.gui.DrawableHelper.drawTextWithShadow; 4 | import static net.minecraft.client.gui.DrawableHelper.fill; 5 | 6 | import java.awt.Color; 7 | import java.awt.Dimension; 8 | 9 | import net.minecraft.client.MinecraftClient; 10 | import net.minecraft.client.font.TextRenderer; 11 | import net.minecraft.client.util.math.MatrixStack; 12 | import net.minecraft.text.Text; 13 | 14 | public final class GuiUtils 15 | { 16 | // ================================================== 17 | private final static MinecraftClient MC; 18 | static { MC = MinecraftClient.getInstance(); } 19 | private GuiUtils() {} 20 | // ================================================== 21 | public static final int COLOR_BLACK = Color.black.getRGB(); 22 | public static final int COLOR_WHITE = Color.white.getRGB(); 23 | public static final int COLOR_TOOLTIP_OUTLINE = new Color(27,0,62).getRGB(); 24 | public static final int COLOR_TOOLTIP_BGROUND = new Color(15,0,15).getRGB(); 25 | // -------------------------------------------------- 26 | public static void drawTooltip(MatrixStack matrices, int mouseX, int mouseY, float delta, Text text) 27 | { 28 | TextRenderer tr = MC.textRenderer; 29 | 30 | //get text size so we can know how big the tooltip will be 31 | Dimension textSize = getTextSize(tr, text); 32 | textSize = new Dimension(textSize.width + 10, textSize.height + 10); 33 | 34 | //offset the X for the tooltip 35 | mouseX += 5; 36 | if(MC.currentScreen != null) 37 | { 38 | int aX = mouseX + textSize.width; 39 | if(aX > MC.currentScreen.width) 40 | mouseX -= (textSize.width + 5); 41 | } 42 | 43 | //fill in a tooltip square background 44 | fill(matrices, mouseX, mouseY, mouseX + textSize.width, mouseY + textSize.height, COLOR_TOOLTIP_OUTLINE); 45 | fill(matrices, mouseX + 2, mouseY + 2, mouseX + textSize.width - 2, mouseY + textSize.height - 2, COLOR_TOOLTIP_BGROUND); 46 | 47 | //draw text 48 | String textStr = text.getString(); 49 | String[] lines = textStr.split("(\\r?\\n)|(\\\\n)"); 50 | 51 | int lineY = 0; 52 | for (String line : lines) 53 | { 54 | drawTextWithShadow(matrices, tr, Text.literal(line), mouseX + 5, mouseY + 5 + lineY, COLOR_WHITE); 55 | lineY += tr.getWrappedLinesHeight(line, textSize.width); 56 | } 57 | } 58 | // -------------------------------------------------- 59 | public static Dimension getTextSize(TextRenderer tr, Text text) 60 | { 61 | String textStr = text.getString(); 62 | String[] lines = textStr.split("(\\r?\\n)|(\\\\n)"); 63 | int maxWidth = 0; 64 | for (String line : lines) 65 | { 66 | int lineWidth = tr.getWidth(line); 67 | if(lineWidth > maxWidth) 68 | maxWidth = lineWidth; 69 | } 70 | return new Dimension(maxWidth, tr.getWrappedLinesHeight(textStr, maxWidth)); 71 | } 72 | // ================================================== 73 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/widgets/ActionCheckboxWidget.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.widgets; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import io.github.thecsdev.nounusedchunks.client.gui.util.GuiUtils; 6 | import net.minecraft.client.gui.widget.CheckboxWidget; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | import net.minecraft.text.Text; 9 | 10 | public class ActionCheckboxWidget extends CheckboxWidget 11 | { 12 | // -------------------------------------------------- 13 | public final Consumer callback; 14 | public Text tooltip; 15 | // -------------------------------------------------- 16 | public ActionCheckboxWidget( 17 | int x, int y, int width, int height, 18 | Text message, boolean checked, boolean showMessage, 19 | Consumer callback) 20 | { 21 | super(x, y, width, height, message, checked, showMessage); 22 | this.callback = callback; 23 | } 24 | public void setTooltip(Text text) { this.tooltip = text; } 25 | // -------------------------------------------------- 26 | public @Override void onPress() 27 | { 28 | super.onPress(); 29 | if(this.callback != null) 30 | this.callback.accept(this); 31 | } 32 | 33 | public @Override void render(MatrixStack matrices, int mouseX, int mouseY, float delta) 34 | { 35 | super.render(matrices, mouseX, mouseY, delta); 36 | if(isHovered()) 37 | GuiUtils.drawTooltip(matrices, mouseX, mouseY, delta, tooltip); 38 | } 39 | // -------------------------------------------------- 40 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/addons/AddonBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.addons; 2 | 3 | public interface AddonBackupPromptScreen 4 | { 5 | public boolean nounusedchunks_getRemoveUnusedChunks(); 6 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/events/MixinBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.events; 2 | 3 | import static io.github.thecsdev.nounusedchunks.NoUnusedChunksConfig.TEMP_OWS_RUC; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import io.github.thecsdev.nounusedchunks.client.gui.widgets.ActionCheckboxWidget; 13 | import io.github.thecsdev.nounusedchunks.client.mixin.addons.AddonBackupPromptScreen; 14 | import io.github.thecsdev.nounusedchunks.client.mixin.hooks.AccessorScreen; 15 | import net.minecraft.client.gui.screen.BackupPromptScreen; 16 | import net.minecraft.client.gui.screen.Screen; 17 | import net.minecraft.client.gui.widget.CheckboxWidget; 18 | import net.minecraft.client.gui.widget.ClickableWidget; 19 | import net.minecraft.text.Text; 20 | 21 | @Mixin(BackupPromptScreen.class) 22 | public abstract class MixinBackupPromptScreen extends Screen implements AddonBackupPromptScreen 23 | { 24 | // ================================================== 25 | protected MixinBackupPromptScreen(Text title) { super(title); } 26 | // ================================================== 27 | private @Unique ActionCheckboxWidget nounusedchunks_removeUnusedChunksCheckbox; 28 | // -------------------------------------------------- 29 | @Accessor("showEraseCacheCheckbox") 30 | public abstract boolean getShowEraseCacheCheckbox(); 31 | 32 | @Accessor("eraseCacheCheckbox") 33 | public abstract CheckboxWidget getEraseCacheCheckbox(); 34 | // ================================================== 35 | @Inject(method = "init", at = @At("TAIL")) 36 | public void init(CallbackInfo callback) 37 | { 38 | //define fields 39 | TEMP_OWS_RUC = false; //HIGHLY IMPORTANT TO RESET THE FLAG - PREVENTS POTENTIAL CORRUPTIONS AND ERRORS 40 | final int i = getEraseCacheCheckbox().y, j = getEraseCacheCheckbox().getHeight() + 5; 41 | 42 | //define the check-box 43 | nounusedchunks_removeUnusedChunksCheckbox = new ActionCheckboxWidget( 44 | this.width / 2 - 155 + 80, i + j, //x and y 45 | 250, 20, //width and height 46 | Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks"), //text 47 | TEMP_OWS_RUC, //current value 48 | true, //show message 49 | checkbox -> TEMP_OWS_RUC = checkbox.isChecked()); //on-click 50 | 51 | nounusedchunks_removeUnusedChunksCheckbox.setTooltip( 52 | Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip")); 53 | 54 | //if showing the check-boxes, add the check-box below the 55 | //vanilla one, and move the buttons down 56 | if(getShowEraseCacheCheckbox()) 57 | { 58 | //add the check-box 59 | addDrawableChild(nounusedchunks_removeUnusedChunksCheckbox); 60 | 61 | //move the stuff below it a bit down 62 | ((AccessorScreen)(Object)this).getDrawables().forEach(drawable -> 63 | { 64 | //ignore non-clickables 65 | //ignore the removeUnusedChunks checkbox 66 | if(!(drawable instanceof ClickableWidget) || drawable == nounusedchunks_removeUnusedChunksCheckbox) 67 | return; 68 | ClickableWidget cw = (ClickableWidget)drawable; 69 | 70 | //ignore above ones 71 | if(cw.y < nounusedchunks_removeUnusedChunksCheckbox.y - 5) 72 | return; 73 | 74 | //move a bit down 75 | cw.y = cw.y + j + 10; 76 | }); 77 | } 78 | } 79 | // ================================================== 80 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/hooks/AccessorScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.hooks; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import net.minecraft.client.gui.Drawable; 9 | import net.minecraft.client.gui.screen.Screen; 10 | 11 | @Mixin(Screen.class) 12 | public interface AccessorScreen 13 | { 14 | @Accessor("drawables") 15 | public abstract List getDrawables(); 16 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/io/github/thecsdev/nounusedchunks/server/NoUnusedChunksServer.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.server; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksServer extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksServer() 9 | { 10 | //TODO - Initialize dedicated-server-side stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/net/minecraftforge/api/distmarker/Dist.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.api.distmarker; 2 | 3 | public class Dist 4 | { 5 | public boolean isClient() { return isDedicatedServer(); } 6 | public boolean isDedicatedServer() { throw new AssertionError("Nope."); } 7 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/net/minecraftforge/fml/common/Mod.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.common; 2 | 3 | import static java.lang.annotation.ElementType.TYPE; 4 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.Target; 8 | 9 | @Retention(RUNTIME) 10 | @Target(TYPE) 11 | public @interface Mod 12 | { 13 | String value(); 14 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.loading; 2 | 3 | import net.minecraftforge.api.distmarker.Dist; 4 | 5 | public class FMLEnvironment 6 | { 7 | public static final Dist dist = new Dist(); 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/java/readme.txt: -------------------------------------------------------------------------------- 1 | In `gradle.properties`, there's a property that looks like this: 2 | maven_group = io.github.thecsdev 3 | 4 | In `build.gradle`, the project has been configured to discard all `.class` 5 | files outside of the `maven_group`. This means that packages such as 6 | `net.minecraftforge` are only there during "compile-time", and not "run-time". 7 | This allows the mod to be written in a way that allows it to interact with 8 | Minecraft Forge, without Forge actually being present. 9 | 10 | # Important node: 11 | Because of this, all `.class` files created outside of the `maven_group` will 12 | be discarded once the jar file is compiled aka built! -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | # This is an example mods.toml file. It contains the data relating to the loading mods. 2 | # There are several mandatory fields (#mandatory), and many more that are optional (#optional). 3 | # The overall format is standard TOML format, v0.5.0. 4 | # Note that there are a couple of TOML lists in this file. 5 | # Find more information on toml format here: https://github.com/toml-lang/toml 6 | 7 | modLoader="javafml" #mandatory 8 | loaderVersion="[41,)" #mandatory 9 | license="${project.mod_license}" #mandatory 10 | issueTrackerURL="${project.mod_contact_issues}" #optional 11 | 12 | # A list of mods - how many allowed here is determined by the individual mod loader 13 | [[mods]] #mandatory 14 | displayName="${project.mod_name}" #mandatory 15 | modId="${project.mod_id}" #mandatory 16 | version="${project.mod_version}" #mandatory 17 | description='''${project.mod_description}''' 18 | displayURL="${project.mod_contact_sources}" #optional 19 | authors="${project.mod_author}" #optional 20 | # logoFile="${project.mod_icon}" #optional - removed - syntax (possibly) not allowed 21 | 22 | [[dependencies.nounusedchunks]] 23 | modId="forge" 24 | mandatory=true 25 | versionRange="[41,)" 26 | ordering="NONE" 27 | side="BOTH" 28 | 29 | [[dependencies.nounusedchunks]] 30 | modId="minecraft" 31 | mandatory=true 32 | versionRange="[1.19,1.19.3)" 33 | ordering="NONE" 34 | side="BOTH" 35 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/assets/nounusedchunks/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.19.2/src/main/resources/assets/nounusedchunks/icon.png -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/assets/nounusedchunks/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "nounusedchunks.backupprompt.removeuninhabitedchunks": "Remove uninhabited chunks", 3 | "nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip": "Removes all chunks that were never inhabited by a player.\nWhile this may reduce the world size by a lot, keep in\nmind that this may also remove chunks you might need,\nwithout actually having visited them. For example, this\nmay end up removing chunks modified by another mod or a\ntool or a program. Please back up your world before\ndoing this, and make sure the chunks got removed properly." 4 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${project.mod_id}", 4 | "version": "${project.mod_version}", 5 | 6 | "name": "${project.mod_name}", 7 | "description": "${project.mod_description}", 8 | "authors": ["${project.mod_author}"], 9 | "contact": 10 | { 11 | "homepage": "${project.mod_contact_homepage}", 12 | "sources": "${project.mod_contact_sources}", 13 | "issues": "${project.mod_contact_issues}" 14 | }, 15 | 16 | "license": "${project.mod_license}", 17 | "icon": "${mod_icon}", 18 | 19 | "environment": "client", 20 | "entrypoints": 21 | { 22 | "client": ["${project.mod_entrypoint_client}"], 23 | "server": ["${project.mod_entrypoint_server}"] 24 | }, 25 | "mixins": 26 | [ 27 | "nounusedchunks.client.mixin.events.json", 28 | "nounusedchunks.client.mixin.hooks.json", 29 | "nounusedchunks.mixin.events.json" 30 | ], 31 | 32 | "depends": 33 | { 34 | "fabricloader": ">=${project.loader_version}", 35 | "minecraft": "${project.mod_depends_minecraft}", 36 | "java": "${project.mod_depends_java}" 37 | }, 38 | 39 | "custom": 40 | { 41 | "modmenu": 42 | { 43 | "links": 44 | { 45 | "modmenu.curseforge": "${project.modmenu_link_curseforge}", 46 | "modmenu.modrinth": "${project.modmenu_link_modrinth}", 47 | "modmenu.kofi": "${project.modmenu_link_kofi}", 48 | "modmenu.youtube": "${project.modmenu_link_youtube}" 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/nounusedchunks.client.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinBackupPromptScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/nounusedchunks.client.mixin.hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.hooks", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["AccessorScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/nounusedchunks.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinWorldUpdater"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.2/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": 3 | { 4 | "description": "nounusedchunks resources", 5 | "pack_format": 9, 6 | "forge:resource_pack_format": 9, 7 | "forge:data_pack_format": 10 8 | } 9 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17, # Current Java LTS & minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-2022] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: Artifacts 39 | path: build/libs/ 40 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/.gitignore: -------------------------------------------------------------------------------- 1 | # -------------------- Eclipse IDE ------------------- 2 | .metadata 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .settings/ 11 | .loadpath 12 | .recommenders 13 | 14 | # External tool builders 15 | .externalToolBuilders/ 16 | 17 | # Locally stored "Eclipse launch configurations" 18 | *.launch 19 | 20 | # PyDev specific (Python IDE for Eclipse) 21 | *.pydevproject 22 | 23 | # CDT-specific (C/C++ Development Tooling) 24 | .cproject 25 | 26 | # CDT- autotools 27 | .autotools 28 | 29 | # Java annotation processor (APT) 30 | .factorypath 31 | 32 | # PDT-specific (PHP Development Tools) 33 | .buildpath 34 | 35 | # sbteclipse plugin 36 | .target 37 | 38 | # Tern plugin 39 | .tern-project 40 | 41 | # TeXlipse plugin 42 | .texlipse 43 | 44 | # STS (Spring Tool Suite) 45 | .springBeans 46 | 47 | # Code Recommenders 48 | .recommenders/ 49 | 50 | # Annotation Processing 51 | .apt_generated/ 52 | .apt_generated_test/ 53 | 54 | # Scala IDE specific (Scala & Java development for Eclipse) 55 | .cache-main 56 | .scala_dependencies 57 | .worksheet 58 | 59 | # Uncomment this line if you wish to ignore the project description file. 60 | # Typically, this file would be tracked if it contains build/dependency configurations: 61 | #.project 62 | 63 | # ----------------------- Java ----------------------- 64 | # Compiled class file 65 | *.class 66 | 67 | # Log file 68 | *.log 69 | 70 | # BlueJ files 71 | *.ctxt 72 | 73 | # Mobile Tools for Java (J2ME) 74 | .mtj.tmp/ 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.nar 80 | *.ear 81 | *.zip 82 | *.tar.gz 83 | *.rar 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | /.gradle/ 88 | /build/ 89 | 90 | # ----------------------- Gradle ----------------------- 91 | .gradle 92 | **/build/ 93 | !src/**/build/ 94 | 95 | # Ignore Gradle GUI config 96 | gradle-app.setting 97 | 98 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 99 | !gradle-wrapper.jar 100 | 101 | # Avoid ignore Gradle wrappper properties 102 | !gradle-wrapper.properties 103 | 104 | # Cache of project 105 | .gradletasknamecache 106 | 107 | # Eclipse Gradle plugin generated files 108 | # Eclipse Core 109 | .project 110 | # JDT-specific (Eclipse Java Development Tools) 111 | .classpath 112 | 113 | # ----------------------- Fabric ----------------------- 114 | run/ 115 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheCSDev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/build.gradle: -------------------------------------------------------------------------------- 1 | import com.google.gson.Gson 2 | import com.google.gson.reflect.TypeToken 3 | import java.lang.reflect.Type 4 | 5 | plugins 6 | { 7 | id 'fabric-loom' version '1.0-SNAPSHOT' 8 | id 'maven-publish' 9 | } 10 | 11 | sourceCompatibility = JavaVersion.VERSION_17 12 | targetCompatibility = JavaVersion.VERSION_17 13 | 14 | archivesBaseName = project.mod_id 15 | version = project.mod_version 16 | group = project.maven_group 17 | 18 | repositories 19 | { 20 | // Add repositories to retrieve artifacts from in here. 21 | // You should only use this when depending on other mods because 22 | // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. 23 | // See https://docs.gradle.org/current/userguide/declaring_repositories.html 24 | // for more information about repositories. 25 | maven { url "https://maven.shedaniel.me/" } 26 | maven { url "https://maven.terraformersmc.com/releases/" } 27 | } 28 | 29 | dependencies 30 | { 31 | // To change the versions see the gradle.properties file 32 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 33 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 34 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 35 | 36 | // Fabric API 37 | // modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 38 | // Don't forget to declare | "fabric":"*" | as a dependency in fabric.mod.json 39 | 40 | // Mod Menu 41 | modApi "com.terraformersmc:modmenu:${project.modmenu_version}" 42 | 43 | // Roughly Enough Items 44 | // modApi "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" 45 | 46 | // Uncomment the following line to enable the deprecated Fabric API modules. 47 | // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. 48 | // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" 49 | } 50 | 51 | processResources 52 | { 53 | // inputs.property "version", project.version 54 | filesMatching(["fabric.mod.json", "**/mods.toml"]) { expand project.properties } 55 | } 56 | 57 | //this task includes `MixinConfigs` metadata for the Forge platform 58 | //(it is important that this task runs AFTER the `processResources` task) 59 | task updateMixinConfigs 60 | { 61 | doLast 62 | { 63 | // 1. Read the `fabric.mod.json` file and parse the JSON. 64 | File jsonFile = file('src/main/resources/fabric.mod.json') 65 | String jsonString = jsonFile.text 66 | Gson gson = new Gson() 67 | Type type = new TypeToken>(){}.getType() 68 | Map jsonMap = gson.fromJson(jsonString, type) 69 | 70 | // Check if the `mixins` property exists 71 | if (!jsonMap.containsKey("mixins")) { return } 72 | 73 | // 2. Extract the `mixins` array and convert it to a string. 74 | List mixinList = (List) jsonMap.get("mixins") 75 | String mixinConfigs = String.join(",", mixinList) 76 | 77 | // 3. Add the resulting string to the `MixinConfigs` property in the `MANIFEST.MF` file. 78 | jar { manifest { attributes 'MixinConfigs': mixinConfigs } } 79 | } 80 | } 81 | updateMixinConfigs.mustRunAfter processResources //this task depends on that task being run first 82 | jar.dependsOn updateMixinConfigs //important to execute before the `jar` task 83 | 84 | tasks.withType(JavaCompile).configureEach 85 | { 86 | // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. 87 | it.options.release = 17 88 | } 89 | 90 | java 91 | { 92 | // Loom will automatically attach sourcesJar to a RemapSourcesJar 93 | // task and to the "build" task if it is present. 94 | // If you remove this line, sources will not be generated. 95 | withSourcesJar() 96 | 97 | // Generate Java docs. 98 | javadoc.options.addStringOption('Xdoclint:none', '-quiet') 99 | withJavadocJar() 100 | } 101 | 102 | jar 103 | { 104 | //exclude all .class files outside of the maven group 105 | def includeOnlyPackage = project.maven_group.replaceAll('\\.', '/') 106 | eachFile { fileCopyDetails -> 107 | if (fileCopyDetails.name.endsWith('.class') && !fileCopyDetails.relativePath.pathString.startsWith(includeOnlyPackage)) { 108 | fileCopyDetails.exclude() 109 | } 110 | } 111 | 112 | //handle the license file 113 | from("LICENSE") { rename { "${it}_${project.archivesBaseName}"} } 114 | } 115 | 116 | // configure the maven publication 117 | publishing 118 | { 119 | publications 120 | { 121 | mavenJava(MavenPublication) { from components.java } 122 | } 123 | 124 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 125 | repositories 126 | { 127 | // Add repositories to publish to here. 128 | // Notice: This block does NOT have the same function as the block in the top level. 129 | // The repositories here will be used for publishing your artifact, not for 130 | // retrieving dependencies. 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/develop 6 | minecraft_version=1.19.3 7 | yarn_mappings=1.19.3+build.5 8 | loader_version=0.14.21 9 | 10 | # Mod Properties 11 | # the maven group 12 | maven_group = io.github.thecsdev 13 | # the mod id as well as the archives base name 14 | mod_id = nounusedchunks 15 | 16 | mod_name = No Unused Chunks 17 | mod_description = Reduces world size by discarding unused chunks. 18 | mod_author = TheCSDev 19 | mod_version = 2.1+1.19.3 20 | 21 | mod_contact_homepage = https://github.com/TheCSDev 22 | mod_contact_sources = https://github.com/TheCSDev/mc-no-unused-chunks 23 | mod_contact_issues = https://github.com/TheCSDev/mc-no-unused-chunks/issues 24 | 25 | modmenu_link_curseforge = https://www.curseforge.com/projects/711539 26 | modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 27 | modmenu_link_kofi = https://ko-fi.com/TheCSDev 28 | modmenu_link_youtube = https://www.youtube.com/@TheCSDev 29 | 30 | mod_license = MIT 31 | mod_icon = assets/nounusedchunks/icon.png 32 | 33 | mod_entrypoint_client = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 34 | mod_entrypoint_server = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 35 | 36 | mod_depends_minecraft = 1.19.3 37 | mod_depends_java = >=17 38 | 39 | # Dependencies 40 | # If you choose to use any of the following mods as dependencies, 41 | # uncomment them in build.gradle, and don't forget to list them 42 | # as dependencies in fabric.mod.json 43 | fabric_version=0.76.1+1.19.3 44 | modmenu_version=5.0.0 45 | architectury_version=7.1.86 46 | rei_version=10.0.620 47 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.19.3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement 2 | { 3 | repositories 4 | { 5 | maven 6 | { 7 | name = 'Fabric' 8 | url = 'https://maven.fabricmc.net/' 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunks.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import net.minecraft.nbt.NbtCompound; 7 | import net.minecraft.nbt.NbtElement; 8 | 9 | public abstract class NoUnusedChunks extends Object 10 | { 11 | // ================================================== 12 | public static final Logger LOGGER = LoggerFactory.getLogger(getModID()); 13 | // -------------------------------------------------- 14 | static final String ModName = "No Unused Chunks"; 15 | static final String ModID = "nounusedchunks"; 16 | private static NoUnusedChunks Instance; 17 | // -------------------------------------------------- 18 | //protected final ModContainer modInfo; 19 | // ================================================== 20 | public NoUnusedChunks() 21 | { 22 | //validate instance first 23 | if(isModInitialized()) 24 | throw new IllegalStateException(getModID() + " has already been initialized."); 25 | else if(!isInstanceValid(this)) 26 | throw new UnsupportedOperationException("Invalid " + getModID() + " type: " + this.getClass().getName()); 27 | 28 | //assign instance 29 | Instance = this; 30 | //modInfo = FabricLoader.getInstance().getModContainer(getModID()).get(); 31 | 32 | //log stuff 33 | /*LOGGER.info("Initializing '" + getModName() + "' " + modInfo.getMetadata().getVersion() + 34 | " as '" + getClass().getSimpleName() + "'.");*/ 35 | LOGGER.info("Initializing '" + getModName() + "' as '" + getClass().getSimpleName() + "'."); 36 | 37 | //init stuff 38 | //TODO - Initialize common stuff here (client/dedicated-server/internal-server) 39 | } 40 | // ================================================== 41 | public static NoUnusedChunks getInstance() { return Instance; } 42 | //public ModContainer getModInfo() { return modInfo; } 43 | // -------------------------------------------------- 44 | public static String getModName() { return ModName; } 45 | public static String getModID() { return ModID; } 46 | // -------------------------------------------------- 47 | public static boolean isModInitialized() { return isInstanceValid(Instance); } 48 | private static boolean isInstanceValid(NoUnusedChunks instance) { return isServer(instance) || isClient(instance); } 49 | // -------------------------------------------------- 50 | public static boolean isServer() { return isServer(Instance); } 51 | public static boolean isClient() { return isClient(Instance); } 52 | 53 | private static boolean isServer(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; } 54 | private static boolean isClient(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; } 55 | // ================================================== 56 | /** 57 | * Returns true if a chunk is unused. 58 | *

59 | * Checks are done based off the Chunk's NBT data. 60 | * 61 | * @param chunkNbt The Chunk's {@link NbtCompound} data. 62 | */ 63 | public static boolean isChunkUnused(NbtCompound chunkNbt) 64 | { 65 | return chunkNbt.contains("InhabitedTime", NbtElement.LONG_TYPE) && 66 | chunkNbt.getLong("InhabitedTime") == 0; 67 | } 68 | // ================================================== 69 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | public final class NoUnusedChunksConfig 4 | { 5 | /** 6 | * Optimize world screen - Remove unused chunks.
7 | * Temporary variable with a temporary value. 8 | *

9 | * Indicates whether or not the user checked the "Remove uninhaited chunks" 10 | * checkbox in the "Optimize world" screen. 11 | */ 12 | public static boolean TEMP_OWS_RUC = false; 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksFabric.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import net.fabricmc.api.ClientModInitializer; 4 | import net.fabricmc.api.DedicatedServerModInitializer; 5 | 6 | /** 7 | * Fabric Mod Loader entry-points for this mod. 8 | */ 9 | public final class NoUnusedChunksFabric implements ClientModInitializer, DedicatedServerModInitializer 10 | { 11 | // ================================================== 12 | public @Override void onInitializeClient() { new io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient(); } 13 | public @Override void onInitializeServer() { new io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer(); } 14 | // ================================================== 15 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksForge.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; 4 | import io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; 5 | import net.minecraftforge.fml.common.Mod; 6 | import net.minecraftforge.fml.loading.FMLEnvironment; 7 | 8 | /** 9 | * Forge Mod Loader entry-points for this mod. 10 | */ 11 | @Mod(NoUnusedChunks.ModID) 12 | public final class NoUnusedChunksForge 13 | { 14 | // ================================================== 15 | public NoUnusedChunksForge() 16 | { 17 | //*literal black magic...* 18 | //(it's amazing this actually works) 19 | if(FMLEnvironment.dist.isClient()) 20 | new NoUnusedChunksClient(); 21 | else if(FMLEnvironment.dist.isDedicatedServer()) 22 | new NoUnusedChunksServer(); 23 | } 24 | // ================================================== 25 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/client/NoUnusedChunksClient.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksClient extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksClient() 9 | { 10 | //TODO - Initialize client-side-only stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/widgets/ActionCheckboxWidget.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.widgets; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import net.minecraft.client.gui.widget.CheckboxWidget; 6 | import net.minecraft.text.Text; 7 | 8 | public class ActionCheckboxWidget extends CheckboxWidget 9 | { 10 | // -------------------------------------------------- 11 | public final Consumer callback; 12 | // -------------------------------------------------- 13 | public ActionCheckboxWidget( 14 | int x, int y, int width, int height, 15 | Text message, boolean checked, boolean showMessage, 16 | Consumer callback) 17 | { 18 | super(x, y, width, height, message, checked, showMessage); 19 | this.callback = callback; 20 | } 21 | // -------------------------------------------------- 22 | public @Override void onPress() 23 | { 24 | super.onPress(); 25 | if(this.callback != null) 26 | this.callback.accept(this); 27 | } 28 | // -------------------------------------------------- 29 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/addons/AddonBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.addons; 2 | 3 | public interface AddonBackupPromptScreen 4 | { 5 | public boolean nounusedchunks_getRemoveUnusedChunks(); 6 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/events/MixinBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.events; 2 | 3 | import static io.github.thecsdev.nounusedchunks.NoUnusedChunksConfig.TEMP_OWS_RUC; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import io.github.thecsdev.nounusedchunks.client.gui.widgets.ActionCheckboxWidget; 13 | import io.github.thecsdev.nounusedchunks.client.mixin.addons.AddonBackupPromptScreen; 14 | import io.github.thecsdev.nounusedchunks.client.mixin.hooks.AccessorScreen; 15 | import net.minecraft.client.gui.screen.BackupPromptScreen; 16 | import net.minecraft.client.gui.screen.Screen; 17 | import net.minecraft.client.gui.tooltip.Tooltip; 18 | import net.minecraft.client.gui.widget.CheckboxWidget; 19 | import net.minecraft.client.gui.widget.ClickableWidget; 20 | import net.minecraft.text.Text; 21 | 22 | @Mixin(BackupPromptScreen.class) 23 | public abstract class MixinBackupPromptScreen extends Screen implements AddonBackupPromptScreen 24 | { 25 | // ================================================== 26 | protected MixinBackupPromptScreen(Text title) { super(title); } 27 | // ================================================== 28 | private @Unique ActionCheckboxWidget nounusedchunks_removeUnusedChunksCheckbox; 29 | // -------------------------------------------------- 30 | @Accessor("showEraseCacheCheckbox") 31 | public abstract boolean getShowEraseCacheCheckbox(); 32 | 33 | @Accessor("eraseCacheCheckbox") 34 | public abstract CheckboxWidget getEraseCacheCheckbox(); 35 | // ================================================== 36 | @Inject(method = "init", at = @At("TAIL")) 37 | public void init(CallbackInfo callback) 38 | { 39 | //define fields 40 | TEMP_OWS_RUC = false; //HIGHLY IMPORTANT TO RESET THE FLAG - PREVENTS POTENTIAL CORRUPTIONS AND ERRORS 41 | final int i = getEraseCacheCheckbox().getY(), j = getEraseCacheCheckbox().getHeight() + 5; 42 | 43 | //define the check-box 44 | nounusedchunks_removeUnusedChunksCheckbox = new ActionCheckboxWidget( 45 | this.width / 2 - 155 + 80, i + j, //x and y 46 | 250, 20, //width and height 47 | Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks"), //text 48 | TEMP_OWS_RUC, //current value 49 | true, //show message 50 | checkbox -> TEMP_OWS_RUC = checkbox.isChecked()); //on-click 51 | 52 | nounusedchunks_removeUnusedChunksCheckbox.setTooltip( 53 | Tooltip.of(Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip"))); 54 | 55 | //if showing the check-boxes, add the check-box below the 56 | //vanilla one, and move the buttons down 57 | if(getShowEraseCacheCheckbox()) 58 | { 59 | //add the check-box 60 | addDrawableChild(nounusedchunks_removeUnusedChunksCheckbox); 61 | 62 | //move the stuff below it a bit down 63 | ((AccessorScreen)(Object)this).getDrawables().forEach(drawable -> 64 | { 65 | //ignore non-clickables 66 | //ignore the removeUnusedChunks checkbox 67 | if(!(drawable instanceof ClickableWidget) || drawable == nounusedchunks_removeUnusedChunksCheckbox) 68 | return; 69 | ClickableWidget cw = (ClickableWidget)drawable; 70 | 71 | //ignore above ones 72 | if(cw.getY() < nounusedchunks_removeUnusedChunksCheckbox.getY() - 5) 73 | return; 74 | 75 | //move a bit down 76 | cw.setY(cw.getY() + j + 10); 77 | }); 78 | } 79 | } 80 | // ================================================== 81 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/hooks/AccessorScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.hooks; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import net.minecraft.client.gui.Drawable; 9 | import net.minecraft.client.gui.screen.Screen; 10 | 11 | @Mixin(Screen.class) 12 | public interface AccessorScreen 13 | { 14 | @Accessor("drawables") 15 | public abstract List getDrawables(); 16 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/io/github/thecsdev/nounusedchunks/server/NoUnusedChunksServer.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.server; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksServer extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksServer() 9 | { 10 | //TODO - Initialize dedicated-server-side stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/net/minecraftforge/api/distmarker/Dist.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.api.distmarker; 2 | 3 | public class Dist 4 | { 5 | public boolean isClient() { return isDedicatedServer(); } 6 | public boolean isDedicatedServer() { throw new AssertionError("Nope."); } 7 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/net/minecraftforge/fml/common/Mod.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.common; 2 | 3 | import static java.lang.annotation.ElementType.TYPE; 4 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.Target; 8 | 9 | @Retention(RUNTIME) 10 | @Target(TYPE) 11 | public @interface Mod 12 | { 13 | String value(); 14 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.loading; 2 | 3 | import net.minecraftforge.api.distmarker.Dist; 4 | 5 | public class FMLEnvironment 6 | { 7 | public static final Dist dist = new Dist(); 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/java/readme.txt: -------------------------------------------------------------------------------- 1 | In `gradle.properties`, there's a property that looks like this: 2 | maven_group = io.github.thecsdev 3 | 4 | In `build.gradle`, the project has been configured to discard all `.class` 5 | files outside of the `maven_group`. This means that packages such as 6 | `net.minecraftforge` are only there during "compile-time", and not "run-time". 7 | This allows the mod to be written in a way that allows it to interact with 8 | Minecraft Forge, without Forge actually being present. 9 | 10 | # Important node: 11 | Because of this, all `.class` files created outside of the `maven_group` will 12 | be discarded once the jar file is compiled aka built! -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | # This is an example mods.toml file. It contains the data relating to the loading mods. 2 | # There are several mandatory fields (#mandatory), and many more that are optional (#optional). 3 | # The overall format is standard TOML format, v0.5.0. 4 | # Note that there are a couple of TOML lists in this file. 5 | # Find more information on toml format here: https://github.com/toml-lang/toml 6 | 7 | modLoader="javafml" #mandatory 8 | loaderVersion="[44,)" #mandatory 9 | license="${project.mod_license}" #mandatory 10 | issueTrackerURL="${project.mod_contact_issues}" #optional 11 | 12 | # A list of mods - how many allowed here is determined by the individual mod loader 13 | [[mods]] #mandatory 14 | displayName="${project.mod_name}" #mandatory 15 | modId="${project.mod_id}" #mandatory 16 | version="${project.mod_version}" #mandatory 17 | description='''${project.mod_description}''' 18 | displayURL="${project.mod_contact_sources}" #optional 19 | authors="${project.mod_author}" #optional 20 | # logoFile="${project.mod_icon}" #optional - removed - syntax (possibly) not allowed 21 | 22 | [[dependencies.nounusedchunks]] 23 | modId="forge" 24 | mandatory=true 25 | versionRange="[44,)" 26 | ordering="NONE" 27 | side="BOTH" 28 | 29 | [[dependencies.nounusedchunks]] 30 | modId="minecraft" 31 | mandatory=true 32 | versionRange="1.19.3" 33 | ordering="NONE" 34 | side="BOTH" 35 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/assets/nounusedchunks/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.19.3/src/main/resources/assets/nounusedchunks/icon.png -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/assets/nounusedchunks/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "nounusedchunks.backupprompt.removeuninhabitedchunks": "Remove uninhabited chunks", 3 | "nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip": "Removes all chunks that were never inhabited by a player.\nWhile this may reduce the world size by a lot, keep in\nmind that this may also remove chunks you might need,\nwithout actually having visited them. For example, this\nmay end up removing chunks modified by another mod or a\ntool or a program. Please back up your world before\ndoing this, and make sure the chunks got removed properly." 4 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${project.mod_id}", 4 | "version": "${project.mod_version}", 5 | 6 | "name": "${project.mod_name}", 7 | "description": "${project.mod_description}", 8 | "authors": ["${project.mod_author}"], 9 | "contact": 10 | { 11 | "homepage": "${project.mod_contact_homepage}", 12 | "sources": "${project.mod_contact_sources}", 13 | "issues": "${project.mod_contact_issues}" 14 | }, 15 | 16 | "license": "${project.mod_license}", 17 | "icon": "${mod_icon}", 18 | 19 | "environment": "client", 20 | "entrypoints": 21 | { 22 | "client": ["${project.mod_entrypoint_client}"], 23 | "server": ["${project.mod_entrypoint_server}"] 24 | }, 25 | "mixins": 26 | [ 27 | "nounusedchunks.client.mixin.events.json", 28 | "nounusedchunks.client.mixin.hooks.json", 29 | "nounusedchunks.mixin.events.json" 30 | ], 31 | 32 | "depends": 33 | { 34 | "fabricloader": ">=${project.loader_version}", 35 | "minecraft": "${project.mod_depends_minecraft}", 36 | "java": "${project.mod_depends_java}" 37 | }, 38 | 39 | "custom": 40 | { 41 | "modmenu": 42 | { 43 | "links": 44 | { 45 | "modmenu.curseforge": "${project.modmenu_link_curseforge}", 46 | "modmenu.modrinth": "${project.modmenu_link_modrinth}", 47 | "modmenu.kofi": "${project.modmenu_link_kofi}", 48 | "modmenu.youtube": "${project.modmenu_link_youtube}" 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/nounusedchunks.client.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinBackupPromptScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/nounusedchunks.client.mixin.hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.hooks", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["AccessorScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/nounusedchunks.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinWorldUpdater"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.3/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": 3 | { 4 | "description": "nounusedchunks resources", 5 | "pack_format": 12, 6 | "forge:resource_pack_format": 12, 7 | "forge:data_pack_format": 10 8 | } 9 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17, # Current Java LTS & minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-2022] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: Artifacts 39 | path: build/libs/ 40 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/.gitignore: -------------------------------------------------------------------------------- 1 | # -------------------- Eclipse IDE ------------------- 2 | .metadata 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .settings/ 11 | .loadpath 12 | .recommenders 13 | 14 | # External tool builders 15 | .externalToolBuilders/ 16 | 17 | # Locally stored "Eclipse launch configurations" 18 | *.launch 19 | 20 | # PyDev specific (Python IDE for Eclipse) 21 | *.pydevproject 22 | 23 | # CDT-specific (C/C++ Development Tooling) 24 | .cproject 25 | 26 | # CDT- autotools 27 | .autotools 28 | 29 | # Java annotation processor (APT) 30 | .factorypath 31 | 32 | # PDT-specific (PHP Development Tools) 33 | .buildpath 34 | 35 | # sbteclipse plugin 36 | .target 37 | 38 | # Tern plugin 39 | .tern-project 40 | 41 | # TeXlipse plugin 42 | .texlipse 43 | 44 | # STS (Spring Tool Suite) 45 | .springBeans 46 | 47 | # Code Recommenders 48 | .recommenders/ 49 | 50 | # Annotation Processing 51 | .apt_generated/ 52 | .apt_generated_test/ 53 | 54 | # Scala IDE specific (Scala & Java development for Eclipse) 55 | .cache-main 56 | .scala_dependencies 57 | .worksheet 58 | 59 | # Uncomment this line if you wish to ignore the project description file. 60 | # Typically, this file would be tracked if it contains build/dependency configurations: 61 | #.project 62 | 63 | # ----------------------- Java ----------------------- 64 | # Compiled class file 65 | *.class 66 | 67 | # Log file 68 | *.log 69 | 70 | # BlueJ files 71 | *.ctxt 72 | 73 | # Mobile Tools for Java (J2ME) 74 | .mtj.tmp/ 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.nar 80 | *.ear 81 | *.zip 82 | *.tar.gz 83 | *.rar 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | /.gradle/ 88 | /build/ 89 | 90 | # ----------------------- Gradle ----------------------- 91 | .gradle 92 | **/build/ 93 | !src/**/build/ 94 | 95 | # Ignore Gradle GUI config 96 | gradle-app.setting 97 | 98 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 99 | !gradle-wrapper.jar 100 | 101 | # Avoid ignore Gradle wrappper properties 102 | !gradle-wrapper.properties 103 | 104 | # Cache of project 105 | .gradletasknamecache 106 | 107 | # Eclipse Gradle plugin generated files 108 | # Eclipse Core 109 | .project 110 | # JDT-specific (Eclipse Java Development Tools) 111 | .classpath 112 | 113 | # ----------------------- Fabric ----------------------- 114 | run/ 115 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheCSDev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/build.gradle: -------------------------------------------------------------------------------- 1 | import com.google.gson.Gson 2 | import com.google.gson.reflect.TypeToken 3 | import java.lang.reflect.Type 4 | 5 | plugins 6 | { 7 | id 'fabric-loom' version '1.0-SNAPSHOT' 8 | id 'maven-publish' 9 | } 10 | 11 | sourceCompatibility = JavaVersion.VERSION_17 12 | targetCompatibility = JavaVersion.VERSION_17 13 | 14 | archivesBaseName = project.mod_id 15 | version = project.mod_version 16 | group = project.maven_group 17 | 18 | repositories 19 | { 20 | // Add repositories to retrieve artifacts from in here. 21 | // You should only use this when depending on other mods because 22 | // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. 23 | // See https://docs.gradle.org/current/userguide/declaring_repositories.html 24 | // for more information about repositories. 25 | maven { url "https://maven.shedaniel.me/" } 26 | maven { url "https://maven.terraformersmc.com/releases/" } 27 | } 28 | 29 | dependencies 30 | { 31 | // To change the versions see the gradle.properties file 32 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 33 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 34 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 35 | 36 | // Fabric API 37 | // modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 38 | // Don't forget to declare | "fabric":"*" | as a dependency in fabric.mod.json 39 | 40 | // Mod Menu 41 | modApi "com.terraformersmc:modmenu:${project.modmenu_version}" 42 | 43 | // Roughly Enough Items 44 | // modApi "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" 45 | 46 | // Uncomment the following line to enable the deprecated Fabric API modules. 47 | // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. 48 | // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" 49 | } 50 | 51 | processResources 52 | { 53 | // inputs.property "version", project.version 54 | filesMatching(["fabric.mod.json", "**/mods.toml"]) { expand project.properties } 55 | } 56 | 57 | //this task includes `MixinConfigs` metadata for the Forge platform 58 | //(it is important that this task runs AFTER the `processResources` task) 59 | task updateMixinConfigs 60 | { 61 | doLast 62 | { 63 | // 1. Read the `fabric.mod.json` file and parse the JSON. 64 | File jsonFile = file('src/main/resources/fabric.mod.json') 65 | String jsonString = jsonFile.text 66 | Gson gson = new Gson() 67 | Type type = new TypeToken>(){}.getType() 68 | Map jsonMap = gson.fromJson(jsonString, type) 69 | 70 | // Check if the `mixins` property exists 71 | if (!jsonMap.containsKey("mixins")) { return } 72 | 73 | // 2. Extract the `mixins` array and convert it to a string. 74 | List mixinList = (List) jsonMap.get("mixins") 75 | String mixinConfigs = String.join(",", mixinList) 76 | 77 | // 3. Add the resulting string to the `MixinConfigs` property in the `MANIFEST.MF` file. 78 | jar { manifest { attributes 'MixinConfigs': mixinConfigs } } 79 | } 80 | } 81 | updateMixinConfigs.mustRunAfter processResources //this task depends on that task being run first 82 | jar.dependsOn updateMixinConfigs //important to execute before the `jar` task 83 | 84 | tasks.withType(JavaCompile).configureEach 85 | { 86 | // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. 87 | it.options.release = 17 88 | } 89 | 90 | java 91 | { 92 | // Loom will automatically attach sourcesJar to a RemapSourcesJar 93 | // task and to the "build" task if it is present. 94 | // If you remove this line, sources will not be generated. 95 | withSourcesJar() 96 | 97 | // Generate Java docs. 98 | javadoc.options.addStringOption('Xdoclint:none', '-quiet') 99 | withJavadocJar() 100 | } 101 | 102 | jar 103 | { 104 | //exclude all .class files outside of the maven group 105 | def includeOnlyPackage = project.maven_group.replaceAll('\\.', '/') 106 | eachFile { fileCopyDetails -> 107 | if (fileCopyDetails.name.endsWith('.class') && !fileCopyDetails.relativePath.pathString.startsWith(includeOnlyPackage)) { 108 | fileCopyDetails.exclude() 109 | } 110 | } 111 | 112 | //handle the license file 113 | from("LICENSE") { rename { "${it}_${project.archivesBaseName}"} } 114 | } 115 | 116 | // configure the maven publication 117 | publishing 118 | { 119 | publications 120 | { 121 | mavenJava(MavenPublication) { from components.java } 122 | } 123 | 124 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 125 | repositories 126 | { 127 | // Add repositories to publish to here. 128 | // Notice: This block does NOT have the same function as the block in the top level. 129 | // The repositories here will be used for publishing your artifact, not for 130 | // retrieving dependencies. 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/develop 6 | minecraft_version=1.19.4 7 | yarn_mappings=1.19.4+build.2 8 | loader_version=0.14.21 9 | 10 | # Mod Properties 11 | # the maven group 12 | maven_group = io.github.thecsdev 13 | # the mod id as well as the archives base name 14 | mod_id = nounusedchunks 15 | 16 | mod_name = No Unused Chunks 17 | mod_description = Reduces world size by discarding unused chunks. 18 | mod_author = TheCSDev 19 | mod_version = 2.1+1.19.4 20 | 21 | mod_contact_homepage = https://github.com/TheCSDev 22 | mod_contact_sources = https://github.com/TheCSDev/mc-no-unused-chunks 23 | mod_contact_issues = https://github.com/TheCSDev/mc-no-unused-chunks/issues 24 | 25 | modmenu_link_curseforge = https://www.curseforge.com/projects/711539 26 | modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 27 | modmenu_link_kofi = https://ko-fi.com/TheCSDev 28 | modmenu_link_youtube = https://www.youtube.com/@TheCSDev 29 | 30 | mod_license = MIT 31 | mod_icon = assets/nounusedchunks/icon.png 32 | 33 | mod_entrypoint_client = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 34 | mod_entrypoint_server = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 35 | 36 | mod_depends_minecraft = 1.19.4 37 | mod_depends_java = >=17 38 | 39 | # Dependencies 40 | # If you choose to use any of the following mods as dependencies, 41 | # uncomment them in build.gradle, and don't forget to list them 42 | # as dependencies in fabric.mod.json 43 | fabric_version=0.84.0+1.19.4 44 | modmenu_version=6.2.1 45 | architectury_version=8.1.87 46 | rei_version=11.0.621 47 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.19.4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement 2 | { 3 | repositories 4 | { 5 | maven 6 | { 7 | name = 'Fabric' 8 | url = 'https://maven.fabricmc.net/' 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunks.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import net.minecraft.nbt.NbtCompound; 7 | import net.minecraft.nbt.NbtElement; 8 | 9 | public abstract class NoUnusedChunks extends Object 10 | { 11 | // ================================================== 12 | public static final Logger LOGGER = LoggerFactory.getLogger(getModID()); 13 | // -------------------------------------------------- 14 | static final String ModName = "No Unused Chunks"; 15 | static final String ModID = "nounusedchunks"; 16 | private static NoUnusedChunks Instance; 17 | // -------------------------------------------------- 18 | //protected final ModContainer modInfo; 19 | // ================================================== 20 | public NoUnusedChunks() 21 | { 22 | //validate instance first 23 | if(isModInitialized()) 24 | throw new IllegalStateException(getModID() + " has already been initialized."); 25 | else if(!isInstanceValid(this)) 26 | throw new UnsupportedOperationException("Invalid " + getModID() + " type: " + this.getClass().getName()); 27 | 28 | //assign instance 29 | Instance = this; 30 | //modInfo = FabricLoader.getInstance().getModContainer(getModID()).get(); 31 | 32 | //log stuff 33 | /*LOGGER.info("Initializing '" + getModName() + "' " + modInfo.getMetadata().getVersion() + 34 | " as '" + getClass().getSimpleName() + "'.");*/ 35 | LOGGER.info("Initializing '" + getModName() + "' as '" + getClass().getSimpleName() + "'."); 36 | 37 | //init stuff 38 | //TODO - Initialize common stuff here (client/dedicated-server/internal-server) 39 | } 40 | // ================================================== 41 | public static NoUnusedChunks getInstance() { return Instance; } 42 | //public ModContainer getModInfo() { return modInfo; } 43 | // -------------------------------------------------- 44 | public static String getModName() { return ModName; } 45 | public static String getModID() { return ModID; } 46 | // -------------------------------------------------- 47 | public static boolean isModInitialized() { return isInstanceValid(Instance); } 48 | private static boolean isInstanceValid(NoUnusedChunks instance) { return isServer(instance) || isClient(instance); } 49 | // -------------------------------------------------- 50 | public static boolean isServer() { return isServer(Instance); } 51 | public static boolean isClient() { return isClient(Instance); } 52 | 53 | private static boolean isServer(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; } 54 | private static boolean isClient(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; } 55 | // ================================================== 56 | /** 57 | * Returns true if a chunk is unused. 58 | *

59 | * Checks are done based off the Chunk's NBT data. 60 | * 61 | * @param chunkNbt The Chunk's {@link NbtCompound} data. 62 | */ 63 | public static boolean isChunkUnused(NbtCompound chunkNbt) 64 | { 65 | return chunkNbt.contains("InhabitedTime", NbtElement.LONG_TYPE) && 66 | chunkNbt.getLong("InhabitedTime") == 0; 67 | } 68 | // ================================================== 69 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | public final class NoUnusedChunksConfig 4 | { 5 | /** 6 | * Optimize world screen - Remove unused chunks.
7 | * Temporary variable with a temporary value. 8 | *

9 | * Indicates whether or not the user checked the "Remove uninhaited chunks" 10 | * checkbox in the "Optimize world" screen. 11 | */ 12 | public static boolean TEMP_OWS_RUC = false; 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksFabric.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import net.fabricmc.api.ClientModInitializer; 4 | import net.fabricmc.api.DedicatedServerModInitializer; 5 | 6 | /** 7 | * Fabric Mod Loader entry-points for this mod. 8 | */ 9 | public final class NoUnusedChunksFabric implements ClientModInitializer, DedicatedServerModInitializer 10 | { 11 | // ================================================== 12 | public @Override void onInitializeClient() { new io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient(); } 13 | public @Override void onInitializeServer() { new io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer(); } 14 | // ================================================== 15 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksForge.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; 4 | import io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; 5 | import net.minecraftforge.fml.common.Mod; 6 | import net.minecraftforge.fml.loading.FMLEnvironment; 7 | 8 | /** 9 | * Forge Mod Loader entry-points for this mod. 10 | */ 11 | @Mod(NoUnusedChunks.ModID) 12 | public final class NoUnusedChunksForge 13 | { 14 | // ================================================== 15 | public NoUnusedChunksForge() 16 | { 17 | //*literal black magic...* 18 | //(it's amazing this actually works) 19 | if(FMLEnvironment.dist.isClient()) 20 | new NoUnusedChunksClient(); 21 | else if(FMLEnvironment.dist.isDedicatedServer()) 22 | new NoUnusedChunksServer(); 23 | } 24 | // ================================================== 25 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/client/NoUnusedChunksClient.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksClient extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksClient() 9 | { 10 | //TODO - Initialize client-side-only stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/widgets/ActionCheckboxWidget.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.widgets; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import net.minecraft.client.gui.widget.CheckboxWidget; 6 | import net.minecraft.text.Text; 7 | 8 | public class ActionCheckboxWidget extends CheckboxWidget 9 | { 10 | // -------------------------------------------------- 11 | public final Consumer callback; 12 | // -------------------------------------------------- 13 | public ActionCheckboxWidget( 14 | int x, int y, int width, int height, 15 | Text message, boolean checked, boolean showMessage, 16 | Consumer callback) 17 | { 18 | super(x, y, width, height, message, checked, showMessage); 19 | this.callback = callback; 20 | } 21 | // -------------------------------------------------- 22 | public @Override void onPress() 23 | { 24 | super.onPress(); 25 | if(this.callback != null) 26 | this.callback.accept(this); 27 | } 28 | // -------------------------------------------------- 29 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/addons/AddonBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.addons; 2 | 3 | public interface AddonBackupPromptScreen 4 | { 5 | public boolean nounusedchunks_getRemoveUnusedChunks(); 6 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/events/MixinBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.events; 2 | 3 | import static io.github.thecsdev.nounusedchunks.NoUnusedChunksConfig.TEMP_OWS_RUC; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import io.github.thecsdev.nounusedchunks.client.gui.widgets.ActionCheckboxWidget; 13 | import io.github.thecsdev.nounusedchunks.client.mixin.addons.AddonBackupPromptScreen; 14 | import io.github.thecsdev.nounusedchunks.client.mixin.hooks.AccessorScreen; 15 | import net.minecraft.client.gui.screen.BackupPromptScreen; 16 | import net.minecraft.client.gui.screen.Screen; 17 | import net.minecraft.client.gui.tooltip.Tooltip; 18 | import net.minecraft.client.gui.widget.CheckboxWidget; 19 | import net.minecraft.client.gui.widget.ClickableWidget; 20 | import net.minecraft.text.Text; 21 | 22 | @Mixin(BackupPromptScreen.class) 23 | public abstract class MixinBackupPromptScreen extends Screen implements AddonBackupPromptScreen 24 | { 25 | // ================================================== 26 | protected MixinBackupPromptScreen(Text title) { super(title); } 27 | // ================================================== 28 | private @Unique ActionCheckboxWidget nounusedchunks_removeUnusedChunksCheckbox; 29 | // -------------------------------------------------- 30 | @Accessor("showEraseCacheCheckbox") 31 | public abstract boolean getShowEraseCacheCheckbox(); 32 | 33 | @Accessor("eraseCacheCheckbox") 34 | public abstract CheckboxWidget getEraseCacheCheckbox(); 35 | // ================================================== 36 | @Inject(method = "init", at = @At("TAIL")) 37 | public void init(CallbackInfo callback) 38 | { 39 | //define fields 40 | TEMP_OWS_RUC = false; //HIGHLY IMPORTANT TO RESET THE FLAG - PREVENTS POTENTIAL CORRUPTIONS AND ERRORS 41 | final int i = getEraseCacheCheckbox().getY(), j = getEraseCacheCheckbox().getHeight() + 5; 42 | 43 | //define the check-box 44 | nounusedchunks_removeUnusedChunksCheckbox = new ActionCheckboxWidget( 45 | this.width / 2 - 155 + 80, i + j, //x and y 46 | 250, 20, //width and height 47 | Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks"), //text 48 | TEMP_OWS_RUC, //current value 49 | true, //show message 50 | checkbox -> TEMP_OWS_RUC = checkbox.isChecked()); //on-click 51 | 52 | nounusedchunks_removeUnusedChunksCheckbox.setTooltip( 53 | Tooltip.of(Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip"))); 54 | 55 | //if showing the check-boxes, add the check-box below the 56 | //vanilla one, and move the buttons down 57 | if(getShowEraseCacheCheckbox()) 58 | { 59 | //add the check-box 60 | addDrawableChild(nounusedchunks_removeUnusedChunksCheckbox); 61 | 62 | //move the stuff below it a bit down 63 | ((AccessorScreen)(Object)this).getDrawables().forEach(drawable -> 64 | { 65 | //ignore non-clickables 66 | //ignore the removeUnusedChunks checkbox 67 | if(!(drawable instanceof ClickableWidget) || drawable == nounusedchunks_removeUnusedChunksCheckbox) 68 | return; 69 | ClickableWidget cw = (ClickableWidget)drawable; 70 | 71 | //ignore above ones 72 | if(cw.getY() < nounusedchunks_removeUnusedChunksCheckbox.getY() - 5) 73 | return; 74 | 75 | //move a bit down 76 | cw.setY(cw.getY() + j + 10); 77 | }); 78 | } 79 | } 80 | // ================================================== 81 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/hooks/AccessorScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.hooks; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import net.minecraft.client.gui.Drawable; 9 | import net.minecraft.client.gui.screen.Screen; 10 | 11 | @Mixin(Screen.class) 12 | public interface AccessorScreen 13 | { 14 | @Accessor("drawables") 15 | public abstract List getDrawables(); 16 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/io/github/thecsdev/nounusedchunks/server/NoUnusedChunksServer.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.server; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksServer extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksServer() 9 | { 10 | //TODO - Initialize dedicated-server-side stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/net/minecraftforge/api/distmarker/Dist.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.api.distmarker; 2 | 3 | public class Dist 4 | { 5 | public boolean isClient() { return isDedicatedServer(); } 6 | public boolean isDedicatedServer() { throw new AssertionError("Nope."); } 7 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/net/minecraftforge/fml/common/Mod.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.common; 2 | 3 | import static java.lang.annotation.ElementType.TYPE; 4 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.Target; 8 | 9 | @Retention(RUNTIME) 10 | @Target(TYPE) 11 | public @interface Mod 12 | { 13 | String value(); 14 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.loading; 2 | 3 | import net.minecraftforge.api.distmarker.Dist; 4 | 5 | public class FMLEnvironment 6 | { 7 | public static final Dist dist = new Dist(); 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/java/readme.txt: -------------------------------------------------------------------------------- 1 | In `gradle.properties`, there's a property that looks like this: 2 | maven_group = io.github.thecsdev 3 | 4 | In `build.gradle`, the project has been configured to discard all `.class` 5 | files outside of the `maven_group`. This means that packages such as 6 | `net.minecraftforge` are only there during "compile-time", and not "run-time". 7 | This allows the mod to be written in a way that allows it to interact with 8 | Minecraft Forge, without Forge actually being present. 9 | 10 | # Important node: 11 | Because of this, all `.class` files created outside of the `maven_group` will 12 | be discarded once the jar file is compiled aka built! -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | # This is an example mods.toml file. It contains the data relating to the loading mods. 2 | # There are several mandatory fields (#mandatory), and many more that are optional (#optional). 3 | # The overall format is standard TOML format, v0.5.0. 4 | # Note that there are a couple of TOML lists in this file. 5 | # Find more information on toml format here: https://github.com/toml-lang/toml 6 | 7 | modLoader="javafml" #mandatory 8 | loaderVersion="[45,)" #mandatory 9 | license="${project.mod_license}" #mandatory 10 | issueTrackerURL="${project.mod_contact_issues}" #optional 11 | 12 | # A list of mods - how many allowed here is determined by the individual mod loader 13 | [[mods]] #mandatory 14 | displayName="${project.mod_name}" #mandatory 15 | modId="${project.mod_id}" #mandatory 16 | version="${project.mod_version}" #mandatory 17 | description='''${project.mod_description}''' 18 | displayURL="${project.mod_contact_sources}" #optional 19 | authors="${project.mod_author}" #optional 20 | logoFile="${project.mod_icon}" #optional 21 | 22 | [[dependencies.nounusedchunks]] 23 | modId="forge" 24 | mandatory=true 25 | versionRange="[45,)" 26 | ordering="NONE" 27 | side="BOTH" 28 | 29 | [[dependencies.nounusedchunks]] 30 | modId="minecraft" 31 | mandatory=true 32 | versionRange="1.19.4" 33 | ordering="NONE" 34 | side="BOTH" 35 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/assets/nounusedchunks/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.19.4/src/main/resources/assets/nounusedchunks/icon.png -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/assets/nounusedchunks/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "nounusedchunks.backupprompt.removeuninhabitedchunks": "Remove uninhabited chunks", 3 | "nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip": "Removes all chunks that were never inhabited by a player.\nWhile this may reduce the world size by a lot, keep in\nmind that this may also remove chunks you might need,\nwithout actually having visited them. For example, this\nmay end up removing chunks modified by another mod or a\ntool or a program. Please back up your world before\ndoing this, and make sure the chunks got removed properly." 4 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${project.mod_id}", 4 | "version": "${project.mod_version}", 5 | 6 | "name": "${project.mod_name}", 7 | "description": "${project.mod_description}", 8 | "authors": ["${project.mod_author}"], 9 | "contact": 10 | { 11 | "homepage": "${project.mod_contact_homepage}", 12 | "sources": "${project.mod_contact_sources}", 13 | "issues": "${project.mod_contact_issues}" 14 | }, 15 | 16 | "license": "${project.mod_license}", 17 | "icon": "${mod_icon}", 18 | 19 | "environment": "client", 20 | "entrypoints": 21 | { 22 | "client": ["${project.mod_entrypoint_client}"], 23 | "server": ["${project.mod_entrypoint_server}"] 24 | }, 25 | "mixins": 26 | [ 27 | "nounusedchunks.client.mixin.events.json", 28 | "nounusedchunks.client.mixin.hooks.json", 29 | "nounusedchunks.mixin.events.json" 30 | ], 31 | 32 | "depends": 33 | { 34 | "fabricloader": ">=${project.loader_version}", 35 | "minecraft": "${project.mod_depends_minecraft}", 36 | "java": "${project.mod_depends_java}" 37 | }, 38 | 39 | "custom": 40 | { 41 | "modmenu": 42 | { 43 | "links": 44 | { 45 | "modmenu.curseforge": "${project.modmenu_link_curseforge}", 46 | "modmenu.modrinth": "${project.modmenu_link_modrinth}", 47 | "modmenu.kofi": "${project.modmenu_link_kofi}", 48 | "modmenu.youtube": "${project.modmenu_link_youtube}" 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/nounusedchunks.client.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinBackupPromptScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/nounusedchunks.client.mixin.hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.hooks", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["AccessorScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/nounusedchunks.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinWorldUpdater"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.19.4/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": 3 | { 4 | "description": { "text": "nounusedchunks resources" }, 5 | "forge:server_data_pack_format": 12, 6 | "pack_format": 13 7 | } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17, # Current Java LTS & minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-2022] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: Artifacts 39 | path: build/libs/ 40 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/.gitignore: -------------------------------------------------------------------------------- 1 | # -------------------- Eclipse IDE ------------------- 2 | .metadata 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .settings/ 11 | .loadpath 12 | .recommenders 13 | 14 | # External tool builders 15 | .externalToolBuilders/ 16 | 17 | # Locally stored "Eclipse launch configurations" 18 | *.launch 19 | 20 | # PyDev specific (Python IDE for Eclipse) 21 | *.pydevproject 22 | 23 | # CDT-specific (C/C++ Development Tooling) 24 | .cproject 25 | 26 | # CDT- autotools 27 | .autotools 28 | 29 | # Java annotation processor (APT) 30 | .factorypath 31 | 32 | # PDT-specific (PHP Development Tools) 33 | .buildpath 34 | 35 | # sbteclipse plugin 36 | .target 37 | 38 | # Tern plugin 39 | .tern-project 40 | 41 | # TeXlipse plugin 42 | .texlipse 43 | 44 | # STS (Spring Tool Suite) 45 | .springBeans 46 | 47 | # Code Recommenders 48 | .recommenders/ 49 | 50 | # Annotation Processing 51 | .apt_generated/ 52 | .apt_generated_test/ 53 | 54 | # Scala IDE specific (Scala & Java development for Eclipse) 55 | .cache-main 56 | .scala_dependencies 57 | .worksheet 58 | 59 | # Uncomment this line if you wish to ignore the project description file. 60 | # Typically, this file would be tracked if it contains build/dependency configurations: 61 | #.project 62 | 63 | # ----------------------- Java ----------------------- 64 | # Compiled class file 65 | *.class 66 | 67 | # Log file 68 | *.log 69 | 70 | # BlueJ files 71 | *.ctxt 72 | 73 | # Mobile Tools for Java (J2ME) 74 | .mtj.tmp/ 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.nar 80 | *.ear 81 | *.zip 82 | *.tar.gz 83 | *.rar 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | /.gradle/ 88 | /build/ 89 | 90 | # ----------------------- Gradle ----------------------- 91 | .gradle 92 | **/build/ 93 | !src/**/build/ 94 | 95 | # Ignore Gradle GUI config 96 | gradle-app.setting 97 | 98 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 99 | !gradle-wrapper.jar 100 | 101 | # Avoid ignore Gradle wrappper properties 102 | !gradle-wrapper.properties 103 | 104 | # Cache of project 105 | .gradletasknamecache 106 | 107 | # Eclipse Gradle plugin generated files 108 | # Eclipse Core 109 | .project 110 | # JDT-specific (Eclipse Java Development Tools) 111 | .classpath 112 | 113 | # ----------------------- Fabric ----------------------- 114 | run/ 115 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheCSDev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/build.gradle: -------------------------------------------------------------------------------- 1 | import com.google.gson.Gson 2 | import com.google.gson.reflect.TypeToken 3 | import java.lang.reflect.Type 4 | 5 | plugins 6 | { 7 | id 'fabric-loom' version '1.0-SNAPSHOT' 8 | id 'maven-publish' 9 | } 10 | 11 | sourceCompatibility = JavaVersion.VERSION_17 12 | targetCompatibility = JavaVersion.VERSION_17 13 | 14 | archivesBaseName = project.mod_id 15 | version = project.mod_version 16 | group = project.maven_group 17 | 18 | repositories 19 | { 20 | // Add repositories to retrieve artifacts from in here. 21 | // You should only use this when depending on other mods because 22 | // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. 23 | // See https://docs.gradle.org/current/userguide/declaring_repositories.html 24 | // for more information about repositories. 25 | maven { url "https://maven.shedaniel.me/" } 26 | maven { url "https://maven.terraformersmc.com/releases/" } 27 | } 28 | 29 | dependencies 30 | { 31 | // To change the versions see the gradle.properties file 32 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 33 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 34 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 35 | 36 | // Fabric API 37 | // modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 38 | // Don't forget to declare | "fabric":"*" | as a dependency in fabric.mod.json 39 | 40 | // Mod Menu 41 | modApi "com.terraformersmc:modmenu:${project.modmenu_version}" 42 | 43 | // Roughly Enough Items 44 | // modApi "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" 45 | 46 | // Uncomment the following line to enable the deprecated Fabric API modules. 47 | // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. 48 | // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" 49 | } 50 | 51 | processResources 52 | { 53 | // inputs.property "version", project.version 54 | filesMatching(["fabric.mod.json", "**/mods.toml"]) { expand project.properties } 55 | } 56 | 57 | //this task includes `MixinConfigs` metadata for the Forge platform 58 | //(it is important that this task runs AFTER the `processResources` task) 59 | task updateMixinConfigs 60 | { 61 | doLast 62 | { 63 | // 1. Read the `fabric.mod.json` file and parse the JSON. 64 | File jsonFile = file('src/main/resources/fabric.mod.json') 65 | String jsonString = jsonFile.text 66 | Gson gson = new Gson() 67 | Type type = new TypeToken>(){}.getType() 68 | Map jsonMap = gson.fromJson(jsonString, type) 69 | 70 | // Check if the `mixins` property exists 71 | if (!jsonMap.containsKey("mixins")) { return } 72 | 73 | // 2. Extract the `mixins` array and convert it to a string. 74 | List mixinList = (List) jsonMap.get("mixins") 75 | String mixinConfigs = String.join(",", mixinList) 76 | 77 | // 3. Add the resulting string to the `MixinConfigs` property in the `MANIFEST.MF` file. 78 | jar { manifest { attributes 'MixinConfigs': mixinConfigs } } 79 | } 80 | } 81 | updateMixinConfigs.mustRunAfter processResources //this task depends on that task being run first 82 | jar.dependsOn updateMixinConfigs //important to execute before the `jar` task 83 | 84 | tasks.withType(JavaCompile).configureEach 85 | { 86 | // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. 87 | it.options.release = 17 88 | } 89 | 90 | java 91 | { 92 | // Loom will automatically attach sourcesJar to a RemapSourcesJar 93 | // task and to the "build" task if it is present. 94 | // If you remove this line, sources will not be generated. 95 | withSourcesJar() 96 | 97 | // Generate Java docs. 98 | javadoc.options.addStringOption('Xdoclint:none', '-quiet') 99 | withJavadocJar() 100 | } 101 | 102 | jar 103 | { 104 | //exclude all .class files outside of the maven group 105 | def includeOnlyPackage = project.maven_group.replaceAll('\\.', '/') 106 | eachFile { fileCopyDetails -> 107 | if (fileCopyDetails.name.endsWith('.class') && !fileCopyDetails.relativePath.pathString.startsWith(includeOnlyPackage)) { 108 | fileCopyDetails.exclude() 109 | } 110 | } 111 | 112 | //handle the license file 113 | from("LICENSE") { rename { "${it}_${project.archivesBaseName}"} } 114 | } 115 | 116 | // configure the maven publication 117 | publishing 118 | { 119 | publications 120 | { 121 | mavenJava(MavenPublication) { from components.java } 122 | } 123 | 124 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 125 | repositories 126 | { 127 | // Add repositories to publish to here. 128 | // Notice: This block does NOT have the same function as the block in the top level. 129 | // The repositories here will be used for publishing your artifact, not for 130 | // retrieving dependencies. 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/develop 6 | minecraft_version=1.20.1 7 | yarn_mappings=1.20.1+build.2 8 | loader_version=0.14.21 9 | 10 | # Mod Properties 11 | # the maven group 12 | maven_group = io.github.thecsdev 13 | # the mod id as well as the archives base name 14 | mod_id = nounusedchunks 15 | 16 | mod_name = No Unused Chunks 17 | mod_description = Reduces world size by discarding unused chunks. 18 | mod_author = TheCSDev 19 | mod_version = 2.1+1.20.1 20 | 21 | mod_contact_homepage = https://github.com/TheCSDev 22 | mod_contact_sources = https://github.com/TheCSDev/mc-no-unused-chunks 23 | mod_contact_issues = https://github.com/TheCSDev/mc-no-unused-chunks/issues 24 | 25 | modmenu_link_curseforge = https://www.curseforge.com/projects/711539 26 | modmenu_link_modrinth = https://modrinth.com/mod/Eldc1g37 27 | modmenu_link_kofi = https://ko-fi.com/TheCSDev 28 | modmenu_link_youtube = https://www.youtube.com/@TheCSDev 29 | 30 | mod_license = MIT 31 | mod_icon = assets/nounusedchunks/icon.png 32 | 33 | mod_entrypoint_client = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 34 | mod_entrypoint_server = io.github.thecsdev.nounusedchunks.NoUnusedChunksFabric 35 | 36 | mod_depends_minecraft = 1.20.x 37 | mod_depends_java = >=17 38 | 39 | # Dependencies 40 | # If you choose to use any of the following mods as dependencies, 41 | # uncomment them in build.gradle, and don't forget to list them 42 | # as dependencies in fabric.mod.json 43 | fabric_version=0.83.1+1.20.1 44 | modmenu_version=7.0.1 45 | architectury_version=9.0.8 46 | rei_version=12.0.625 47 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.20.1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement 2 | { 3 | repositories 4 | { 5 | maven 6 | { 7 | name = 'Fabric' 8 | url = 'https://maven.fabricmc.net/' 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunks.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import net.minecraft.nbt.NbtCompound; 7 | import net.minecraft.nbt.NbtElement; 8 | 9 | public abstract class NoUnusedChunks extends Object 10 | { 11 | // ================================================== 12 | public static final Logger LOGGER = LoggerFactory.getLogger(getModID()); 13 | // -------------------------------------------------- 14 | static final String ModName = "No Unused Chunks"; 15 | static final String ModID = "nounusedchunks"; 16 | private static NoUnusedChunks Instance; 17 | // -------------------------------------------------- 18 | //protected final ModContainer modInfo; 19 | // ================================================== 20 | public NoUnusedChunks() 21 | { 22 | //validate instance first 23 | if(isModInitialized()) 24 | throw new IllegalStateException(getModID() + " has already been initialized."); 25 | else if(!isInstanceValid(this)) 26 | throw new UnsupportedOperationException("Invalid " + getModID() + " type: " + this.getClass().getName()); 27 | 28 | //assign instance 29 | Instance = this; 30 | //modInfo = FabricLoader.getInstance().getModContainer(getModID()).get(); 31 | 32 | //log stuff 33 | /*LOGGER.info("Initializing '" + getModName() + "' " + modInfo.getMetadata().getVersion() + 34 | " as '" + getClass().getSimpleName() + "'.");*/ 35 | LOGGER.info("Initializing '" + getModName() + "' as '" + getClass().getSimpleName() + "'."); 36 | 37 | //init stuff 38 | //TODO - Initialize common stuff here (client/dedicated-server/internal-server) 39 | } 40 | // ================================================== 41 | public static NoUnusedChunks getInstance() { return Instance; } 42 | //public ModContainer getModInfo() { return modInfo; } 43 | // -------------------------------------------------- 44 | public static String getModName() { return ModName; } 45 | public static String getModID() { return ModID; } 46 | // -------------------------------------------------- 47 | public static boolean isModInitialized() { return isInstanceValid(Instance); } 48 | private static boolean isInstanceValid(NoUnusedChunks instance) { return isServer(instance) || isClient(instance); } 49 | // -------------------------------------------------- 50 | public static boolean isServer() { return isServer(Instance); } 51 | public static boolean isClient() { return isClient(Instance); } 52 | 53 | private static boolean isServer(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; } 54 | private static boolean isClient(NoUnusedChunks arg0) { return arg0 instanceof io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; } 55 | // ================================================== 56 | /** 57 | * Returns true if a chunk is unused. 58 | *

59 | * Checks are done based off the Chunk's NBT data. 60 | * 61 | * @param chunkNbt The Chunk's {@link NbtCompound} data. 62 | */ 63 | public static boolean isChunkUnused(NbtCompound chunkNbt) 64 | { 65 | return chunkNbt.contains("InhabitedTime", NbtElement.LONG_TYPE) && 66 | chunkNbt.getLong("InhabitedTime") == 0; 67 | } 68 | // ================================================== 69 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | public final class NoUnusedChunksConfig 4 | { 5 | /** 6 | * Optimize world screen - Remove unused chunks.
7 | * Temporary variable with a temporary value. 8 | *

9 | * Indicates whether or not the user checked the "Remove uninhaited chunks" 10 | * checkbox in the "Optimize world" screen. 11 | */ 12 | public static boolean TEMP_OWS_RUC = false; 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksFabric.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import net.fabricmc.api.ClientModInitializer; 4 | import net.fabricmc.api.DedicatedServerModInitializer; 5 | 6 | /** 7 | * Fabric Mod Loader entry-points for this mod. 8 | */ 9 | public final class NoUnusedChunksFabric implements ClientModInitializer, DedicatedServerModInitializer 10 | { 11 | // ================================================== 12 | public @Override void onInitializeClient() { new io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient(); } 13 | public @Override void onInitializeServer() { new io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer(); } 14 | // ================================================== 15 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/NoUnusedChunksForge.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks; 2 | 3 | import io.github.thecsdev.nounusedchunks.client.NoUnusedChunksClient; 4 | import io.github.thecsdev.nounusedchunks.server.NoUnusedChunksServer; 5 | import net.minecraftforge.fml.common.Mod; 6 | import net.minecraftforge.fml.loading.FMLEnvironment; 7 | 8 | /** 9 | * Forge Mod Loader entry-points for this mod. 10 | */ 11 | @Mod(NoUnusedChunks.ModID) 12 | public final class NoUnusedChunksForge 13 | { 14 | // ================================================== 15 | public NoUnusedChunksForge() 16 | { 17 | //*literal black magic...* 18 | //(it's amazing this actually works) 19 | if(FMLEnvironment.dist.isClient()) 20 | new NoUnusedChunksClient(); 21 | else if(FMLEnvironment.dist.isDedicatedServer()) 22 | new NoUnusedChunksServer(); 23 | } 24 | // ================================================== 25 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/client/NoUnusedChunksClient.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksClient extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksClient() 9 | { 10 | //TODO - Initialize client-side-only stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/client/gui/widgets/ActionCheckboxWidget.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.gui.widgets; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import net.minecraft.client.gui.widget.CheckboxWidget; 6 | import net.minecraft.text.Text; 7 | 8 | public class ActionCheckboxWidget extends CheckboxWidget 9 | { 10 | // -------------------------------------------------- 11 | public final Consumer callback; 12 | // -------------------------------------------------- 13 | public ActionCheckboxWidget( 14 | int x, int y, int width, int height, 15 | Text message, boolean checked, boolean showMessage, 16 | Consumer callback) 17 | { 18 | super(x, y, width, height, message, checked, showMessage); 19 | this.callback = callback; 20 | } 21 | // -------------------------------------------------- 22 | public @Override void onPress() 23 | { 24 | super.onPress(); 25 | if(this.callback != null) 26 | this.callback.accept(this); 27 | } 28 | // -------------------------------------------------- 29 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/addons/AddonBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.addons; 2 | 3 | public interface AddonBackupPromptScreen 4 | { 5 | public boolean nounusedchunks_getRemoveUnusedChunks(); 6 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/events/MixinBackupPromptScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.events; 2 | 3 | import static io.github.thecsdev.nounusedchunks.NoUnusedChunksConfig.TEMP_OWS_RUC; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import io.github.thecsdev.nounusedchunks.client.gui.widgets.ActionCheckboxWidget; 13 | import io.github.thecsdev.nounusedchunks.client.mixin.addons.AddonBackupPromptScreen; 14 | import io.github.thecsdev.nounusedchunks.client.mixin.hooks.AccessorScreen; 15 | import net.minecraft.client.gui.screen.BackupPromptScreen; 16 | import net.minecraft.client.gui.screen.Screen; 17 | import net.minecraft.client.gui.tooltip.Tooltip; 18 | import net.minecraft.client.gui.widget.CheckboxWidget; 19 | import net.minecraft.client.gui.widget.ClickableWidget; 20 | import net.minecraft.text.Text; 21 | 22 | @Mixin(BackupPromptScreen.class) 23 | public abstract class MixinBackupPromptScreen extends Screen implements AddonBackupPromptScreen 24 | { 25 | // ================================================== 26 | protected MixinBackupPromptScreen(Text title) { super(title); } 27 | // ================================================== 28 | private @Unique ActionCheckboxWidget nounusedchunks_removeUnusedChunksCheckbox; 29 | // -------------------------------------------------- 30 | @Accessor("showEraseCacheCheckbox") 31 | public abstract boolean getShowEraseCacheCheckbox(); 32 | 33 | @Accessor("eraseCacheCheckbox") 34 | public abstract CheckboxWidget getEraseCacheCheckbox(); 35 | // ================================================== 36 | @Inject(method = "init", at = @At("TAIL")) 37 | public void init(CallbackInfo callback) 38 | { 39 | //define fields 40 | TEMP_OWS_RUC = false; //HIGHLY IMPORTANT TO RESET THE FLAG - PREVENTS POTENTIAL CORRUPTIONS AND ERRORS 41 | final int i = getEraseCacheCheckbox().getY(), j = getEraseCacheCheckbox().getHeight() + 5; 42 | 43 | //define the check-box 44 | nounusedchunks_removeUnusedChunksCheckbox = new ActionCheckboxWidget( 45 | this.width / 2 - 155 + 80, i + j, //x and y 46 | 250, 20, //width and height 47 | Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks"), //text 48 | TEMP_OWS_RUC, //current value 49 | true, //show message 50 | checkbox -> TEMP_OWS_RUC = checkbox.isChecked()); //on-click 51 | 52 | nounusedchunks_removeUnusedChunksCheckbox.setTooltip( 53 | Tooltip.of(Text.translatable("nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip"))); 54 | 55 | //if showing the check-boxes, add the check-box below the 56 | //vanilla one, and move the buttons down 57 | if(getShowEraseCacheCheckbox()) 58 | { 59 | //add the check-box 60 | addDrawableChild(nounusedchunks_removeUnusedChunksCheckbox); 61 | 62 | //move the stuff below it a bit down 63 | ((AccessorScreen)(Object)this).getDrawables().forEach(drawable -> 64 | { 65 | //ignore non-clickables 66 | //ignore the removeUnusedChunks checkbox 67 | if(!(drawable instanceof ClickableWidget) || drawable == nounusedchunks_removeUnusedChunksCheckbox) 68 | return; 69 | ClickableWidget cw = (ClickableWidget)drawable; 70 | 71 | //ignore above ones 72 | if(cw.getY() < nounusedchunks_removeUnusedChunksCheckbox.getY() - 5) 73 | return; 74 | 75 | //move a bit down 76 | cw.setY(cw.getY() + j + 10); 77 | }); 78 | } 79 | } 80 | // ================================================== 81 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/client/mixin/hooks/AccessorScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.client.mixin.hooks; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import net.minecraft.client.gui.Drawable; 9 | import net.minecraft.client.gui.screen.Screen; 10 | 11 | @Mixin(Screen.class) 12 | public interface AccessorScreen 13 | { 14 | @Accessor("drawables") 15 | public abstract List getDrawables(); 16 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/io/github/thecsdev/nounusedchunks/server/NoUnusedChunksServer.java: -------------------------------------------------------------------------------- 1 | package io.github.thecsdev.nounusedchunks.server; 2 | 3 | import io.github.thecsdev.nounusedchunks.NoUnusedChunks; 4 | 5 | public final class NoUnusedChunksServer extends NoUnusedChunks 6 | { 7 | // ================================================== 8 | public NoUnusedChunksServer() 9 | { 10 | //TODO - Initialize dedicated-server-side stuff here 11 | } 12 | // ================================================== 13 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/net/minecraftforge/api/distmarker/Dist.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.api.distmarker; 2 | 3 | public class Dist 4 | { 5 | public boolean isClient() { return isDedicatedServer(); } 6 | public boolean isDedicatedServer() { throw new AssertionError("Nope."); } 7 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/net/minecraftforge/fml/common/Mod.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.common; 2 | 3 | import static java.lang.annotation.ElementType.TYPE; 4 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.Target; 8 | 9 | @Retention(RUNTIME) 10 | @Target(TYPE) 11 | public @interface Mod 12 | { 13 | String value(); 14 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java: -------------------------------------------------------------------------------- 1 | package net.minecraftforge.fml.loading; 2 | 3 | import net.minecraftforge.api.distmarker.Dist; 4 | 5 | public class FMLEnvironment 6 | { 7 | public static final Dist dist = new Dist(); 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/java/readme.txt: -------------------------------------------------------------------------------- 1 | In `gradle.properties`, there's a property that looks like this: 2 | maven_group = io.github.thecsdev 3 | 4 | In `build.gradle`, the project has been configured to discard all `.class` 5 | files outside of the `maven_group`. This means that packages such as 6 | `net.minecraftforge` are only there during "compile-time", and not "run-time". 7 | This allows the mod to be written in a way that allows it to interact with 8 | Minecraft Forge, without Forge actually being present. 9 | 10 | # Important node: 11 | Because of this, all `.class` files created outside of the `maven_group` will 12 | be discarded once the jar file is compiled aka built! -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | # This is an example mods.toml file. It contains the data relating to the loading mods. 2 | # There are several mandatory fields (#mandatory), and many more that are optional (#optional). 3 | # The overall format is standard TOML format, v0.5.0. 4 | # Note that there are a couple of TOML lists in this file. 5 | # Find more information on toml format here: https://github.com/toml-lang/toml 6 | 7 | modLoader="javafml" #mandatory 8 | loaderVersion="[46,)" #mandatory 9 | license="${project.mod_license}" #mandatory 10 | issueTrackerURL="${project.mod_contact_issues}" #optional 11 | 12 | # A list of mods - how many allowed here is determined by the individual mod loader 13 | [[mods]] #mandatory 14 | displayName="${project.mod_name}" #mandatory 15 | modId="${project.mod_id}" #mandatory 16 | version="${project.mod_version}" #mandatory 17 | description='''${project.mod_description}''' 18 | displayURL="${project.mod_contact_sources}" #optional 19 | authors="${project.mod_author}" #optional 20 | logoFile="${project.mod_icon}" #optional 21 | 22 | [[dependencies.nounusedchunks]] 23 | modId="forge" 24 | mandatory=true 25 | versionRange="[46,)" 26 | ordering="NONE" 27 | side="BOTH" 28 | 29 | [[dependencies.nounusedchunks]] 30 | modId="minecraft" 31 | mandatory=true 32 | versionRange="[1.20,1.20.2)" 33 | ordering="NONE" 34 | side="BOTH" 35 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/assets/nounusedchunks/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCSMods/mc-no-unused-chunks/aa145ec1c8022940288454d9b587f9255a177bef/nounusedchunks-2-fabric-1.20.1/src/main/resources/assets/nounusedchunks/icon.png -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/assets/nounusedchunks/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "nounusedchunks.backupprompt.removeuninhabitedchunks": "Remove uninhabited chunks", 3 | "nounusedchunks.backupprompt.removeuninhabitedchunks.tooltip": "Removes all chunks that were never inhabited by a player.\nWhile this may reduce the world size by a lot, keep in\nmind that this may also remove chunks you might need,\nwithout actually having visited them. For example, this\nmay end up removing chunks modified by another mod or a\ntool or a program. Please back up your world before\ndoing this, and make sure the chunks got removed properly." 4 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${project.mod_id}", 4 | "version": "${project.mod_version}", 5 | 6 | "name": "${project.mod_name}", 7 | "description": "${project.mod_description}", 8 | "authors": ["${project.mod_author}"], 9 | "contact": 10 | { 11 | "homepage": "${project.mod_contact_homepage}", 12 | "sources": "${project.mod_contact_sources}", 13 | "issues": "${project.mod_contact_issues}" 14 | }, 15 | 16 | "license": "${project.mod_license}", 17 | "icon": "${mod_icon}", 18 | 19 | "environment": "client", 20 | "entrypoints": 21 | { 22 | "client": ["${project.mod_entrypoint_client}"], 23 | "server": ["${project.mod_entrypoint_server}"] 24 | }, 25 | "mixins": 26 | [ 27 | "nounusedchunks.client.mixin.events.json", 28 | "nounusedchunks.client.mixin.hooks.json", 29 | "nounusedchunks.mixin.events.json" 30 | ], 31 | 32 | "depends": 33 | { 34 | "fabricloader": ">=${project.loader_version}", 35 | "minecraft": "${project.mod_depends_minecraft}", 36 | "java": "${project.mod_depends_java}" 37 | }, 38 | 39 | "custom": 40 | { 41 | "modmenu": 42 | { 43 | "links": 44 | { 45 | "modmenu.curseforge": "${project.modmenu_link_curseforge}", 46 | "modmenu.modrinth": "${project.modmenu_link_modrinth}", 47 | "modmenu.kofi": "${project.modmenu_link_kofi}", 48 | "modmenu.youtube": "${project.modmenu_link_youtube}" 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/nounusedchunks.client.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinBackupPromptScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/nounusedchunks.client.mixin.hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.client.mixin.hooks", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["AccessorScreen"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/nounusedchunks.mixin.events.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.thecsdev.nounusedchunks.mixin.events", 5 | "compatibilityLevel": "JAVA_17", 6 | "client": ["MixinWorldUpdater"], 7 | "injectors": { "defaultRequire": 1 } 8 | } -------------------------------------------------------------------------------- /nounusedchunks-2-fabric-1.20.1/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": 3 | { 4 | "description": { "text": "nounusedchunks resources" }, 5 | "pack_format": 15 6 | } 7 | } --------------------------------------------------------------------------------