├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java └── com │ └── github │ └── quiltservertools │ └── ticktools │ ├── TickTools.java │ ├── TickToolsConfig.java │ ├── TickToolsManager.java │ ├── command │ ├── BuildableCommand.java │ ├── StatusCommand.java │ └── TickToolsCommand.java │ └── mixin │ ├── MixinItemEntity.java │ ├── MixinServerPlayerEntity.java │ ├── MixinServerWorld.java │ └── MixinThreadedAnvilChunkStorage.java └── resources ├── assets └── ticktools │ └── icon.png ├── default_config.toml ├── fabric.mod.json └── ticktools.mixins.json /.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 | 16 # Minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-latest] 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 == '16' }} # 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # eclipse 9 | 10 | *.launch 11 | 12 | # idea 13 | 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | 19 | # vscode 20 | 21 | .settings/ 22 | .vscode/ 23 | bin/ 24 | .classpath 25 | .project 26 | 27 | # macos 28 | 29 | *.DS_Store 30 | 31 | # fabric 32 | 33 | run/ 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 QuiltServerTools 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TickTools 2 | A Minecraft mod for managing tick-related things 3 | 4 | [![discord](https://img.shields.io/discord/764543203772334100?label=discord)](https://discord.gg/UxHnDWr) 5 | ## Config 6 | 7 | ```toml 8 | # Required options 9 | splitTickDistance = false 10 | # Required if relevant config option above is enabled 11 | tickDistance = 8 12 | 13 | [dynamic] 14 | dynamicTickDistance = false 15 | minTickDistance = 4 16 | dynamicRenderDistance = false 17 | minRenderDistance = 4 18 | maxRenderDistance = 12 19 | # This value controls the MSPT used to target 20 | targetMSPT = 50.0 21 | 22 | # Optional 23 | 24 | itemDespawnTicks = 6000 25 | 26 | # Example config for world specific 27 | # Uncomment to use 28 | #[the_nether] 29 | #splitTickDistance = true 30 | #tickDistance = 8 31 | #itemDespawnTicks = 6000 32 | 33 | #[the_nether.dynamic] 34 | # dynamicTickDistance = false 35 | # minTickDistance = 4 36 | # dynamicRenderDistance = false 37 | # minRenderDistance = 4 38 | # maxRenderDistance = 12 39 | 40 | ``` 41 | 42 | #### Quick overview of each config option 43 | 44 | `splitTickDistance` controls whether you want to have a separate tick distance from your render distance 45 | 46 | `tickDistance` controls your normal tick distance if `splitTickDistance` is enabled 47 | 48 | `itemDespawnTicks` controls the number of ticks an item entity will take to despawn after being dropped. Vanilla is 6000 ticks 49 | 50 | `dynamicTickDistance` controls whether the tick distance should fluctuate between `tickDistance` and `minTickDistance` depending on server MSPT 51 | 52 | `minTickDistance` controls the minimum value the tick distance will be if `dynamicTickDistance 53 | is enabled 54 | 55 | `dynamicRenderDistance` controls whether the render distance should fluctuate between `minRenderDistance` and `maxRenderDistance` depending on server MSPT 56 | 57 | `minRenderDistance` controls the minimum render distance when `dynamicRenderDistance` is enabled 58 | 59 | `maxRenderDistance` controls the maximum render distance when `dynamicRenderDistance` is enabled 60 | 61 | `targetMSPT` is the MSPT that the server will reduce the render distance to try and achieve, when dynamic render distance is enabled 62 | 63 | 64 | ## Commands 65 | 66 | ### Status Command 67 | 68 | `/ticktools status` 69 | 70 | Shows the current tick and render distances of all loaded worlds in the following format: 71 | 72 | `World identifier: Render/Tick` 73 | 74 | ## Discuss 75 | 76 | Support, discussion and development takes place on our discord, found at [https://discord.gg/UxHnDWr](https://discord.gg/UxHnDWr) 77 | 78 | You can also sign up for release pings there should you be interested 79 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'fabric-loom' version '0.8-SNAPSHOT' 3 | id 'maven-publish' 4 | id 'com.github.johnrengelman.shadow' version '7.0.0' 5 | } 6 | 7 | sourceCompatibility = JavaVersion.VERSION_16 8 | targetCompatibility = JavaVersion.VERSION_16 9 | 10 | archivesBaseName = project.archives_base_name 11 | version = project.mod_version 12 | group = project.maven_group 13 | 14 | repositories { 15 | maven { 16 | name = "JitPack" 17 | url = "https://jitpack.io" 18 | } 19 | mavenCentral() 20 | maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } 21 | maven { 22 | url = "https://api.modrinth.com/maven" 23 | content { 24 | includeGroup "maven.modrinth" 25 | } 26 | } 27 | } 28 | 29 | dependencies { 30 | // To change the versions see the gradle.properties file 31 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 32 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 33 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 34 | 35 | // Fabric API. This is technically optional, but you probably want it anyway. 36 | modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 37 | 38 | include(modImplementation("me.lucko:fabric-permissions-api:0.1-SNAPSHOT")) 39 | 40 | implementation(include("com.moandjiezana.toml:toml4j:0.7.2")) 41 | 42 | modRuntime ("com.github.SuperCoder7979:databreaker:0.2.6") { 43 | exclude module: "fabric-loader" 44 | } 45 | 46 | modRuntime("maven.modrinth:lithium:mc1.17.1-0.7.4") 47 | } 48 | 49 | processResources { 50 | inputs.property "version", project.version 51 | 52 | filesMatching("fabric.mod.json") { 53 | expand "version": project.version 54 | } 55 | } 56 | 57 | tasks.withType(JavaCompile).configureEach { 58 | // ensure that the encoding is set to UTF-8, no matter what the system default is 59 | // this fixes some edge cases with special characters not displaying correctly 60 | // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html 61 | // If Javadoc is generated, this must be specified in that task too. 62 | it.options.encoding = "UTF-8" 63 | 64 | // Minecraft 1.17 (21w19a) upwards uses Java 16. 65 | it.options.release = 16 66 | } 67 | 68 | java { 69 | // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task 70 | // if it is present. 71 | // If you remove this line, sources will not be generated. 72 | withSourcesJar() 73 | } 74 | 75 | jar { 76 | from("LICENSE") { 77 | rename { "${it}_${project.archivesBaseName}"} 78 | } 79 | } 80 | 81 | // configure the maven publication 82 | publishing { 83 | publications { 84 | mavenJava(MavenPublication) { 85 | // add all the jars that should be included when publishing to maven 86 | artifact(remapJar) { 87 | builtBy remapJar 88 | } 89 | artifact(sourcesJar) { 90 | builtBy remapSourcesJar 91 | } 92 | } 93 | } 94 | 95 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 96 | repositories { 97 | // Add repositories to publish to here. 98 | // Notice: This block does NOT have the same function as the block in the top level. 99 | // The repositories here will be used for publishing your artifact, not for 100 | // retrieving dependencies. 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /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/use 6 | minecraft_version=1.17.1 7 | yarn_mappings=1.17.1+build.9 8 | loader_version=0.11.6 9 | 10 | # Mod Properties 11 | mod_version = 1.1.0 12 | maven_group = com.github.quiltservertools 13 | archives_base_name = ticktools 14 | 15 | # Dependencies 16 | fabric_version=0.37.1+1.17 17 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuiltServerTools/TickTools/130b5b3146531ae32a98b6a12a9ef1e0d0e48725/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or 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 UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | gradlePluginPortal() 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/TickTools.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools; 2 | 3 | import com.github.quiltservertools.ticktools.command.TickToolsCommand; 4 | import net.fabricmc.api.DedicatedServerModInitializer; 5 | import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; 6 | import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; 7 | import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents; 8 | import net.fabricmc.fabric.api.networking.v1.PacketSender; 9 | import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; 10 | import net.fabricmc.loader.api.FabricLoader; 11 | import net.minecraft.server.MinecraftServer; 12 | import net.minecraft.server.network.ServerPlayNetworkHandler; 13 | import net.minecraft.server.world.ServerWorld; 14 | import org.apache.logging.log4j.LogManager; 15 | import org.apache.logging.log4j.Logger; 16 | 17 | import java.io.File; 18 | import java.util.HashMap; 19 | 20 | public class TickTools implements DedicatedServerModInitializer { 21 | public static Logger LOGGER; 22 | private final File configFile = FabricLoader.getInstance().getConfigDir().resolve("ticktools.toml").toFile(); 23 | 24 | @Override 25 | public void onInitializeServer() { 26 | ServerLifecycleEvents.SERVER_STARTING.register(this::onServerStart); 27 | ServerWorldEvents.LOAD.register(this::onWorldLoad); 28 | ServerWorldEvents.UNLOAD.register(this::onWorldUnload); 29 | ServerPlayConnectionEvents.JOIN.register(this::onPlayerConnect); 30 | CommandRegistrationCallback.EVENT.register(TickToolsCommand::registerCommands); 31 | } 32 | 33 | private void onServerStart(MinecraftServer server) { 34 | LOGGER = LogManager.getLogger(); 35 | var config = TickToolsConfig.loadConfig(configFile); 36 | 37 | // Empty map for world specific distances 38 | // These are added on world load rather than on server start 39 | TickToolsManager.setInstance(new TickToolsManager(config, new HashMap<>(), new HashMap<>())); 40 | } 41 | 42 | private void onWorldLoad(MinecraftServer server, ServerWorld world) { 43 | var identifier = world.getRegistryKey().getValue(); 44 | var table = TickToolsManager.getInstance().config().toml.getTable(identifier.getPath()); 45 | 46 | var config = TickToolsManager.getInstance().config(); 47 | // If table isn't null then we know that it exists 48 | if (table != null) { 49 | config = new TickToolsConfig(); 50 | config.readToml(table); 51 | TickToolsManager.getInstance().worldSpecific().put(identifier, config); 52 | } 53 | 54 | if (config.dynamic.renderDistance) 55 | world.getChunkManager().applyViewDistance(config.dynamic.minRenderDistance); 56 | } 57 | 58 | private void onWorldUnload(MinecraftServer server, ServerWorld world) { 59 | TickToolsManager.getInstance().worldSpecific().remove(world.getRegistryKey().getValue()); 60 | } 61 | 62 | private void onPlayerConnect(ServerPlayNetworkHandler handler, PacketSender sender, MinecraftServer server) { 63 | var table = TickToolsManager.getInstance().config().toml.getTable(handler.player.getUuidAsString()); 64 | 65 | // If table isn't null then we know that it exists 66 | if (table != null) { 67 | var config = new TickToolsConfig(); 68 | config.readToml(table); 69 | TickToolsManager.getInstance().playerSpecific().put(handler.player.getUuid(), config); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/TickToolsConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools; 2 | 3 | import com.moandjiezana.toml.Toml; 4 | import net.minecraft.util.Identifier; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | import java.util.Objects; 12 | 13 | import net.fabricmc.loader.api.FabricLoader; 14 | 15 | public class TickToolsConfig { 16 | 17 | public boolean splitTickDistance = true; 18 | public int tickDistance = 2; 19 | public int itemDespawnTicks = 6000; 20 | public Map customItemValues = new HashMap<>(); 21 | 22 | public TickToolsConfig.Dynamic dynamic = new Dynamic(); 23 | public Toml toml; 24 | 25 | public static class Dynamic { 26 | public boolean tickDistance; 27 | public boolean renderDistance; 28 | public int minTickDistance = 4; 29 | public int minRenderDistance = 8; 30 | public int maxRenderDistance = 12; 31 | public double targetMSPT = 50; 32 | 33 | public int getMinTickDistanceBlocks() { 34 | return minTickDistance * 16; 35 | } 36 | 37 | public int getMinRenderDistanceBlocks() { 38 | return minRenderDistance * 16; 39 | } 40 | 41 | public int getMaxRenderDistanceBlocks() { 42 | return maxRenderDistance * 16; 43 | } 44 | } 45 | 46 | public int getTickDistanceBlocks() { 47 | return tickDistance * 16; 48 | } 49 | 50 | public static TickToolsConfig loadConfig(File file) { 51 | TickToolsConfig config = new TickToolsConfig(); 52 | if (!(file.exists() && file.isFile())) { 53 | TickTools.LOGGER.info("Unable to find config file for TickTools, creating"); 54 | try { 55 | Files.copy(FabricLoader.getInstance().getModContainer("ticktools").get().getPath("default_config.toml"), file.toPath()); 56 | } catch (IOException e) { 57 | TickTools.LOGGER.warn("Unable to create config file for TickTools, using default configuration"); 58 | } 59 | } 60 | config.readToml(new Toml().read(file)); 61 | 62 | // Config is default config 63 | return config; 64 | } 65 | 66 | protected void readToml(Toml toml) { 67 | 68 | /* 69 | Required config options 70 | These must be present 71 | */ 72 | 73 | this.splitTickDistance = toml.getBoolean("splitTickDistance"); 74 | 75 | /* 76 | Parsing of additional values 77 | */ 78 | 79 | if (splitTickDistance) { 80 | this.tickDistance = toml.getLong("tickDistance").intValue(); 81 | } 82 | 83 | /* 84 | Optional config options 85 | Must contain default value 86 | */ 87 | if (toml.containsTable("dynamic")) { 88 | Toml dynamicTable = toml.getTable("dynamic"); 89 | readDynamicTable(dynamicTable); 90 | } 91 | 92 | if (toml.contains("itemDespawnTicks")) { 93 | this.itemDespawnTicks = toml.getLong("itemDespawnTicks").intValue(); 94 | } 95 | 96 | this.toml = toml; 97 | } 98 | 99 | private void readDynamicTable(Toml dynamicTable) { 100 | this.dynamic.tickDistance = dynamicTable.getBoolean("dynamicTickDistance"); 101 | if (dynamic.tickDistance) { 102 | dynamic.minTickDistance = dynamicTable.getLong("minTickDistance").intValue(); 103 | } 104 | this.dynamic.renderDistance = dynamicTable.getBoolean("dynamicRenderDistance"); 105 | if (dynamic.renderDistance) { 106 | dynamic.minRenderDistance = dynamicTable.getLong("minRenderDistance").intValue(); 107 | dynamic.maxRenderDistance = dynamicTable.getLong("maxRenderDistance").intValue(); 108 | } 109 | if (dynamicTable.contains("targetMSPT")) { 110 | dynamic.targetMSPT = dynamicTable.getDouble("targetMSPT"); 111 | } 112 | } 113 | } 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/TickToolsManager.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools; 2 | 3 | import com.github.quiltservertools.ticktools.mixin.MixinThreadedAnvilChunkStorage; 4 | import net.minecraft.entity.ItemEntity; 5 | import net.minecraft.network.packet.s2c.play.ChunkLoadDistanceS2CPacket; 6 | import net.minecraft.server.world.ServerWorld; 7 | import net.minecraft.util.Identifier; 8 | import net.minecraft.util.math.ChunkPos; 9 | import net.minecraft.util.math.MathHelper; 10 | 11 | import java.util.Map; 12 | import java.util.UUID; 13 | 14 | public record TickToolsManager(TickToolsConfig config, Map worldSpecific, 15 | Map playerSpecific) { 16 | 17 | private static TickToolsManager instance; 18 | 19 | public static TickToolsManager getInstance() { 20 | return instance; 21 | } 22 | 23 | public static void setInstance(TickToolsManager manager) { 24 | instance = manager; 25 | } 26 | 27 | public boolean shouldTickChunk(ChunkPos pos, ServerWorld world) { 28 | // If chunk is force-loaded we return true 29 | if (world.getForcedChunks().contains(pos.toLong())) return true; 30 | // First we get the right config, so checking if worldSpecific contains the dimension 31 | var effectiveConfig = worldSpecific().get(world.getRegistryKey().getValue()); 32 | if (effectiveConfig == null) effectiveConfig = this.config(); 33 | 34 | // Ignore tick distance value if split tick distance is disabled 35 | if (!effectiveConfig.splitTickDistance) return true; 36 | int tickDistance = getEffectiveTickDistance(world); 37 | var player = world.getClosestPlayer(pos.getCenterX(), 64, pos.getCenterZ(), world.getHeight() + tickDistance, false); 38 | if (player != null) { 39 | if (playerSpecific.containsKey(player.getUuid())) { 40 | return pos.getChebyshevDistance(player.getChunkPos()) <= playerSpecific.get(player.getUuid()).tickDistance; 41 | } else { 42 | // The closest player on the server is within the tick distance provided by the config 43 | return pos.getChebyshevDistance(player.getChunkPos()) <= tickDistance; 44 | // If player is not found within distance then use default return value 45 | } 46 | } 47 | return false; 48 | } 49 | 50 | public int getItemDespawnTime(ItemEntity item) { 51 | var player = item.getEntityWorld().getClosestPlayer(item.getX(), item.getY(), item.getZ(), item.getEntityWorld().getHeight(), false); 52 | if (player != null) { 53 | if (this.playerSpecific().containsKey(player.getUuid())) { 54 | return this.playerSpecific().get(player.getUuid()).itemDespawnTicks; 55 | } 56 | } 57 | if (this.worldSpecific().containsKey(item.getEntityWorld().getRegistryKey().getValue())) { 58 | return this.worldSpecific().get(item.getEntityWorld().getRegistryKey().getValue()).itemDespawnTicks; 59 | } 60 | return this.config().itemDespawnTicks; 61 | } 62 | 63 | public void updateRenderDistance(ServerWorld world) { 64 | var config = worldSpecific().get(world.getRegistryKey().getValue()); 65 | if (config == null) config = this.config(); 66 | if (config.dynamic.renderDistance) { 67 | int distance = getEffectiveRenderDistance(world, true); 68 | if (((MixinThreadedAnvilChunkStorage) world.getChunkManager().threadedAnvilChunkStorage).getWatchDistance() != distance) { 69 | world.getChunkManager().applyViewDistance(distance - 1); 70 | world.getServer().getPlayerManager().sendToAll(new ChunkLoadDistanceS2CPacket(distance - 1)); 71 | } 72 | } 73 | } 74 | 75 | public int getEffectiveTickDistance(ServerWorld world) { 76 | //TODO cache these values 77 | float time = world.getServer().getTickTime(); 78 | int performanceLevel = getPerformanceLevel(time); 79 | 80 | var config = worldSpecific().get(world.getRegistryKey().getValue()); 81 | if (config == null) config = this.config(); 82 | 83 | if (config.dynamic.tickDistance) { 84 | var distance = config.getTickDistanceBlocks(); 85 | if (performanceLevel == 3) distance = config.dynamic.getMinTickDistanceBlocks(); 86 | else if (performanceLevel == 2) 87 | distance = Math.min((int) (config.getTickDistanceBlocks() / 1.5F), (int) (config.getTickDistanceBlocks() * 1.5F)); 88 | else if (performanceLevel == 1) 89 | distance = Math.max((int) (config.getTickDistanceBlocks() / 1.5F), (int) (config.getTickDistanceBlocks() * 1.5F)); 90 | else distance = config.getTickDistanceBlocks(); 91 | return distance; 92 | } 93 | return config.tickDistance; 94 | } 95 | 96 | public int getEffectiveRenderDistance(ServerWorld world, boolean messages) { 97 | var config = worldSpecific().get(world.getRegistryKey().getValue()); 98 | if (config == null) config = this.config(); 99 | 100 | if (config.dynamic.renderDistance) { 101 | if (world.getPlayers().isEmpty()) return getWatchDistance(world); 102 | var currentDistance = getWatchDistance(world); 103 | 104 | var avgTickTime = MathHelper.average(world.getServer().lastTickLengths) * 1.0E-6D; 105 | 106 | if (avgTickTime > config.dynamic.targetMSPT && currentDistance - 1 > config.dynamic.minTickDistance) { 107 | currentDistance--; 108 | if (messages) { 109 | TickTools.LOGGER.info(String.format("Avg MSPT: %.2f above %d. Decreasing view distance in %s to %d", 110 | // We cast target MSPT to int to make it look better 111 | // In reality this value is a double, like in the config 112 | avgTickTime, (int) config.dynamic.targetMSPT, world.getRegistryKey().getValue(), currentDistance - 1 113 | )); 114 | } 115 | } else if (avgTickTime < config.dynamic.targetMSPT && currentDistance - 1 < config.dynamic.maxRenderDistance) { 116 | currentDistance++; 117 | if (messages) { 118 | TickTools.LOGGER.info(String.format("Avg MSPT: %.2f below %d. Increasing view distance in %s to to %d", 119 | avgTickTime, (int) config.dynamic.targetMSPT, world.getRegistryKey().getValue(), currentDistance - 1 120 | )); 121 | } 122 | } 123 | 124 | return currentDistance; 125 | } 126 | return getWatchDistance(world); 127 | } 128 | 129 | private int getPerformanceLevel(float time) { 130 | if (time > 40F) return 3; 131 | else if (time > 32F) return 2; 132 | else if (time > 25F) return 1; 133 | return 1; 134 | } 135 | 136 | private int getWatchDistance(ServerWorld world) { 137 | return ((MixinThreadedAnvilChunkStorage) world.getChunkManager().threadedAnvilChunkStorage).getWatchDistance(); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/command/BuildableCommand.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.command; 2 | 3 | import com.mojang.brigadier.tree.LiteralCommandNode; 4 | import net.minecraft.server.command.ServerCommandSource; 5 | 6 | public interface BuildableCommand { 7 | LiteralCommandNode build(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/command/StatusCommand.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.command; 2 | 3 | import com.github.quiltservertools.ticktools.TickToolsManager; 4 | import com.mojang.brigadier.context.CommandContext; 5 | import com.mojang.brigadier.tree.LiteralCommandNode; 6 | import net.minecraft.server.command.CommandManager; 7 | import net.minecraft.server.command.ServerCommandSource; 8 | import net.minecraft.text.LiteralText; 9 | import net.minecraft.util.registry.Registry; 10 | import net.minecraft.util.registry.RegistryKey; 11 | 12 | import java.util.Objects; 13 | 14 | public class StatusCommand implements BuildableCommand { 15 | @Override 16 | public LiteralCommandNode build() { 17 | return CommandManager.literal("status") 18 | .executes(ctx -> { 19 | prepareMessage(ctx); 20 | return 1; 21 | }) 22 | .build(); 23 | } 24 | 25 | private void prepareMessage(CommandContext context) { 26 | var source = context.getSource(); 27 | source.sendFeedback(new LiteralText("--- TickTools Status ---\n").formatted(TickToolsCommand.HEADING), false); 28 | source.sendFeedback(new LiteralText("Default distances: ").formatted(TickToolsCommand.PRIMARY) 29 | .append(new LiteralText("" + TickToolsManager.getInstance().getEffectiveRenderDistance(context.getSource().getServer().getOverworld(), false) 30 | + "/" + TickToolsManager.getInstance().getEffectiveTickDistance(context.getSource().getServer().getOverworld()) + "\n") 31 | .formatted(TickToolsCommand.SECONDARY)), false); 32 | TickToolsManager.getInstance().worldSpecific().forEach(((identifier, tickToolsConfig) -> { 33 | var key = new LiteralText(identifier.toString() + ":").formatted(TickToolsCommand.PRIMARY); 34 | var worldKey = Objects.requireNonNull(context.getSource().getServer().getWorld(RegistryKey.of(Registry.WORLD_KEY, identifier))); 35 | var render = TickToolsManager.getInstance().getEffectiveRenderDistance(worldKey, false); 36 | var tick = TickToolsManager.getInstance().getEffectiveTickDistance(worldKey); 37 | var value = new LiteralText("" + render + "/" + tick + "\n").formatted(TickToolsCommand.SECONDARY); 38 | source.sendFeedback(key.append(value), false); 39 | })); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/command/TickToolsCommand.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.command; 2 | 3 | import com.mojang.brigadier.CommandDispatcher; 4 | import me.lucko.fabric.api.permissions.v0.Permissions; 5 | import net.minecraft.server.command.CommandManager; 6 | import net.minecraft.server.command.ServerCommandSource; 7 | import net.minecraft.util.Formatting; 8 | 9 | public class TickToolsCommand { 10 | 11 | public static final Formatting PRIMARY = Formatting.GRAY; 12 | public static final Formatting SECONDARY = Formatting.BLUE; 13 | public static final Formatting HEADING = Formatting.AQUA; 14 | 15 | public static void registerCommands(CommandDispatcher dispatcher, boolean dedicated) { 16 | var node = CommandManager.literal("ticktools").requires(Permissions.require("ticktools.root", 3)).build(); 17 | node.addChild(new StatusCommand().build()); 18 | dispatcher.getRoot().addChild(node); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/mixin/MixinItemEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.mixin; 2 | 3 | import com.github.quiltservertools.ticktools.TickToolsManager; 4 | import net.minecraft.entity.ItemEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.Constant; 7 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 8 | 9 | @Mixin(ItemEntity.class) 10 | public class MixinItemEntity { 11 | @ModifyConstant(method = "tick", constant = @Constant(intValue = 6000)) 12 | public int ticktools$setMaximumDespawnValue(int i) { 13 | return TickToolsManager.getInstance().getItemDespawnTime((ItemEntity)(Object) this); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/mixin/MixinServerPlayerEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.mixin; 2 | 3 | import com.github.quiltservertools.ticktools.TickToolsManager; 4 | import net.minecraft.network.packet.s2c.play.ChunkLoadDistanceS2CPacket; 5 | import net.minecraft.server.network.ServerPlayerEntity; 6 | import net.minecraft.server.world.ServerWorld; 7 | import org.spongepowered.asm.mixin.Mixin; 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 | @Mixin(ServerPlayerEntity.class) 13 | public class MixinServerPlayerEntity { 14 | 15 | @Inject(method = "worldChanged", at = @At("HEAD")) 16 | public void ticktools$syncRenderDistance(ServerWorld origin, CallbackInfo ci) { 17 | ServerWorld world = ((ServerPlayerEntity) (Object) this).getServerWorld(); 18 | int distance = ((MixinThreadedAnvilChunkStorage) world.getChunkManager().threadedAnvilChunkStorage).getWatchDistance(); 19 | ((ServerPlayerEntity) (Object) this).networkHandler.sendPacket(new ChunkLoadDistanceS2CPacket(distance)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/mixin/MixinServerWorld.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.mixin; 2 | 3 | import com.github.quiltservertools.ticktools.TickToolsManager; 4 | import net.minecraft.entity.Entity; 5 | import net.minecraft.server.world.ServerWorld; 6 | import net.minecraft.world.chunk.WorldChunk; 7 | import org.spongepowered.asm.mixin.Mixin; 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 java.util.function.BooleanSupplier; 13 | 14 | @Mixin(ServerWorld.class) 15 | public class MixinServerWorld { 16 | @Inject(method = "tickEntity", at = @At("HEAD"), cancellable = true) 17 | public void ticktools$stopEntityTicks(Entity entity, CallbackInfo ci) { 18 | if (!TickToolsManager.getInstance().shouldTickChunk(entity.getChunkPos(), (ServerWorld) (Object) this)) { 19 | ci.cancel(); 20 | } 21 | } 22 | 23 | @Inject(method = "tickChunk", at = @At("HEAD"), cancellable = true) 24 | public void ticktools$stopChunkTicks(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci) { 25 | if (!TickToolsManager.getInstance().shouldTickChunk(chunk.getPos(), (ServerWorld) (Object) this) && chunk.getInhabitedTime() != 0) { 26 | ci.cancel(); 27 | } 28 | } 29 | 30 | @Inject(method = "tick", at = @At("HEAD")) 31 | public void ticktools$updateDynamics(BooleanSupplier shouldKeepTicking, CallbackInfo ci) { 32 | if (((ServerWorld) (Object) this).getTime() % 400 == 0) { 33 | TickToolsManager.getInstance().updateRenderDistance((ServerWorld) (Object) this); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/github/quiltservertools/ticktools/mixin/MixinThreadedAnvilChunkStorage.java: -------------------------------------------------------------------------------- 1 | package com.github.quiltservertools.ticktools.mixin; 2 | 3 | import net.minecraft.server.world.ThreadedAnvilChunkStorage; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(ThreadedAnvilChunkStorage.class) 8 | public interface MixinThreadedAnvilChunkStorage { 9 | @Accessor("watchDistance") 10 | int getWatchDistance(); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/ticktools/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuiltServerTools/TickTools/130b5b3146531ae32a98b6a12a9ef1e0d0e48725/src/main/resources/assets/ticktools/icon.png -------------------------------------------------------------------------------- /src/main/resources/default_config.toml: -------------------------------------------------------------------------------- 1 | # Required options 2 | splitTickDistance = false 3 | # Required if relevant config option above is enabled 4 | tickDistance = 8 5 | 6 | [dynamic] 7 | dynamicTickDistance = false 8 | minTickDistance = 4 9 | dynamicRenderDistance = false 10 | minRenderDistance = 4 11 | maxRenderDistance = 12 12 | # This value controls the MSPT used to target 13 | targetMSPT = 50.0 14 | 15 | # Optional 16 | 17 | itemDespawnTicks = 6000 18 | 19 | # Example config for world specific 20 | # Uncomment to use 21 | #[the_nether] 22 | #splitTickDistance = true 23 | #tickDistance = 8 24 | #itemDespawnTicks = 6000 25 | 26 | #[the_nether.dynamic] 27 | # dynamicTickDistance = false 28 | # minTickDistance = 4 29 | # dynamicRenderDistance = false 30 | # minRenderDistance = 4 31 | # maxRenderDistance = 12 32 | -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "ticktools", 4 | "version": "${version}", 5 | 6 | "name": "TickTools", 7 | "description": "Allows for separate tick and render distances", 8 | "authors": [ 9 | "yitzy299" 10 | ], 11 | "contact": { 12 | "sources": "https://github.com/QuiltServerTools/TickTools" 13 | }, 14 | 15 | "license": "MIT", 16 | 17 | "environment": "server", 18 | "entrypoints": { 19 | "server": [ 20 | "com.github.quiltservertools.ticktools.TickTools" 21 | ] 22 | }, 23 | "mixins": [ 24 | "ticktools.mixins.json" 25 | ], 26 | 27 | "depends": { 28 | "fabricloader": ">=0.11.3", 29 | "fabric": "*", 30 | "minecraft": "1.17.x", 31 | "java": ">=16" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/ticktools.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "com.github.quiltservertools.ticktools.mixin", 5 | "compatibilityLevel": "JAVA_16", 6 | "injectors": { 7 | "defaultRequire": 1 8 | }, 9 | "mixins": [ 10 | "MixinServerPlayerEntity", 11 | "MixinItemEntity", 12 | "MixinServerWorld", 13 | "MixinThreadedAnvilChunkStorage" 14 | ] 15 | } --------------------------------------------------------------------------------