7 Commits

Author SHA1 Message Date
bee3c97270 Merge remote-tracking branch 'origin/HEAD' into TopchetoEU/reprogramming-shaders 2023-03-27 10:14:44 +03:00
triphora
3666b36d09 Fix Modrinth download badge (#20)
v1 of Modrinth's API has been deprecated since January 2022 and is scheduled to begin breaking in February, with a complete breakage being done by March. This pull request has been created as a courtesy to update it to use the dedicated shields.io badge rather than manually constructing the API request.

After merging this PR, please also update any usages on other pages, for example a CurseForge and/or Modrinth project description, and also cherry-pick/copy these changes to any other branches you might have.
2023-03-13 08:56:38 +02:00
00a25c3681 chore: recode animations and eases 2023-01-18 16:08:02 +02:00
54c77dced0 Topcheto eu/sodium compatibility issue (#19)
* chore: clean up codebase, note sodium incompatibility

* fix: some rendering issues due to refactoring
2023-01-15 21:34:48 +02:00
D1p4k
b9357832fb Now works. (#18)
fix: dependency issues
2023-01-15 12:27:11 +02:00
5e95b1547e Merge pull request #17 from RaptaG/patch-1
Upgrade `yarn_mappings` to `1.19.2+build.20`
2022-10-11 01:15:27 +03:00
RaptaG
0deff2fb69 Upgrade yarn_mappings to 1.19.2+build.20 2022-10-10 20:34:02 +03:00
23 changed files with 380 additions and 399 deletions

View File

@@ -7,13 +7,15 @@
[![Mod Loader](https://img.shields.io/badge/Mod%20Loader-Fabric-lightyellow?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE4LTEyLTE2VDE2OjU0OjE3LTA4OjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOS0wNy0yOFQyMToxNzo0OC0wNzowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOS0wNy0yOFQyMToxNzo0OC0wNzowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MGVkYjFjMmMtZmY4Yy1lNDQxLTkzMWYtNDk1ZDRmMTRjNzYwIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6MGVkYjFjMmMtZmY4Yy1lNDQxLTkzMWYtNDk1ZDRmMTRjNzYwIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHN0RXZ0OndoZW49IjIwMTgtMTItMTZUMTY6NTQ6MTctMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4/HiGMAAAAtUlEQVRYw+XXrQqAMBQF4D2P2eBL+QIG8RnEJFaNBjEum+0+zMQLtwwv+wV3ZzhhMDgfJ0wUSinxZUQWgKos1JP/AbD4OneIDyQPwCFniA+EJ4CaXm4TxAXCC0BNHgLhAdAnx9hC8PwGSRtAFVMQjF7cNTWED8B1cgwW20yfJgAvrssAsZ1cB3g/xckAxr6FmCDU5N6f488BrpCQ4rQBJkiMYh4ACmLzwOQF0CExinkCsvw7vgGikl+OotaKRwAAAABJRU5ErkJggg==)](https://fabricmc.net)
![Enviroment](https://img.shields.io/badge/Enviroment-Client-purple)
[![Modrinth](https://img.shields.io/badge/dynamic/json?color=158000&label=downloads&prefix=+%20&query=downloads&url=https://api.modrinth.com/api/v1/mod/animated-chunks&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMSAxMSIgd2lkdGg9IjE0LjY2NyIgaGVpZ2h0PSIxNC42NjciICB4bWxuczp2PSJodHRwczovL3ZlY3RhLmlvL25hbm8iPjxkZWZzPjxjbGlwUGF0aCBpZD0iQSI+PHBhdGggZD0iTTAgMGgxMXYxMUgweiIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNBKSI+PHBhdGggZD0iTTEuMzA5IDcuODU3YTQuNjQgNC42NCAwIDAgMS0uNDYxLTEuMDYzSDBDLjU5MSA5LjIwNiAyLjc5NiAxMSA1LjQyMiAxMWMxLjk4MSAwIDMuNzIyLTEuMDIgNC43MTEtMi41NTZoMGwtLjc1LS4zNDVjLS44NTQgMS4yNjEtMi4zMSAyLjA5Mi0zLjk2MSAyLjA5MmE0Ljc4IDQuNzggMCAwIDEtMy4wMDUtMS4wNTVsMS44MDktMS40NzQuOTg0Ljg0NyAxLjkwNS0xLjAwM0w4LjE3NCA1LjgybC0uMzg0LS43ODYtMS4xMTYuNjM1LS41MTYuNjk0LS42MjYuMjM2LS44NzMtLjM4N2gwbC0uMjEzLS45MS4zNTUtLjU2Ljc4Ny0uMzcuODQ1LS45NTktLjcwMi0uNTEtMS44NzQuNzEzLTEuMzYyIDEuNjUxLjY0NSAxLjA5OC0xLjgzMSAxLjQ5MnptOS42MTQtMS40NEE1LjQ0IDUuNDQgMCAwIDAgMTEgNS41QzExIDIuNDY0IDguNTAxIDAgNS40MjIgMCAyLjc5NiAwIC41OTEgMS43OTQgMCA0LjIwNmguODQ4QzEuNDE5IDIuMjQ1IDMuMjUyLjgwOSA1LjQyMi44MDljMi42MjYgMCA0Ljc1OCAyLjEwMiA0Ljc1OCA0LjY5MSAwIC4xOS0uMDEyLjM3Ni0uMDM0LjU2bC43NzcuMzU3aDB6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiM1ZGE0MjYiLz48L2c+PC9zdmc+)](https://modrinth.com/mod/animated-chunks)
[![Modrinth](https://img.shields.io/modrinth/dt/animated-chunks?color=00AF5C&label=downloads&logo=modrinth)](https://modrinth.com/mod/animated-chunks)
[![CurseForge](https://cf.way2muchnoise.eu/full_678609_downloads.svg)](https://curseforge.com/minecraft/mc-mods/animated-chunks)
An enhanecd fork of [cadenkriese's mod](https://github.com/cadenkriese/smooth-chunks) for the latest versions of the game, with a completely different code base.
</div>
**NOTE: This mod WILL NOT support Sodium, since Sodium doesn't render separate chunks, but whole regions, hence separate chunk animations are rendered impossible. Anyone interested in making sodium compatibility, be my guest**
## What is this?
Animated Chunks is a Fabric mod that adds animations of currently loading chunks. This makes chunk loading generally seem much more pleasant than them appearing out of thin air. There are multiple built-in animations and ease types, and if this isnt't enough, there's an API which will allow you to add your own animations and eases<br/>(with ease :trollface:)
@@ -47,7 +49,7 @@ Generally, this is what you'd call an "eye-candy" mod.
## Future plans
In the future, I plan to extend the scope of this mod to not only smoothen the chunk loading, but entity spawning/despawning/dying, liquid flowing, crops growing etc. and support Sodium.
In the future, I plan to extend the scope of this mod to not only smoothen the chunk loading, but entity spawning/despawning/dying, liquid flowing, crops growing etc.
## License

View File

@@ -14,6 +14,10 @@ repositories {
maven {
url "https://maven.terraformersmc.com/releases"
}
// maven {
// url "https://jitpack.io/"
// }
mavenLocal()
}
dependencies {
@@ -50,6 +54,7 @@ dependencies {
// include("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}")
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}")
// modImplementation("com.github.CaffeineMC:sodium-fabric:${project.sodium_version}")
}

View File

@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx4G
# Fabric Properties
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.17
loader_version=0.14.9
yarn_mappings=1.19.2+build.28
loader_version=0.14.12
# Mod Properties
mod_version=0.3.0
@@ -13,5 +13,6 @@ maven_group=me.topchetoeu
archives_base_name=animated-chunks
# Dependencies
fabric_version=[0.0.0,)
modmenu_version=[4.0.0,)
fabric_version=0.72.0+1.19.2
modmenu_version=4.1.2
# sodium_version=mc1.19.2-0.4.3

View File

@@ -5,11 +5,10 @@ import java.io.File;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.topchetoeu.animatedchunks.Manager.RegisterEvent;
import me.topchetoeu.animatedchunks.animation.Animation;
import me.topchetoeu.animatedchunks.animation.FallAnimation;
import me.topchetoeu.animatedchunks.animation.FlyInAnimation;
import me.topchetoeu.animatedchunks.animation.ProgressManager;
import me.topchetoeu.animatedchunks.animation.Animator;
import me.topchetoeu.animatedchunks.animation.RiseAnimation;
import me.topchetoeu.animatedchunks.animation.ScaleAnimation;
import me.topchetoeu.animatedchunks.easing.Ease;
@@ -20,54 +19,27 @@ import me.topchetoeu.animatedchunks.easing.SineEase;
import me.topchetoeu.animatedchunks.gui.AnimatedChunksScreen;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents;
import net.fabricmc.fabric.api.event.Event;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.math.BlockPos;
public final class AnimatedChunks implements ClientModInitializer, ModMenuApi {
private static AnimatedChunks instance;
/**
* Gets the currently running instance of this mod
*/
public static AnimatedChunks getInstance() {
return instance;
}
/**
* An event, fired once, when eases are being registered
* The animator used by the mod. Used to manage animation progress and animate chunks
*/
public final Event<RegisterEvent<Ease>> EASES_REGISTERING = Manager.createEvent();
public final Animator animator;
/**
* An event, fired once, when animations are being registered
* The config manager used by the mod. Used to save/load config from disk
*/
public final Event<RegisterEvent<Animation>> ANIMATIONS_REGISTERING = Manager.createEvent();
public final ConfigManager config;
private ProgressManager progress;
private ConfigManager config;
private Manager<Ease> ease;
private Manager<Animation> animation;
/**
* Gets the config manager
*/
public ConfigManager getConfigManager() {
return config;
}
/**
* Gets the chunk progress manager
*/
public ProgressManager getProgressManager() {
return progress;
}
/**
* Gets the animation manager
*/
public Manager<Animation> getAnimationManager() {
return animation;
}
/**
* Gets the ease manager
*/
public Manager<Ease> getEaseManager() {
return ease;
}
private static void registerEases(Manager<Ease> manager) {
manager.register(new Descriptor<>(new LinearEase(), "linear")
@@ -121,34 +93,35 @@ public final class AnimatedChunks implements ClientModInitializer, ModMenuApi {
@Override public void onInitializeClient() {
instance = this;
progress = new ProgressManager();
ease = new Manager<>(x -> 1);
ease.get()
.description("Ends the animation as soon as it has started.")
.displayName("No animation");
animation = new Manager<>((a, b, c, d, e, f, g, h) -> {});
animation.get()
.description("Does nothing.")
.displayName("No animation");
registerEases(ease);
registerAnimations(animation);
config = new ConfigManager(new File("config/animated-chunks.dat"), animation, ease, progress);
EASES_REGISTERING.invoker().register(ease);
ANIMATIONS_REGISTERING.invoker().register(animation);
ClientChunkEvents.CHUNK_UNLOAD.register((world, chunk) -> {
BlockPos pos = chunk.getPos().getStartPos();
progress.unload(pos.getX(), pos.getY(), pos.getZ());
animator.unload(pos.getX(), pos.getY(), pos.getZ());
});
}
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return (Screen parent) -> {
var _this = getInstance();
return new AnimatedChunksScreen(parent, _this.animation, _this.ease, _this.config, _this.progress);
return new AnimatedChunksScreen(parent, _this.config, _this.animator);
};
}
public AnimatedChunks() {
var eases = new Manager<>(new Descriptor<Ease>(() -> "t = 1;", "default")
.author("TopchetoEU")
.description("Ends the animation as soon as it has started.")
.displayName("No animation")
);
var animations = new Manager<>(new Descriptor<Animation>(() -> ";", "default")
.author("TopchetoEU")
.description("Does nothing.")
.displayName("No animation")
);
registerEases(eases);
registerAnimations(animations);
animator = new Animator(animations, eases);
config = new ConfigManager(new File("config/animated-chunks.dat"), animator);
}
}

View File

@@ -9,15 +9,11 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import me.topchetoeu.animatedchunks.animation.Animation;
import me.topchetoeu.animatedchunks.animation.ProgressManager;
import me.topchetoeu.animatedchunks.easing.Ease;
import me.topchetoeu.animatedchunks.animation.Animator;
public class ConfigManager {
public final File configFile;
private final Manager<Animation> animation;
private final Manager<Ease> ease;
private final ProgressManager progress;
private final Animator animator;
private String readString(InputStream reader) throws IOException {
String res = "";
@@ -56,9 +52,9 @@ public class ConfigManager {
reader.close();
this.animation.set(animation);
this.ease.set(ease);
this.progress.setDuration(duration);
this.animator.ANIMATIONS.set(animation);
this.animator.EASES.set(ease);
this.animator.setDuration(duration);
}
catch (IOException e) {
save();
@@ -67,9 +63,9 @@ public class ConfigManager {
public void save() {
try {
var writer = new FileOutputStream(configFile);
writeString(writer, animation.get().getName());
writeString(writer, ease.get().getName());
writer.write(ByteBuffer.allocate(4).putFloat(progress.getDuration()).array());
writeString(writer, this.animator.ANIMATIONS.get().getName());
writeString(writer, this.animator.EASES.get().getName());
writer.write(ByteBuffer.allocate(4).putFloat(animator.getDuration()).array());
writer.close();
}
catch (IOException e) {
@@ -77,11 +73,9 @@ public class ConfigManager {
}
}
public ConfigManager(File configFile, Manager<Animation> animation, Manager<Ease> ease, ProgressManager progress) {
public ConfigManager(File configFile, Animator animator) {
this.configFile = configFile;
this.animation = animation;
this.ease = ease;
this.progress = progress;
this.animator = animator;
reload();
}

View File

@@ -7,21 +7,7 @@ import java.util.Map;
import org.apache.commons.lang3.Validate;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
public final class Manager<T> {
public static interface RegisterEvent<T> {
public void register(Manager<T> manager);
}
public static final <T> Event<RegisterEvent<T>> createEvent() {
return EventFactory.createArrayBacked(RegisterEvent.class, (listeners) -> (manager) -> {
for (RegisterEvent<T> listener: listeners) {
listener.register(manager);
}
});
}
private String currName = null;
private Map<String, Descriptor<T>> objects = new Hashtable<>();
@@ -75,8 +61,8 @@ public final class Manager<T> {
return Collections.unmodifiableCollection(objects.values());
}
public Manager(T _default) {
register(new Descriptor<>(_default, "default").displayName("Default").author("TopchetoEU"));
public Manager(Descriptor<T> _default) {
register(_default);
set("default");
}
}

View File

@@ -0,0 +1,26 @@
package me.topchetoeu.animatedchunks;
import java.util.Map;
public interface StatementFactory {
/**
* Returns a GLSL statement, with access to at least the following variables:
* <ul>
* <li>playerPos - vec3, the position of the player</li>
* <li>chunkPos - vec3, the position of the current chunk</li>
* <li>pos - vec3, the position of the current vertex</li>
* <li>x - the raw stage of the animation, from 0 to 1</li>
* <li>t - the eased stage of the animation, from 0 to 1</li>
* <li>tmp0 - tmp7 - temporary float variables</li>
* <li>tmp8 - tmp11 - temporary vec3 variables</li>
* <li>tmp12 - tmp15 - temporary vec4 variables</li>
* </ul>
*/
String statement();
/**
* Returns all uniforms that are used by the statement
*/
public default Map<String, Float> uniforms() {
return Map.of();
}
}

View File

@@ -1,18 +1,5 @@
package me.topchetoeu.animatedchunks.animation;
import net.minecraft.client.util.math.MatrixStack;
import me.topchetoeu.animatedchunks.StatementFactory;
public interface Animation {
/**
* Animations using the currently set ease
* @param progress The point at which the animation currently is (a value between 0 and 1)
* @param matrices The matrix stack used for rendering
* @param chunkX The current chunk's x (in blocks) which is animated
* @param chunkY The current chunk's y (in blocks) which is animated
* @param chunkZ The current chunk's z (in blocks) which is animated
* @param playerX The player's x (in blocks)
* @param playerY The player's y (in blocks)
* @param playerZ The player's z (in blocks)
*/
void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ);
}
public interface Animation extends StatementFactory { }

View File

@@ -1,146 +1,152 @@
package me.topchetoeu.animatedchunks.animation;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Hashtable;
public final class ProgressManager {
public static class ChunkLoc {
public final int x;
public final int y;
public final int z;
@Override
public boolean equals(Object obj) {
return obj instanceof ChunkLoc && ((ChunkLoc)obj).x == x && ((ChunkLoc)obj).y == y && ((ChunkLoc)obj).z == z;
}
@Override
public int hashCode() {
return 137 * x + 149 * y + 163 * z;
}
public ChunkLoc(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
}
private Hashtable<ChunkLoc, Float> chunkToStage = new Hashtable<>();
private HashSet<ChunkLoc> chunks = new HashSet<>();
private float duration = 1;
public ProgressManager() {
}
public float getDuration() {
return duration;
}
public void setDuration(float duration) {
this.duration = duration;
}
/**
* Removes all loaded chunks (called when a world is unloaded and loaded)
*/
public void reset() {
chunkToStage.clear();
chunks.clear();
}
/**
* Advances the animation for all tracked chunks, according to the duration and the specified delta
* @param delta The second delta to advance the animation by
*/
public void tick(float delta) {
for (ChunkLoc loc : new ArrayList<>(chunkToStage.keySet())) {
float val = chunkToStage.get(loc);
val += delta / duration;
if (val > 1f) chunkToStage.remove(loc);
chunkToStage.put(loc, val);
}
}
/**
* Loads a specified chunk (starts tracking its animation)
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
*/
public void load(int x, int y, int z) {
if (isChunkLoaded(x, y, z)) return;
ChunkLoc loc = new ChunkLoc(x, y, z);
chunks.add(loc);
chunkToStage.put(loc, 0f);
}
/**
* Unloads a specified chunk (stops tracking its animation)
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
*/
public void unload(int x, int y, int z) {
ChunkLoc loc = new ChunkLoc(x, y, z);
chunkToStage.remove(loc);
chunks.remove(loc);
}
/**
* Unloads all loaded chunks
*/
public void unloadAll() {
chunkToStage.clear();
chunks.clear();
}
/**
* Unloads all the chunks that are outside the render distance specified
* @param viewDistance The view distance (in chunks, radius)
* @param playerChunkX The x coordinate of the chunk in which the player stands
* @param playerChunkY The y coordinate of the chunk in which the player stands
* @param playerChunkZ The z coordinate of the chunk in which the player stands
*/
public void unloadAllFar(int viewDistance, int playerChunkX, int playerChunkY, int playerChunkZ) {
float circleVD = viewDistance + 1.38f;
int squareVD = viewDistance;
for (ChunkLoc loc : new ArrayList<>(chunks)) {
int chunkX = loc.x / 16;
int chunkZ = loc.z / 16;
int diffSquareX = playerChunkX - chunkX ;
int diffSquareZ = playerChunkZ - chunkZ;
int diffCircleX = playerChunkX - chunkX;
int diffCircleZ = playerChunkZ - chunkZ;
int dist = diffCircleX * diffCircleX + diffCircleZ * diffCircleZ;
if (dist > circleVD * circleVD) unload(loc.x, loc.y, loc.z);
if (Math.abs(diffSquareX) > squareVD || Math.abs(diffSquareZ) > squareVD) unload(loc.x, loc.y, loc.z);
}
}
/**
* Checks whether or not a chunk is loaded
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
* @return A value indicating whether or not the specified chunk is tracked
*/
public boolean isChunkLoaded(int x, int y, int z) {
return chunks.contains(new ChunkLoc(x, y, z));
}
/**
* Gets the animation progress of the specified chunk
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
* @return A float value from 0 to 1 (0 if the chunk is not tracked), indicating the animation progress of the specified chunk
*/
public float getChunkProgress(int x, int y, int z) {
if (!isChunkLoaded(x, y, z)) return 0f;
if (!chunkToStage.containsKey(new ChunkLoc(x, y, z))) return 1f;
return chunkToStage.get(new ChunkLoc(x, y, z));
}
}
package me.topchetoeu.animatedchunks.animation;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Hashtable;
import me.topchetoeu.animatedchunks.Manager;
import me.topchetoeu.animatedchunks.easing.Ease;
public final class Animator {
public static class ChunkLoc {
public final int x;
public final int y;
public final int z;
@Override
public boolean equals(Object obj) {
return obj instanceof ChunkLoc && ((ChunkLoc)obj).x == x && ((ChunkLoc)obj).y == y && ((ChunkLoc)obj).z == z;
}
@Override
public int hashCode() {
return 137 * x + 149 * y + 163 * z;
}
public ChunkLoc(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
}
public final Manager<Animation> ANIMATIONS;
public final Manager<Ease> EASES;
private Hashtable<ChunkLoc, Float> chunkToStage = new Hashtable<>();
private HashSet<ChunkLoc> chunks = new HashSet<>();
private float duration = 1;
public Animator(Manager<Animation> animations, Manager<Ease> eases) {
ANIMATIONS = animations;
EASES = eases;
}
public float getDuration() {
return duration;
}
public void setDuration(float duration) {
this.duration = duration;
}
/**
* Removes all loaded chunks (called when a world is unloaded and loaded)
*/
public void reset() {
chunkToStage.clear();
chunks.clear();
}
/**
* Advances the animation for all tracked chunks, according to the duration and the specified delta
* @param delta The second delta to advance the animation by
*/
public void tick(float delta) {
for (ChunkLoc loc : new ArrayList<>(chunkToStage.keySet())) {
float val = chunkToStage.get(loc);
val += delta / duration;
if (val > 1f) chunkToStage.remove(loc);
chunkToStage.put(loc, val);
}
}
/**
* Loads a specified chunk (starts tracking its animation)
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
*/
public void load(int x, int y, int z) {
if (isChunkLoaded(x, y, z)) return;
ChunkLoc loc = new ChunkLoc(x, y, z);
chunks.add(loc);
chunkToStage.put(loc, 0f);
}
/**
* Unloads a specified chunk (stops tracking its animation)
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
*/
public void unload(int x, int y, int z) {
ChunkLoc loc = new ChunkLoc(x, y, z);
chunkToStage.remove(loc);
chunks.remove(loc);
}
/**
* Unloads all loaded chunks
*/
public void unloadAll() {
chunkToStage.clear();
chunks.clear();
}
/**
* Unloads all the chunks that are outside the render distance specified
* @param viewDistance The view distance (in chunks, radius)
* @param playerChunkX The x coordinate of the chunk in which the player stands
* @param playerChunkY The y coordinate of the chunk in which the player stands
* @param playerChunkZ The z coordinate of the chunk in which the player stands
*/
public void unloadAllFar(int viewDistance, int playerChunkX, int playerChunkY, int playerChunkZ) {
float circleVD = viewDistance + 1.38f;
int squareVD = viewDistance;
for (ChunkLoc loc : new ArrayList<>(chunks)) {
int chunkX = loc.x / 16;
int chunkZ = loc.z / 16;
int diffSquareX = playerChunkX - chunkX ;
int diffSquareZ = playerChunkZ - chunkZ;
int diffCircleX = playerChunkX - chunkX;
int diffCircleZ = playerChunkZ - chunkZ;
int dist = diffCircleX * diffCircleX + diffCircleZ * diffCircleZ;
if (dist > circleVD * circleVD) unload(loc.x, loc.y, loc.z);
if (Math.abs(diffSquareX) > squareVD || Math.abs(diffSquareZ) > squareVD) unload(loc.x, loc.y, loc.z);
}
}
/**
* Checks whether or not a chunk is loaded
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
* @return A value indicating whether or not the specified chunk is tracked
*/
public boolean isChunkLoaded(int x, int y, int z) {
return chunks.contains(new ChunkLoc(x, y, z));
}
/**
* Gets the animation progress of the specified chunk
* @param x The x of the chunk
* @param y The y of the chunk
* @param y The z of the chunk
* @return A float value from 0 to 1 (0 if the chunk is not tracked), indicating the animation progress of the specified chunk
*/
public float getChunkProgress(int x, int y, int z) {
if (!isChunkLoaded(x, y, z)) return 0f;
if (!chunkToStage.containsKey(new ChunkLoc(x, y, z))) return 1f;
return chunkToStage.get(new ChunkLoc(x, y, z));
}
}

View File

@@ -1,6 +1,6 @@
package me.topchetoeu.animatedchunks.animation;
import net.minecraft.client.util.math.MatrixStack;
import java.util.Map;
public class FallAnimation implements Animation {
private float offset;
@@ -12,12 +12,11 @@ public class FallAnimation implements Animation {
this.offset = offset;
}
@Override
public void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ) {
animate(progress, matrices);
public Map<String, Float> uniforms() {
return Map.of("animation_f", offset);
}
public void animate(float progress, MatrixStack matrices) {
matrices.translate(0, offset * (1 - progress), 0);
public String statement() {
return "pos += vec3(0, animation_f * (1 - t));";
}
public FallAnimation(float offset) {

View File

@@ -1,7 +1,6 @@
package me.topchetoeu.animatedchunks.animation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec2f;
import java.util.Map;
public class FlyInAnimation implements Animation {
private float offset;
@@ -13,13 +12,21 @@ public class FlyInAnimation implements Animation {
this.offset = offset;
}
@Override
public void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ) {
Vec2f direction = new Vec2f(playerX, playerZ).add(new Vec2f(-chunkX, -chunkZ)).normalize().multiply(-offset);
matrices.translate(direction.x * (1 - progress), 0, direction.y * (1 - progress));
public Map<String, Float> uniforms() {
return Map.of("animation_f", offset);
}
@Override
public String statement() {
return "tmp8 = normalize(chunkPos.xz - playerPos.xz) * animation_f; tmp8 *= (1 - t); pos += tmp8;";
}
// @Override
// public void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ) {
// Vec2f direction = new Vec2f(playerX, playerZ).add(new Vec2f(-chunkX, -chunkZ)).normalize().multiply(-offset);
// matrices.translate(direction.x * (1 - progress), 0, direction.y * (1 - progress));
// }
public FlyInAnimation() {
offset = 50;

View File

@@ -1,6 +1,6 @@
package me.topchetoeu.animatedchunks.animation;
import net.minecraft.client.util.math.MatrixStack;
import java.util.Map;
public final class RiseAnimation implements Animation {
private float offset;
@@ -12,12 +12,11 @@ public final class RiseAnimation implements Animation {
this.offset = offset;
}
@Override
public void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ) {
animate(progress, matrices);
public Map<String, Float> uniforms() {
return Map.of("animation_f", offset);
}
public void animate(float progress, MatrixStack matrices) {
matrices.translate(0, offset * (progress - 1), 0);
public String statement() {
return "pos += vec3(0, animation_f * (t - 1));";
}
public RiseAnimation(float offset) {

View File

@@ -1,10 +1,11 @@
package me.topchetoeu.animatedchunks.animation;
import net.minecraft.client.util.math.MatrixStack;
import java.util.Map;
public class ScaleAnimation implements Animation {
public static float xOffset = 8, yOffset = 8, zOffset = 8;
private boolean scaleY = true;
private float xOffset = 8, yOffset = 8, zOffset = 8;
public boolean isScalingY() {
return scaleY;
@@ -13,38 +14,31 @@ public class ScaleAnimation implements Animation {
this.scaleY = scaleY;
}
public float getXOffset() {
return xOffset;
}
public void setXOffset(float xOffset) {
this.xOffset = xOffset;
}
public float getYOffset() {
return yOffset;
}
public void setYOffset(float yOffset) {
this.yOffset = yOffset;
}
public float getZOffset() {
return zOffset;
}
public void setZOffset(float zOffset) {
this.zOffset = zOffset;
@Override
public Map<String, Float> uniforms() {
return Map.of("animation_ox", xOffset, "animation_oy", yOffset, "animation_oz", zOffset, "animation_sy", scaleY ? 1f : 0f);
}
@Override
public void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ) {
float scaleX = progress;
float scaleZ = progress;
matrices.translate(xOffset, yOffset, zOffset);
matrices.scale(scaleX, 1, scaleZ);
matrices.translate(-xOffset, -yOffset, -zOffset);
public String statement() {
return
"tmp8 = vec3(animation_ox, animation_oy, animation_oz);" +
"tmp9 = vec3(t);" +
"if (animation_sy < .5f) tmp9.y = 0;" +
"pos += tmp8;" +
"pos *= tmp9;" +
"pos -= tmp8;";
}
public ScaleAnimation() {
// @Override
// public void animate(float progress, MatrixStack matrices, int chunkX, int chunkY, int chunkZ, float playerX, float playerY, float playerZ) {
// float scaleX = progress;
// float scaleZ = progress;
}
// matrices.translate(xOffset, yOffset, zOffset);
// matrices.scale(scaleX, 1, scaleZ);
// matrices.translate(-xOffset, -yOffset, -zOffset);
// }
public ScaleAnimation() { }
}

View File

@@ -1,34 +1,30 @@
package me.topchetoeu.animatedchunks.easing;
public interface Ease {
/**
* Converts the linear progress of an animation to an eased progress
* @param x The progress of the animation being eased
* @return The new, eased progress
*/
float ease(float x);
import me.topchetoeu.animatedchunks.StatementFactory;
public interface Ease extends StatementFactory {
/**
* Converts a function to an ease out version of itself.
* Converts a ease-in statement to an ease-out statement
* Mathematically, the function is being "rotated" 180 degrees
* @param func The function to convert
* @return The ease out version of the function
* @param func The ease statement to convert
*/
public static Ease easeOut(Ease func) {
return x -> 1 - func.ease(1 - x);
return () -> "x = 1 - x; " + func.statement() + "x = 1 - x; t = 1 - t;";
// return x -> 1 - func.ease(1 - x);
}
/**
* Converts a function to an ease in-out version of itself.
* Mathematically, the function is being split into two, where in the interval [0; 0.5], the ease-out function is being used, and in the other interval [0.5; 1], the ease-in function is being used
* @param func The function to convert
* @return The ease in-out version of the function
* Converts a ease statement to an ease in-out statement
* Mathematically, the function is being split into two, where in the interval [0; 0.5), the ease-in function is being used, and in the other interval [0.5; 1], the ease-out function is being used
* @param func The ease statement to convert
* @return The ease in-out statement
*/
public static Ease easeInOut(Ease func) {
return x -> {
float x2 = 2 * x;
return () -> "x *= 2; if (x < 1f) { " + easeOut(func) + "} else { x -= 1; " + func.statement() + " } x /= 2;";
// return x -> {
// float x2 = 2 * x;
if (x < 0.5f) return (1 - func.ease(1 - x2)) / 2;
else return (1 + func.ease(x2 - 1)) / 2;
};
// if (x < 0.5f) return (1 - func.ease(1 - x2)) / 2;
// else return (1 + func.ease(x2 - 1)) / 2;
// };
}
}

View File

@@ -1,5 +1,7 @@
package me.topchetoeu.animatedchunks.easing;
import java.util.Map;
public class ElasticEase implements Ease {
private float steepness = 1;
private int periods = 3;
@@ -19,11 +21,21 @@ public class ElasticEase implements Ease {
}
@Override
public float ease(float x) {
float amplitude = (float)Math.pow(2, -steepness * x) * (1 - x);
float wave = (float)Math.sin(2 * Math.PI * periods * x - Math.PI / 2);
public Map<String, Float> uniforms() {
return Map.of("ease_s", steepness, "ease_p", (float)periods);
}
return amplitude * wave + 1;
@Override
public String statement() {
return
"tmp0 = pow(2, -ease_s * x) * (1 - x);" +
"tmp1 = sin(6.28 * ease_p * x - 1.57);" +
"t = tmp0 * tmp1 + 1;";
// float amplitude = (float)Math.pow(2, -steepness * x) * (1 - x);
// float wave = (float)Math.sin(2 * Math.PI * periods * x - Math.PI / 2);
// return amplitude * wave + 1;
}
}

View File

@@ -1,7 +1,7 @@
package me.topchetoeu.animatedchunks.easing;
public class LinearEase implements Ease {
public float ease(float x) {
return x;
public String statement() {
return "t = x;";
}
}

View File

@@ -1,8 +1,7 @@
package me.topchetoeu.animatedchunks.easing;
public class QuadraticEase implements Ease {
@Override
public float ease(float x) {
return x * x;
public String statement() {
return "t = x * x;";
}
}

View File

@@ -1,8 +1,7 @@
package me.topchetoeu.animatedchunks.easing;
public class SineEase implements Ease {
@Override
public float ease(float x) {
return (float)Math.sin(x * Math.PI / 2);
public String statement() {
return "t = sin(x * 1.57);";
}
}

View File

@@ -9,19 +9,15 @@ import net.minecraft.util.Formatting;
import net.minecraft.util.math.ColorHelper.Argb;
import me.topchetoeu.animatedchunks.ConfigManager;
import me.topchetoeu.animatedchunks.Manager;
import me.topchetoeu.animatedchunks.animation.Animation;
import me.topchetoeu.animatedchunks.animation.ProgressManager;
import me.topchetoeu.animatedchunks.easing.Ease;
import me.topchetoeu.animatedchunks.animation.Animator;
import me.topchetoeu.animatedchunks.gui.Section.OrderType;
import net.minecraft.client.MinecraftClient;
public class AnimatedChunksScreen extends Screen {
public final Screen parent;
private final HorizontalSection mainSection = new HorizontalSection();
private final Manager<Animation> animation;
private final Manager<Ease> ease;
private final ConfigManager config;
private final ProgressManager progress;
private final Animator animator;
public static void playClick() {
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0f));
@@ -65,7 +61,7 @@ public class AnimatedChunksScreen extends Screen {
res.x = res.y = 5;
res.title = Text.of("Preview:");
res.children.addSelectableChild(new ChunkPreview(0, 0, 150, 150));
res.children.addSelectableChild(new ChunkPreview(0, 0, 150, 150, animator));
return res;
}
@@ -100,10 +96,10 @@ public class AnimatedChunksScreen extends Screen {
private Section durationSection() {
var res = new HorizontalSection();
res.setTargetWidth(width / 2);
var input = new NumberInput(res, 5, 5, progress.getDuration(), (sender, val) -> {
var input = new NumberInput(res, 5, 5, animator.getDuration(), (sender, val) -> {
if (val <= 0) sender.invalid = true;
else {
progress.setDuration(val);
animator.setDuration(val);
sender.invalid = false;
}
});
@@ -117,18 +113,16 @@ public class AnimatedChunksScreen extends Screen {
var res = new HorizontalSection();
res.x = res.y = 5;
res.title = Text.of("Animation config:");
res.children.addSelectableChild(selectionSection(animation, "Animation"));
res.children.addSelectableChild(selectionSection(ease, "Ease"));
res.children.addSelectableChild(selectionSection(animator.ANIMATIONS, "Animation"));
res.children.addSelectableChild(selectionSection(animator.EASES, "Ease"));
res.children.addSelectableChild(durationSection());
return res;
}
public AnimatedChunksScreen(Screen parent, Manager<Animation> animation, Manager<Ease> ease, ConfigManager config, ProgressManager progress) {
public AnimatedChunksScreen(Screen parent, ConfigManager config, Animator animator) {
super(Text.of("Animated Chunks Config"));
config.reload();
this.progress = progress;
this.animation = animation;
this.ease = ease;
this.animator = animator;
this.config = config;
mainSection.x = mainSection.y = 5;

View File

@@ -5,7 +5,7 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.systems.RenderSystem;
import me.topchetoeu.animatedchunks.AnimatedChunks;
import me.topchetoeu.animatedchunks.animation.Animator;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.DrawableHelper;
@@ -31,8 +31,10 @@ public class ChunkPreview extends DrawableHelper implements Drawable, Element, S
void onClick();
}
public ClickAction clickAction;
public final MinecraftClient client;
public final Animator animator;
public ClickAction clickAction;
private boolean clicked = false;
private boolean rotating = false;
private boolean focused = false;
@@ -158,23 +160,30 @@ public class ChunkPreview extends DrawableHelper implements Drawable, Element, S
RenderSystem.enableBlend();
}
private void renderChunk(MatrixStack matrices, int x, int y, int n, float delta) {
duration = animator.getDuration();
float progress = globalProgress / duration - (float)Math.sqrt(x * x + y * y) / (float)n / 2;
if (progress > 1) progress = 1;
if (progress <= 0) return;
matrices.push();
matrices.translate(x * 16 - 8, 0, y * 16 - 8);
// x += n;
// y += n;
float progress = globalProgress / duration - (float)Math.sqrt(x * x + y * y) / (float)n / 2;
if (progress < 0) progress = 0;
if (progress > 1) progress = 1;
if (progress < 0.999) {
float _progress = AnimatedChunks.getInstance().getEaseManager().getValue().ease(progress);
AnimatedChunks.getInstance().getAnimationManager().getValue().animate(
_progress, matrices,
x * 16, 0, y * 16, 0, 0, 0
);
// matrices.translate(0, 0, 16);
}
// animator.animate(matrices, progress, new BlockPos(x * 16, 0, y * 16));
// if (progress < 0) progress = 0;
// if (progress > 1) progress = 1;
// if (progress < 0.999) {
// float _progress = animator.EASES.getValue().ease(progress);
// AnimatedChunks.getInstance().getAnimationManager().getValue().animate(
// _progress, matrices,
// x * 16, 0, y * 16, 0, 0, 0
// );
// // matrices.translate(0, 0, 16);
// }
matrices.translate(0, 0, 16);
matrices.multiply(rotation);
myFill(matrices, 2, 1, 14, 2, progress, 1, 1, 1);
@@ -185,7 +194,6 @@ public class ChunkPreview extends DrawableHelper implements Drawable, Element, S
matrices.pop();
}
private void renderChunks(MatrixStack matrices, float delta, int n) {
duration = AnimatedChunks.getInstance().getProgressManager().getDuration();
// globalProgress += (lastTime - (lastTime = System.nanoTime())) / -1000000000f;
globalProgress += delta * 0.05f;
matrices.push();
@@ -316,16 +324,18 @@ public class ChunkPreview extends DrawableHelper implements Drawable, Element, S
return false;
}
public ChunkPreview(int x, int y) {
public ChunkPreview(int x, int y, Animator animator) {
this.client = MinecraftClient.getInstance();
this.x = x;
this.y = y;
this.animator = animator;
}
public ChunkPreview(int x, int y, int w, int h) {
public ChunkPreview(int x, int y, int w, int h, Animator animator) {
this.client = MinecraftClient.getInstance();
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.animator = animator;
}
}

View File

@@ -11,12 +11,12 @@ import net.minecraft.util.math.BlockPos;
// From flogic's mod
@Mixin(ChunkBuilder.BuiltChunk.class)
abstract class BuiltChunkMixin {
public abstract class BuiltChunkMixin {
@Inject(method = "clear", at = @At(value = "TAIL"), cancellable = true)
public void clear(CallbackInfo ci) {
// ci.cancel();
// return;
BlockPos origin = ((ChunkBuilder.BuiltChunk)(Object)this).getOrigin();
AnimatedChunks.getInstance().getProgressManager().unload(origin.getX(), 0, origin.getZ());
AnimatedChunks.getInstance().animator.unload(origin.getX(), 0, origin.getZ());
}
}

View File

@@ -22,22 +22,17 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import me.topchetoeu.animatedchunks.AnimatedChunks;
import me.topchetoeu.animatedchunks.animation.ProgressManager;
@Mixin(WorldRenderer.class)
abstract class WorldRendererMixin {
public abstract class WorldRendererMixin {
private long lastTime = System.nanoTime();
@Accessor abstract BuiltChunkStorage getChunks();
private ProgressManager getProgressManager() {
return AnimatedChunks.getInstance().getProgressManager();
}
@Inject(method = "render", at = @At(value = "HEAD"))
private void renderStart(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) {
long currTime = System.nanoTime();
getProgressManager().tick((currTime - lastTime) / 1000000000f);
AnimatedChunks.getInstance().animator.tick((currTime - lastTime) / 1000000000f);
lastTime = currTime;
}
@@ -51,7 +46,7 @@ abstract class WorldRendererMixin {
if (playerY < 0) chunkY--;
if (playerZ < 0) chunkZ--;
getProgressManager().unloadAllFar((int)((WorldRenderer)(Object)this).getViewDistance(), chunkX, chunkY, chunkZ);
AnimatedChunks.getInstance().animator.unloadAllFar((int)((WorldRenderer)(Object)this).getViewDistance(), chunkX, chunkY, chunkZ);
}
@Inject(method = "renderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gl/VertexBuffer;drawElements()V"), locals=LocalCapture.CAPTURE_FAILHARD)
private void renderChunkBefore(RenderLayer renderLayer, MatrixStack matrices, double playerX, double playerY, double playerZ, Matrix4f positionMatrix, CallbackInfo ci,
@@ -59,28 +54,26 @@ abstract class WorldRendererMixin {
matrices.push();
int x = chunk.getOrigin().getX();
int y = chunk.getOrigin().getY();
int z = chunk.getOrigin().getZ();
// AnimatedChunks.getInstance().animator.animate(matrices, new BlockPos(chunk.getOrigin().getX(), 0, chunk.getOrigin().getZ()), new Vector3d(playerX, playerY, playerZ));
if (getProgressManager().isChunkLoaded(x, 0, z)) {
float progress = getProgressManager().getChunkProgress(x, 0, z);
// if (getProgressManager().isChunkLoaded(x, 0, z)) {
// float progress = getProgressManager().getChunkProgress(x, 0, z);
if (progress < 0.999) {
progress = AnimatedChunks.getInstance().getEaseManager().getValue().ease(progress);
// if (progress < 0.999) {
// progress = AnimatedChunks.getInstance().getEaseManager().getValue().ease(progress);
float centerX = (float)playerX - x;
float centerY = (float)playerY - y;
float centerZ = (float)playerZ - z;
// float centerX = (float)playerX - x;
// float centerY = (float)playerY - y;
// float centerZ = (float)playerZ - z;
matrices.translate(-centerX, -centerY, -centerZ);
AnimatedChunks.getInstance().getAnimationManager().getValue().animate(progress, matrices, x, y, z, (float)playerX, (float)playerY, (float)playerZ);
matrices.translate(centerX, centerY, centerZ);
}
}
else {
matrices.scale(0, 0, 0);
}
// matrices.translate(-centerX, -centerY, -centerZ);
// AnimatedChunks.getInstance().getAnimationManager().getValue().animate(progress, matrices, x, y, z, (float)playerX, (float)playerY, (float)playerZ);
// matrices.translate(centerX, centerY, centerZ);
// }
// }
// else {
// matrices.scale(0, 0, 0);
// }
shader.modelViewMat.set(matrices.peek().getPositionMatrix());
matrices.pop();
@@ -91,6 +84,6 @@ abstract class WorldRendererMixin {
boolean _1, ObjectListIterator<?> _2, Shader shader, GlUniform _4, ChunkInfo _6, BuiltChunk chunk) {
int x = chunk.getOrigin().getX();
int z = chunk.getOrigin().getZ();
getProgressManager().load(x, 0, z);
AnimatedChunks.getInstance().animator.load(x, 0, z);
}
}

View File

@@ -27,7 +27,6 @@
"modmenu": ">=4.0.0"
},
"breaks": {
"sodium": "*",
"iris": "*"
"sodium": "*"
}
}