Update to 1.16.4 and optimize distance check

Update to 1.16.4 & partially optimize rendering
This commit is contained in:
flogic 2020-11-03 01:35:14 -07:00
parent b313e8ba0d
commit a675d34f6d
No known key found for this signature in database
GPG Key ID: AD25E4DF29DECD31
4 changed files with 21 additions and 19 deletions

View File

@ -31,17 +31,17 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Cloth Config / Autoconfig // Cloth Config / Autoconfig
modImplementation("me.shedaniel.cloth:config-2:4.8.2") { modImplementation("me.shedaniel.cloth:config-2:${project.cloth_version}") {
exclude(group: "net.fabricmc.fabric-api") exclude(group: "net.fabricmc.fabric-api")
exclude(module: "modmenu") exclude(module: "modmenu")
} }
modImplementation("me.sargunvohra.mcmods:autoconfig1u:3.2.2") { modImplementation("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}") {
exclude(group: "net.fabricmc.fabric-api") exclude(group: "net.fabricmc.fabric-api")
} }
include("me.shedaniel.cloth:config-2:4.8.2") include("me.shedaniel.cloth:config-2:${project.cloth_version}")
include("me.sargunvohra.mcmods:autoconfig1u:3.2.2") include("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}")
modImplementation("io.github.prospector:modmenu:1.14.6+build.31") modImplementation("io.github.prospector:modmenu:${project.modmenu_version}")
} }
minecraft { minecraft {

View File

@ -2,12 +2,15 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
minecraft_version=1.16.3 minecraft_version=1.16.4
yarn_mappings=1.16.3+build.47 yarn_mappings=1.16.4+build.1
loader_version=0.10.6+build.214 loader_version=0.10.6+build.214
# Mod Properties # Mod Properties
mod_version=1.0.0 mod_version=1.0.0
maven_group=cc.flogi.dev maven_group=cc.flogi.dev
archives_base_name=smooth-chunks archives_base_name=smooth-chunks
# Dependencies # Dependencies
fabric_version=0.25.0+build.415-1.16 fabric_version=0.25.1+build.416-1.16
autoconfig_version=3.3.1
cloth_version=4.8.2
modmenu_version=1.14.6+build.31

View File

@ -14,9 +14,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.Vec3i;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.WeakHashMap;
/** /**
* @author Caden Kriese (flogic) * @author Caden Kriese (flogic)
@ -24,9 +22,13 @@ import java.util.WeakHashMap;
* Created on 09/27/2020 * Created on 09/27/2020
*/ */
public final class ChunkAnimationHandler { public final class ChunkAnimationHandler {
/*TODO use Reference2ReferenceLinkedHashMap from FastUtil or just inject the AnimationController directly into BuiltChunk.
* Need to solve concurrency issue as currently #addChunk is called from both render & worker threads.
*/
private static final ChunkAnimationHandler instance = new ChunkAnimationHandler(); private static final ChunkAnimationHandler instance = new ChunkAnimationHandler();
private final WeakHashMap<ChunkBuilder.BuiltChunk, AnimationController> animations = new WeakHashMap<>(); private final Map<ChunkBuilder.BuiltChunk, AnimationController> animations = new HashMap<>();
@Getter private final List<Vec3i> loadedChunks = new ArrayList<>(); @Getter private final Set<Vec3i> loadedChunks = new HashSet<>();
public static ChunkAnimationHandler get() {return instance;} public static ChunkAnimationHandler get() {return instance;}
@ -64,12 +66,9 @@ public final class ChunkAnimationHandler {
BlockPos finalPos = controller.getFinalPos(); BlockPos finalPos = controller.getFinalPos();
if (config.isDisableNearby()) { if (config.isDisableNearby() && (finalPos.getX()*finalPos.getX() + finalPos.getZ()*finalPos.getZ()) < 32*32)
Vec3i cameraPos = MinecraftClient.getInstance().getCameraEntity().getBlockPos(); return;
Vec3i chunkPos = new Vec3i(finalPos.getX() + 8, cameraPos.getY(), finalPos.getZ() + 8);
if (chunkPos.isWithinDistance(cameraPos, 32)) return;
}
double completion = (double) (System.currentTimeMillis() - controller.getStartTime()) / config.getDuration() / 1000d; double completion = (double) (System.currentTimeMillis() - controller.getStartTime()) / config.getDuration() / 1000d;
completion = UtilEasing.easeOutSine(Math.min(completion, 1.0)); completion = UtilEasing.easeOutSine(Math.min(completion, 1.0));

View File

@ -33,6 +33,6 @@
"depends": { "depends": {
"fabricloader": ">=0.9.3+build.207", "fabricloader": ">=0.9.3+build.207",
"fabric": "*", "fabric": "*",
"minecraft": "1.16.3" "minecraft": ">=1.16.2"
} }
} }