├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src └── main ├── java ├── lumien │ └── chunkanimator │ │ ├── ChunkAnimator.java │ │ ├── asm │ │ ├── ClassTransformer.java │ │ └── MCPNames.java │ │ ├── config │ │ └── ChunkAnimatorConfig.java │ │ ├── handler │ │ ├── AnimationHandler.java │ │ └── AsmHandler.java │ │ └── lib │ │ └── Reference.java └── penner │ └── easing │ ├── Back.java │ ├── Bounce.java │ ├── Circ.java │ ├── Cubic.java │ ├── Elastic.java │ ├── Expo.java │ ├── Linear.java │ ├── Quad.java │ ├── Quart.java │ ├── Quint.java │ ├── Sine.java │ └── easing_terms_of_use.html └── resources ├── META-INF ├── coremods.json └── mods.toml ├── pack.mcmeta └── transformer ├── ChunkRenderContainer.js └── RenderChunk.js /.gitignore: -------------------------------------------------------------------------------- 1 | /* 2 | !/.gitignore 3 | !/gradle/ 4 | !/gradle/* 5 | !/gradle* 6 | !/src/ 7 | !/src/* 8 | !/*.gradle 9 | !/*.md 10 | .gradle 11 | Thumbs.db 12 | Update.bat 13 | *.psd 14 | /libs/* 15 | /libs/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Lumien 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 | # Chunk-Animator 2 | Minecraft mod that animates the appearance of chunks 3 | 4 | This Repo isn't being maintained anymore, development continues [here](https://github.com/Harleyoc1/ChunkAnimator). 5 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url = 'https://files.minecraftforge.net/maven' } 4 | jcenter() 5 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true 9 | } 10 | } 11 | apply plugin: 'net.minecraftforge.gradle' 12 | //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. 13 | apply plugin: 'eclipse' 14 | 15 | 16 | version = "1.2" 17 | group = "lumien.chunkanimator" // http://maven.apache.org/guides/mini/guide-naming-conventions.html 18 | 19 | sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. 20 | 21 | archivesBaseName = "ChunkAnimator-MC1.13.2" 22 | 23 | minecraft { 24 | mappings channel: 'snapshot', version: '20180921-1.13' 25 | runs { 26 | client = { 27 | // recommended logging data for a userdev environment 28 | properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' 29 | // recommended logging level for the console 30 | properties 'forge.logging.console.level': 'debug' 31 | workingDirectory project.file('run').canonicalPath 32 | source sourceSets.main 33 | } 34 | server = { 35 | // recommended logging data for a userdev environment 36 | properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' 37 | // recommended logging level for the console 38 | properties 'forge.logging.console.level': 'debug' 39 | workingDirectory project.file('run').canonicalPath 40 | source sourceSets.main 41 | } 42 | } 43 | } 44 | 45 | dependencies { 46 | minecraft 'net.minecraftforge:forge:1.13.2-25.0.70' 47 | 48 | // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, 49 | // except that these dependencies get remapped to your current MCP mappings 50 | //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' 51 | //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' 52 | 53 | // for more info... 54 | // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html 55 | // http://www.gradle.org/docs/current/userguide/dependency_management.html 56 | 57 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties. 2 | # This is required to provide enough memory for the Minecraft decompilation process. 3 | org.gradle.jvmargs=-Xmx3G 4 | org.gradle.daemon=false -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lumien231/Chunk-Animator/671f55e9d4198b4fd1b85c27227fbcde55484f55/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/ChunkAnimator.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator; 2 | 3 | import lumien.chunkanimator.config.ChunkAnimatorConfig; 4 | import lumien.chunkanimator.handler.AnimationHandler; 5 | import lumien.chunkanimator.lib.Reference; 6 | import net.minecraftforge.common.MinecraftForge; 7 | import net.minecraftforge.eventbus.api.IEventBus; 8 | import net.minecraftforge.fml.ModLoadingContext; 9 | import net.minecraftforge.fml.common.Mod; 10 | import net.minecraftforge.fml.config.ModConfig; 11 | import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; 12 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 13 | 14 | @Mod(Reference.MOD_ID) 15 | public class ChunkAnimator 16 | { 17 | public static ChunkAnimator INSTANCE; 18 | 19 | public AnimationHandler animationHandler; 20 | 21 | public ChunkAnimatorConfig config; 22 | 23 | public ChunkAnimator() 24 | { 25 | INSTANCE = this; 26 | 27 | final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 28 | 29 | ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ChunkAnimatorConfig.spec); 30 | modEventBus.register(ChunkAnimatorConfig.class); 31 | 32 | animationHandler = new AnimationHandler(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/asm/ClassTransformer.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator.asm; 2 | 3 | import static org.objectweb.asm.Opcodes.INVOKESTATIC; 4 | 5 | import java.util.LinkedHashSet; 6 | import java.util.Set; 7 | 8 | import org.apache.logging.log4j.Level; 9 | import org.apache.logging.log4j.LogManager; 10 | import org.apache.logging.log4j.Logger; 11 | import org.objectweb.asm.Opcodes; 12 | import org.objectweb.asm.tree.AbstractInsnNode; 13 | import org.objectweb.asm.tree.ClassNode; 14 | import org.objectweb.asm.tree.InsnList; 15 | import org.objectweb.asm.tree.MethodInsnNode; 16 | import org.objectweb.asm.tree.MethodNode; 17 | import org.objectweb.asm.tree.VarInsnNode; 18 | 19 | import cpw.mods.modlauncher.api.ITransformer; 20 | import cpw.mods.modlauncher.api.ITransformerVotingContext; 21 | import cpw.mods.modlauncher.api.TransformerVoteResult; 22 | import net.minecraftforge.accesstransformer.Target; 23 | 24 | public class ClassTransformer implements ITransformer 25 | { 26 | Logger logger = LogManager.getLogger("ChunkAnimatorCore"); 27 | 28 | final String asmHandler = "lumien/chunkanimator/handler/AsmHandler"; 29 | 30 | public ClassTransformer() 31 | { 32 | logger.log(Level.DEBUG, "Starting Class Transformation"); 33 | } 34 | 35 | private ClassNode patchRenderChunk(ClassNode classNode) 36 | { 37 | logger.log(Level.DEBUG, "Found RenderChunk Class: " + classNode.name); 38 | 39 | MethodNode setPosition = null; 40 | 41 | for (MethodNode mn : classNode.methods) 42 | { 43 | if (mn.name.equals("setPosition")) 44 | { 45 | setPosition = mn; 46 | break; 47 | } 48 | } 49 | 50 | if (setPosition != null) 51 | { 52 | logger.log(Level.DEBUG, "- Found setOrigin"); 53 | 54 | for (int i = 0; i < setPosition.instructions.size(); i++) 55 | { 56 | AbstractInsnNode ain; 57 | 58 | if ((ain = setPosition.instructions.get(i)) instanceof MethodInsnNode) 59 | { 60 | MethodInsnNode min = (MethodInsnNode) ain; 61 | if (min.name.equals(MCPNames.method("func_178585_h"))) 62 | { 63 | InsnList toInsert = new InsnList(); 64 | toInsert.add(new VarInsnNode(Opcodes.ALOAD, 0)); 65 | toInsert.add(new VarInsnNode(Opcodes.ILOAD, 1)); 66 | toInsert.add(new VarInsnNode(Opcodes.ILOAD, 2)); 67 | toInsert.add(new VarInsnNode(Opcodes.ILOAD, 3)); 68 | toInsert.add(new MethodInsnNode(INVOKESTATIC, asmHandler, "setOrigin", "(Lnet/minecraft/client/renderer/chunk/RenderChunk;III)V", false)); 69 | 70 | setPosition.instructions.insertBefore(min, toInsert); 71 | i+=5; 72 | } 73 | } 74 | } 75 | 76 | logger.log(Level.DEBUG, "- Patched setOrigin"); 77 | } 78 | 79 | return classNode; 80 | } 81 | 82 | private ClassNode patchChunkRenderContainer(ClassNode classNode) 83 | { 84 | logger.log(Level.DEBUG, "Found ChunkRenderContainer Class: " + classNode.name); 85 | 86 | MethodNode preRenderChunk = null; 87 | 88 | for (MethodNode mn : classNode.methods) 89 | { 90 | if (mn.name.equals("preRenderChunk")) 91 | { 92 | preRenderChunk = mn; 93 | break; 94 | } 95 | } 96 | 97 | if (preRenderChunk != null) 98 | { 99 | logger.log(Level.DEBUG, "- Found preRenderChunk"); 100 | 101 | for (int i = 0; i < preRenderChunk.instructions.size(); i++) 102 | { 103 | AbstractInsnNode ain = preRenderChunk.instructions.get(i); 104 | 105 | if (ain instanceof MethodInsnNode) 106 | { 107 | MethodInsnNode min = (MethodInsnNode) ain; 108 | 109 | if (min.name.equals(MCPNames.method("func_179109_b"))) 110 | { 111 | logger.log(Level.DEBUG, "- Patched preRenderChunk"); 112 | 113 | InsnList toInsert = new InsnList(); 114 | toInsert.add(new VarInsnNode(Opcodes.ALOAD, 1)); 115 | toInsert.add(new MethodInsnNode(INVOKESTATIC, asmHandler, "preRenderChunk", "(Lnet/minecraft/client/renderer/chunk/RenderChunk;)V", false)); 116 | 117 | preRenderChunk.instructions.insert(min, toInsert); 118 | 119 | break; 120 | } 121 | } 122 | 123 | } 124 | } 125 | 126 | return classNode; 127 | } 128 | 129 | @Override 130 | public ClassNode transform(ClassNode input, ITransformerVotingContext context) 131 | { 132 | if (input.name.equals("net/minecraft/client/renderer/ChunkRenderContainer")) 133 | { 134 | return patchChunkRenderContainer(input); 135 | } 136 | else if (input.name.equals("net/minecraft/client/renderer/chunk/RenderChunk")) 137 | { 138 | return patchRenderChunk(input); 139 | } 140 | 141 | return null; 142 | } 143 | 144 | @Override 145 | public TransformerVoteResult castVote(ITransformerVotingContext context) 146 | { 147 | return TransformerVoteResult.YES; 148 | } 149 | 150 | @Override 151 | public Set targets() 152 | { 153 | Set targets = new LinkedHashSet(); 154 | 155 | targets.add(Target.targetClass("net.minecraft.client.renderer.ChunkRenderContainer")); 156 | targets.add(Target.targetClass("net.minecraft.client.renderer.chunk.RenderChunk")); 157 | 158 | return targets; 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/asm/MCPNames.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator.asm; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Iterator; 6 | import java.util.Map; 7 | import java.util.NoSuchElementException; 8 | 9 | import com.google.common.base.Charsets; 10 | import com.google.common.base.Splitter; 11 | import com.google.common.collect.ImmutableMap; 12 | import com.google.common.collect.Maps; 13 | import com.google.common.io.Files; 14 | import com.google.common.io.LineProcessor; 15 | 16 | public class MCPNames 17 | { 18 | private static Map fields; 19 | private static Map methods; 20 | 21 | static 22 | { 23 | if (mcp()) 24 | { 25 | String mappingDir; 26 | 27 | mappingDir = "./../mcp/"; 28 | 29 | fields = readMappings(new File(mappingDir + "fields.csv")); 30 | methods = readMappings(new File(mappingDir + "methods.csv")); 31 | } 32 | else 33 | { 34 | fields = methods = null; 35 | } 36 | } 37 | 38 | public static boolean mcp() 39 | { 40 | return true; 41 | } 42 | 43 | public static String field(String srgName) 44 | { 45 | if (mcp()) 46 | { 47 | return fields.get(srgName); 48 | } 49 | else 50 | { 51 | return srgName; 52 | } 53 | } 54 | 55 | public static String method(String srgName) 56 | { 57 | if (mcp()) 58 | { 59 | return methods.get(srgName); 60 | } 61 | else 62 | { 63 | return srgName; 64 | } 65 | } 66 | 67 | private static Map readMappings(File file) 68 | { 69 | if (!file.isFile()) 70 | { 71 | throw new RuntimeException("Couldn't find MCP mappings."); 72 | } 73 | try 74 | { 75 | return Files.readLines(file, Charsets.UTF_8, new MCPFileParser()); 76 | } 77 | catch (IOException e) 78 | { 79 | throw new RuntimeException("Couldn't read SRG->MCP mappings", e); 80 | } 81 | } 82 | 83 | private static class MCPFileParser implements LineProcessor> 84 | { 85 | private static final Splitter splitter = Splitter.on(',').trimResults(); 86 | private final Map map = Maps.newHashMap(); 87 | private boolean foundFirst; 88 | 89 | @Override 90 | public boolean processLine(String line) throws IOException 91 | { 92 | if (!foundFirst) 93 | { 94 | foundFirst = true; 95 | return true; 96 | } 97 | 98 | Iterator splitted = splitter.split(line).iterator(); 99 | try 100 | { 101 | String srg = splitted.next(); 102 | String mcp = splitted.next(); 103 | if (!map.containsKey(srg)) 104 | { 105 | map.put(srg, mcp); 106 | } 107 | } 108 | catch (NoSuchElementException e) 109 | { 110 | throw new IOException("Invalid Mappings file!", e); 111 | } 112 | 113 | return true; 114 | } 115 | 116 | @Override 117 | public Map getResult() 118 | { 119 | return ImmutableMap.copyOf(map); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/config/ChunkAnimatorConfig.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator.config; 2 | 3 | import static net.minecraftforge.fml.Logging.CORE; 4 | import static net.minecraftforge.fml.loading.LogMarkers.FORGEMOD; 5 | 6 | import org.apache.commons.lang3.tuple.Pair; 7 | import org.apache.logging.log4j.LogManager; 8 | 9 | import net.minecraftforge.common.ForgeConfigSpec; 10 | import net.minecraftforge.common.ForgeConfig.Server; 11 | import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; 12 | import net.minecraftforge.common.ForgeConfigSpec.IntValue; 13 | import net.minecraftforge.eventbus.api.SubscribeEvent; 14 | import net.minecraftforge.fml.config.ModConfig; 15 | import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; 16 | 17 | public class ChunkAnimatorConfig 18 | { 19 | 20 | // Animation Mode 21 | public static IntValue mode; 22 | 23 | // Easing Function 24 | public static IntValue easingFunction; 25 | 26 | // Animation Duration 27 | public static IntValue animationDuration; 28 | 29 | // Disable Around Player 30 | public static BooleanValue disableAroundPlayer; 31 | 32 | public ChunkAnimatorConfig(ForgeConfigSpec.Builder builder) 33 | { 34 | mode = builder.comment("How should the chunks be animated?\\n 0: Chunks always appear from below\\n 1: Chunks always appear from above\\n 2: Chunks appear from below if they are lower than the Horizon and from above if they are higher than the Horizon\\n 3: Chunks \\\"slide in\\\" from their respective cardinal direction (Relative to the Player)\\n 4: Same as 3 but the cardinal direction of a chunk is determined slightly different (Just try both :D)").defineInRange("mode", 0, 0, 4); 35 | easingFunction = builder.comment("The function that should be used to control the movement of chunks in ALL animation modes\\nIf you want a visual comparison there is a link on the curseforge page\\n0: Linear, 1: Quadratic, 2: Cubic, 3: Quartic, 4: Quintic, 5: Expo, 6: Sin, 7: Circle, 8: Back, 9: Bounce, 10: Elastic").defineInRange("easingFunction", 6, 0, 10); 36 | animationDuration = builder.comment("How long should the animation last? (In milliseconds)").defineInRange("animationDuration", 1000, 0, Integer.MAX_VALUE); 37 | disableAroundPlayer = builder.comment("If enabled chunks that are next to the player will not animate").define("disableAroundPlayer", false); 38 | } 39 | 40 | public void preInit(FMLCommonSetupEvent event) 41 | { 42 | 43 | } 44 | 45 | @SubscribeEvent 46 | public static void onLoad(final ModConfig.Loading configEvent) 47 | { 48 | 49 | } 50 | 51 | @SubscribeEvent 52 | public static void onFileChange(final ModConfig.ConfigReloading configEvent) 53 | { 54 | 55 | } 56 | 57 | public static final ForgeConfigSpec spec; 58 | public static final ChunkAnimatorConfig CONFIG; 59 | static { 60 | final Pair specPair = new ForgeConfigSpec.Builder().configure(ChunkAnimatorConfig::new); 61 | spec = specPair.getRight(); 62 | CONFIG = specPair.getLeft(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/handler/AnimationHandler.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator.handler; 2 | 3 | import java.util.WeakHashMap; 4 | 5 | import lumien.chunkanimator.ChunkAnimator; 6 | import lumien.chunkanimator.config.ChunkAnimatorConfig; 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraft.client.renderer.GlStateManager; 9 | import net.minecraft.client.renderer.chunk.RenderChunk; 10 | import net.minecraft.util.EnumFacing; 11 | import net.minecraft.util.math.BlockPos; 12 | import net.minecraft.util.math.Vec3i; 13 | import penner.easing.Back; 14 | import penner.easing.Bounce; 15 | import penner.easing.Circ; 16 | import penner.easing.Cubic; 17 | import penner.easing.Elastic; 18 | import penner.easing.Expo; 19 | import penner.easing.Linear; 20 | import penner.easing.Quad; 21 | import penner.easing.Quart; 22 | import penner.easing.Quint; 23 | import penner.easing.Sine; 24 | 25 | public class AnimationHandler 26 | { 27 | WeakHashMap timeStamps; 28 | 29 | public AnimationHandler() 30 | { 31 | timeStamps = new WeakHashMap(); 32 | } 33 | 34 | public void preRender(RenderChunk renderChunk) 35 | { 36 | if (timeStamps.containsKey(renderChunk)) 37 | { 38 | AnimationData animationData = timeStamps.get(renderChunk); 39 | long time = animationData.timeStamp; 40 | int mode = ChunkAnimatorConfig.mode.get(); 41 | 42 | if (time == -1L) 43 | { 44 | time = System.currentTimeMillis(); 45 | 46 | animationData.timeStamp = time; 47 | 48 | // Mode 4 Set Chunk Facing 49 | if (mode == 4) 50 | { 51 | BlockPos zeroedPlayerPosition = Minecraft.getInstance().player.getPosition(); 52 | zeroedPlayerPosition = zeroedPlayerPosition.add(0, -zeroedPlayerPosition.getY(), 0); 53 | 54 | BlockPos zeroedCenteredChunkPos = renderChunk.getPosition().add(8, -renderChunk.getPosition().getY(), 8); 55 | 56 | Vec3i dif = zeroedPlayerPosition.subtract(zeroedCenteredChunkPos); 57 | 58 | int difX = Math.abs(dif.getX()); 59 | int difZ = Math.abs(dif.getZ()); 60 | 61 | EnumFacing chunkFacing; 62 | 63 | if (difX > difZ) 64 | { 65 | if (dif.getX() > 0) 66 | { 67 | chunkFacing = EnumFacing.EAST; 68 | } 69 | else 70 | { 71 | chunkFacing = EnumFacing.WEST; 72 | } 73 | } 74 | else 75 | { 76 | if (dif.getZ() > 0) 77 | { 78 | chunkFacing = EnumFacing.SOUTH; 79 | } 80 | else 81 | { 82 | chunkFacing = EnumFacing.NORTH; 83 | } 84 | } 85 | 86 | animationData.chunkFacing = chunkFacing; 87 | } 88 | } 89 | 90 | long timeDif = System.currentTimeMillis() - time; 91 | 92 | int animationDuration = ChunkAnimatorConfig.animationDuration.get(); 93 | 94 | if (timeDif < animationDuration) 95 | { 96 | int chunkY = renderChunk.getPosition().getY(); 97 | double modY; 98 | 99 | if (mode == 2) 100 | { 101 | if (chunkY < Minecraft.getInstance().world.getHorizon()) 102 | { 103 | mode = 0; 104 | } 105 | else 106 | { 107 | mode = 1; 108 | } 109 | } 110 | 111 | if (mode == 4) 112 | { 113 | mode = 3; 114 | } 115 | 116 | switch (mode) 117 | { 118 | case 0: 119 | GlStateManager.translatef(0, -chunkY + getFunctionValue(timeDif, 0, chunkY, animationDuration), 0); 120 | break; 121 | case 1: 122 | GlStateManager.translatef(0, 256 - chunkY - getFunctionValue(timeDif, 0, 256 - chunkY, animationDuration), 0); 123 | break; 124 | case 3: 125 | EnumFacing chunkFacing = animationData.chunkFacing; 126 | 127 | if (chunkFacing != null) 128 | { 129 | Vec3i vec = chunkFacing.getDirectionVec(); 130 | double mod = -(200D - (200D / animationDuration * timeDif)); 131 | 132 | mod = -(200 - getFunctionValue(timeDif, 0, 200, animationDuration)); 133 | 134 | GlStateManager.translated(vec.getX() * mod, 0, vec.getZ() * mod); 135 | } 136 | break; 137 | } 138 | } 139 | else 140 | { 141 | timeStamps.remove(renderChunk); 142 | } 143 | } 144 | } 145 | 146 | private float getFunctionValue(float t, float b, float c, float d) 147 | { 148 | switch (ChunkAnimatorConfig.easingFunction.get()) 149 | { 150 | case 0: // Linear 151 | return Linear.easeOut(t, b, c, d); 152 | case 1: // Quadratic Out 153 | return Quad.easeOut(t, b, c, d); 154 | case 2: // Cubic Out 155 | return Cubic.easeOut(t, b, c, d); 156 | case 3: // Quartic Out 157 | return Quart.easeOut(t, b, c, d); 158 | case 4: // Quintic Out 159 | return Quint.easeOut(t, b, c, d); 160 | case 5: // Expo Out 161 | return Expo.easeOut(t, b, c, d); 162 | case 6: // Sin Out 163 | return Sine.easeOut(t, b, c, d); 164 | case 7: // Circle Out 165 | return Circ.easeOut(t, b, c, d); 166 | case 8: // Back 167 | return Back.easeOut(t, b, c, d); 168 | case 9: // Bounce 169 | return Bounce.easeOut(t, b, c, d); 170 | case 10: // Elastic 171 | return Elastic.easeOut(t, b, c, d); 172 | } 173 | 174 | return Sine.easeOut(t, b, c, d); 175 | } 176 | 177 | public void setOrigin(RenderChunk renderChunk, BlockPos position) 178 | { 179 | if (Minecraft.getInstance().player != null) 180 | { 181 | boolean flag = true; 182 | BlockPos zeroedPlayerPosition = Minecraft.getInstance().player.getPosition(); 183 | zeroedPlayerPosition = zeroedPlayerPosition.add(0, -zeroedPlayerPosition.getY(), 0); 184 | BlockPos zeroedCenteredChunkPos = position.add(8, -position.getY(), 8); 185 | 186 | if (ChunkAnimatorConfig.disableAroundPlayer.get()) 187 | { 188 | flag = zeroedPlayerPosition.distanceSq(zeroedCenteredChunkPos) > (64 * 64); 189 | } 190 | 191 | if (flag) 192 | { 193 | EnumFacing chunkFacing = null; 194 | 195 | if (ChunkAnimatorConfig.mode.get() == 3) 196 | { 197 | Vec3i dif = zeroedPlayerPosition.subtract(zeroedCenteredChunkPos); 198 | 199 | int difX = Math.abs(dif.getX()); 200 | int difZ = Math.abs(dif.getZ()); 201 | 202 | if (difX > difZ) 203 | { 204 | if (dif.getX() > 0) 205 | { 206 | chunkFacing = EnumFacing.EAST; 207 | } 208 | else 209 | { 210 | chunkFacing = EnumFacing.WEST; 211 | } 212 | } 213 | else 214 | { 215 | if (dif.getZ() > 0) 216 | { 217 | chunkFacing = EnumFacing.SOUTH; 218 | } 219 | else 220 | { 221 | chunkFacing = EnumFacing.NORTH; 222 | } 223 | } 224 | } 225 | 226 | AnimationData animationData = new AnimationData(-1L, chunkFacing); 227 | timeStamps.put(renderChunk, animationData); 228 | } 229 | else 230 | { 231 | if (timeStamps.containsKey(renderChunk)) 232 | { 233 | timeStamps.remove(renderChunk); 234 | } 235 | } 236 | } 237 | 238 | } 239 | 240 | private class AnimationData 241 | { 242 | public long timeStamp; 243 | 244 | public EnumFacing chunkFacing; 245 | 246 | public AnimationData(long timeStamp, EnumFacing chunkFacing) 247 | { 248 | this.timeStamp = timeStamp; 249 | this.chunkFacing = chunkFacing; 250 | } 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/handler/AsmHandler.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator.handler; 2 | 3 | import lumien.chunkanimator.ChunkAnimator; 4 | import net.minecraft.client.renderer.chunk.RenderChunk; 5 | import net.minecraft.util.math.BlockPos; 6 | 7 | public class AsmHandler 8 | { 9 | public static void preRenderChunk(RenderChunk renderChunk) 10 | { 11 | ChunkAnimator.INSTANCE.animationHandler.preRender(renderChunk); 12 | } 13 | 14 | public static void setOrigin(RenderChunk renderChunk, int oX, int oY, int oZ) 15 | { 16 | ChunkAnimator.INSTANCE.animationHandler.setOrigin(renderChunk, new BlockPos(oX, oY, oZ)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/lumien/chunkanimator/lib/Reference.java: -------------------------------------------------------------------------------- 1 | package lumien.chunkanimator.lib; 2 | 3 | public class Reference 4 | { 5 | public static final String MOD_ID = "chunkanimator"; 6 | public static final String MOD_NAME = "Chunk Animator"; 7 | public static final String MOD_VERSION = "@VERSION@"; 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Back.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Back { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | float s = 1.70158f; 7 | return c*(t/=d)*t*((s+1)*t - s) + b; 8 | } 9 | 10 | public static float easeIn(float t,float b , float c, float d, float s) { 11 | return c*(t/=d)*t*((s+1)*t - s) + b; 12 | } 13 | 14 | public static float easeOut(float t,float b , float c, float d) { 15 | float s = 1.70158f; 16 | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 17 | } 18 | 19 | public static float easeOut(float t,float b , float c, float d, float s) { 20 | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 21 | } 22 | 23 | public static float easeInOut(float t,float b , float c, float d) { 24 | float s = 1.70158f; 25 | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525f))+1)*t - s)) + b; 26 | return c/2*((t-=2)*t*(((s*=(1.525f))+1)*t + s) + 2) + b; 27 | } 28 | 29 | public static float easeInOut(float t,float b , float c, float d, float s) { 30 | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525f))+1)*t - s)) + b; 31 | return c/2*((t-=2)*t*(((s*=(1.525f))+1)*t + s) + 2) + b; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Bounce.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Bounce { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | return c - easeOut (d-t, 0, c, d) + b; 7 | } 8 | 9 | public static float easeOut(float t,float b , float c, float d) { 10 | if ((t/=d) < (1/2.75f)) { 11 | return c*(7.5625f*t*t) + b; 12 | } else if (t < (2/2.75f)) { 13 | return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b; 14 | } else if (t < (2.5/2.75)) { 15 | return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b; 16 | } else { 17 | return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b; 18 | } 19 | } 20 | 21 | public static float easeInOut(float t,float b , float c, float d) { 22 | if (t < d/2) return easeIn (t*2, 0, c, d) * .5f + b; 23 | else return easeOut (t*2-d, 0, c, d) * .5f + c*.5f + b; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Circ.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Circ { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | return -c * ((float)Math.sqrt(1 - (t/=d)*t) - 1) + b; 7 | } 8 | 9 | public static float easeOut(float t,float b , float c, float d) { 10 | return c * (float)Math.sqrt(1 - (t=t/d-1)*t) + b; 11 | } 12 | 13 | public static float easeInOut(float t,float b , float c, float d) { 14 | if ((t/=d/2) < 1) return -c/2 * ((float)Math.sqrt(1 - t*t) - 1) + b; 15 | return c/2 * ((float)Math.sqrt(1 - (t-=2)*t) + 1) + b; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Cubic.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Cubic { 4 | 5 | public static float easeIn (float t,float b , float c, float d) { 6 | return c*(t/=d)*t*t + b; 7 | } 8 | 9 | public static float easeOut (float t,float b , float c, float d) { 10 | return c*((t=t/d-1)*t*t + 1) + b; 11 | } 12 | 13 | public static float easeInOut (float t,float b , float c, float d) { 14 | if ((t/=d/2) < 1) return c/2*t*t*t + b; 15 | return c/2*((t-=2)*t*t + 2) + b; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Elastic.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Elastic { 4 | 5 | public static float easeIn(float t,float b , float c, float d ) { 6 | if (t==0) return b; if ((t/=d)==1) return b+c; 7 | float p=d*.3f; 8 | float a=c; 9 | float s=p/4; 10 | return -(a*(float)Math.pow(2,10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )) + b; 11 | } 12 | 13 | public static float easeIn(float t,float b , float c, float d, float a, float p) { 14 | float s; 15 | if (t==0) return b; if ((t/=d)==1) return b+c; 16 | if (a < Math.abs(c)) { a=c; s=p/4; } 17 | else { s = p/(2*(float)Math.PI) * (float)Math.asin (c/a);} 18 | return -(a*(float)Math.pow(2,10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 19 | } 20 | 21 | public static float easeOut(float t,float b , float c, float d) { 22 | if (t==0) return b; if ((t/=d)==1) return b+c; 23 | float p=d*.3f; 24 | float a=c; 25 | float s=p/4; 26 | return (a*(float)Math.pow(2,-10*t) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p ) + c + b); 27 | } 28 | 29 | public static float easeOut(float t,float b , float c, float d, float a, float p) { 30 | float s; 31 | if (t==0) return b; if ((t/=d)==1) return b+c; 32 | if (a < Math.abs(c)) { a=c; s=p/4; } 33 | else { s = p/(2*(float)Math.PI) * (float)Math.asin (c/a);} 34 | return (a*(float)Math.pow(2,-10*t) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p ) + c + b); 35 | } 36 | 37 | public static float easeInOut(float t,float b , float c, float d) { 38 | if (t==0) return b; if ((t/=d/2)==2) return b+c; 39 | float p=d*(.3f*1.5f); 40 | float a=c; 41 | float s=p/4; 42 | if (t < 1) return -.5f*(a*(float)Math.pow(2,10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )) + b; 43 | return a*(float)Math.pow(2,-10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )*.5f + c + b; 44 | } 45 | 46 | public static float easeInOut(float t,float b , float c, float d, float a, float p) { 47 | float s; 48 | if (t==0) return b; if ((t/=d/2)==2) return b+c; 49 | if (a < Math.abs(c)) { a=c; s=p/4; } 50 | else { s = p/(2*(float)Math.PI) * (float)Math.asin (c/a);} 51 | if (t < 1) return -.5f*(a*(float)Math.pow(2,10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )) + b; 52 | return a*(float)Math.pow(2,-10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )*.5f + c + b; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Expo.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Expo { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | return (t==0) ? b : c * (float)Math.pow(2, 10 * (t/d - 1)) + b; 7 | } 8 | 9 | public static float easeOut(float t,float b , float c, float d) { 10 | return (t==d) ? b+c : c * (-(float)Math.pow(2, -10 * t/d) + 1) + b; 11 | } 12 | 13 | public static float easeInOut(float t,float b , float c, float d) { 14 | if (t==0) return b; 15 | if (t==d) return b+c; 16 | if ((t/=d/2) < 1) return c/2 * (float)Math.pow(2, 10 * (t - 1)) + b; 17 | return c/2 * (-(float)Math.pow(2, -10 * --t) + 2) + b; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Linear.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Linear { 4 | 5 | public static float easeNone (float t,float b , float c, float d) { 6 | return c*t/d + b; 7 | } 8 | 9 | public static float easeIn (float t,float b , float c, float d) { 10 | return c*t/d + b; 11 | } 12 | 13 | public static float easeOut (float t,float b , float c, float d) { 14 | return c*t/d + b; 15 | } 16 | 17 | public static float easeInOut (float t,float b , float c, float d) { 18 | return c*t/d + b; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Quad.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Quad { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | return c*(t/=d)*t + b; 7 | } 8 | 9 | public static float easeOut(float t,float b , float c, float d) { 10 | return -c *(t/=d)*(t-2) + b; 11 | } 12 | 13 | public static float easeInOut(float t,float b , float c, float d) { 14 | if ((t/=d/2) < 1) return c/2*t*t + b; 15 | return -c/2 * ((--t)*(t-2) - 1) + b; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Quart.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Quart { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | return c*(t/=d)*t*t*t + b; 7 | } 8 | 9 | public static float easeOut(float t,float b , float c, float d) { 10 | return -c * ((t=t/d-1)*t*t*t - 1) + b; 11 | } 12 | 13 | public static float easeInOut(float t,float b , float c, float d) { 14 | if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 15 | return -c/2 * ((t-=2)*t*t*t - 2) + b; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Quint.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Quint { 4 | 5 | public static float easeIn (float t,float b , float c, float d) { 6 | return c*(t/=d)*t*t*t*t + b; 7 | } 8 | 9 | public static float easeOut (float t,float b , float c, float d) { 10 | return c*((t=t/d-1)*t*t*t*t + 1) + b; 11 | } 12 | 13 | public static float easeInOut (float t,float b , float c, float d) { 14 | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 15 | return c/2*((t-=2)*t*t*t*t + 2) + b; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/Sine.java: -------------------------------------------------------------------------------- 1 | package penner.easing; 2 | 3 | public class Sine { 4 | 5 | public static float easeIn(float t,float b , float c, float d) { 6 | return -c * (float)Math.cos(t/d * (Math.PI/2)) + c + b; 7 | } 8 | 9 | public static float easeOut(float t,float b , float c, float d) { 10 | return c * (float)Math.sin(t/d * (Math.PI/2)) + b; 11 | } 12 | 13 | public static float easeInOut(float t,float b , float c, float d) { 14 | return -c/2 * ((float)Math.cos(Math.PI*t/d) - 1) + b; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/penner/easing/easing_terms_of_use.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lumien231/Chunk-Animator/671f55e9d4198b4fd1b85c27227fbcde55484f55/src/main/java/penner/easing/easing_terms_of_use.html -------------------------------------------------------------------------------- /src/main/resources/META-INF/coremods.json: -------------------------------------------------------------------------------- 1 | { 2 | "RenderChunk": "transformer/RenderChunk.js", 3 | "ChunkRenderContainer": "transformer/ChunkRenderContainer.js" 4 | } -------------------------------------------------------------------------------- /src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader="javafml" #mandatory 2 | 3 | loaderVersion="[24,)" #mandatory (24 is current forge version) 4 | issueTrackerURL="https://github.com/lumien231/Chunk-Animator" #optional 5 | 6 | displayURL="https://minecraft.curseforge.com/projects/chunk-animator" #optional 7 | 8 | authors="Lumien" #optional 9 | 10 | [[mods]] #mandatory 11 | 12 | modId="chunkanimator" #mandatory 13 | 14 | version="${file.jarVersion}" #mandatory 15 | 16 | displayName="Chunk Animator" #mandatory 17 | 18 | description=''' 19 | A small client side mod that animates the appeareance of chunks so that they don't just instantly appear 20 | ''' -------------------------------------------------------------------------------- /src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "chunkanimator resources", 4 | "pack_format": 4, 5 | "_comment": "" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/transformer/ChunkRenderContainer.js: -------------------------------------------------------------------------------- 1 | function initializeCoreMod() { 2 | return { 3 | 'coremodone': { 4 | 'target': { 5 | 'type': 'CLASS', 6 | 'name': 'net.minecraft.client.renderer.ChunkRenderContainer' 7 | }, 8 | 'transformer': function (classNode) { 9 | var asmHandler = "lumien/chunkanimator/handler/AsmHandler"; 10 | 11 | var Opcodes = Java.type("org.objectweb.asm.Opcodes"); 12 | 13 | var MethodInsnNode = Java.type("org.objectweb.asm.tree.MethodInsnNode"); 14 | var VarInsnNode = Java.type("org.objectweb.asm.tree.VarInsnNode"); 15 | 16 | var api = Java.type('net.minecraftforge.coremod.api.ASMAPI'); 17 | 18 | var methods = classNode.methods; 19 | 20 | for (m in methods) 21 | { 22 | var method = methods[m]; 23 | if (method.name === "preRenderChunk" || method.name === "func_178003_a") 24 | { 25 | var code = method.instructions; 26 | var instr = code.toArray(); 27 | for (t in instr) 28 | { 29 | var instruction = instr[t]; 30 | if (instruction instanceof MethodInsnNode && (instruction.name === "translatef" || instruction.name === "func_179109_b")) 31 | { 32 | code.insertBefore(instruction, new VarInsnNode(Opcodes.ALOAD, 1)); 33 | code.insertBefore(instruction, new MethodInsnNode(Opcodes.INVOKESTATIC, asmHandler, "preRenderChunk", "(Lnet/minecraft/client/renderer/chunk/RenderChunk;)V", false)); 34 | break; 35 | } 36 | } 37 | break; 38 | } 39 | } 40 | 41 | return classNode; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/resources/transformer/RenderChunk.js: -------------------------------------------------------------------------------- 1 | function initializeCoreMod() { 2 | return { 3 | 'coremodone': { 4 | 'target': { 5 | 'type': 'CLASS', 6 | 'name': 'net.minecraft.client.renderer.chunk.RenderChunk' 7 | }, 8 | 'transformer': function (classNode) { 9 | var asmHandler = "lumien/chunkanimator/handler/AsmHandler"; 10 | 11 | var Opcodes = Java.type("org.objectweb.asm.Opcodes"); 12 | 13 | var MethodInsnNode = Java.type("org.objectweb.asm.tree.MethodInsnNode"); 14 | var VarInsnNode = Java.type("org.objectweb.asm.tree.VarInsnNode"); 15 | 16 | var api = Java.type('net.minecraftforge.coremod.api.ASMAPI'); 17 | 18 | var methods = classNode.methods; 19 | 20 | for (m in methods) 21 | { 22 | var method = methods[m]; 23 | if (method.name === "setPosition" || method.name === "func_189562_a") 24 | { 25 | var code = method.instructions; 26 | var instr = code.toArray(); 27 | for (t in instr) 28 | { 29 | var instruction = instr[t]; 30 | if (instruction instanceof MethodInsnNode && (instruction.name === "stopCompileTask" || instruction.name === "func_178585_h")) 31 | { 32 | code.insertBefore(instruction, new VarInsnNode(Opcodes.ALOAD, 0)); 33 | code.insertBefore(instruction, new VarInsnNode(Opcodes.ILOAD, 1)); 34 | code.insertBefore(instruction, new VarInsnNode(Opcodes.ILOAD, 2)); 35 | code.insertBefore(instruction, new VarInsnNode(Opcodes.ILOAD, 3)); 36 | code.insertBefore(instruction, new MethodInsnNode(Opcodes.INVOKESTATIC, asmHandler, "setOrigin", "(Lnet/minecraft/client/renderer/chunk/RenderChunk;III)V", false)); 37 | break; 38 | } 39 | } 40 | break; 41 | } 42 | } 43 | 44 | return classNode; 45 | } 46 | } 47 | } 48 | } --------------------------------------------------------------------------------