mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
optimize waypoint
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: hayanesuru <hayanesuru@outlook.jp>
|
||||
Date: Fri, 4 Jul 2025 03:13:33 +0900
|
||||
Subject: [PATCH] optimize waypoint
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 5ee9394fd35a9f61e6a54126ed2c567dff19c05b..502c6afe9ff8cb3d163862920794f15cec2f78a8 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -5117,12 +5117,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return;
|
||||
}
|
||||
// Paper end - Block invalid positions and bounding box
|
||||
+ boolean blockUpdated; // Leaf - optimize waypoint
|
||||
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||
this.position = new Vec3(x, y, z);
|
||||
int floor = Mth.floor(x);
|
||||
int floor1 = Mth.floor(y);
|
||||
int floor2 = Mth.floor(z);
|
||||
- if (floor != this.blockPosition.getX() || floor1 != this.blockPosition.getY() || floor2 != this.blockPosition.getZ()) {
|
||||
+ blockUpdated = floor != this.blockPosition.getX() || floor1 != this.blockPosition.getY() || floor2 != this.blockPosition.getZ(); // Leaf - optimize waypoint
|
||||
+ if (blockUpdated) { // Leaf - optimize waypoint
|
||||
this.blockPosition = new BlockPos(floor, floor1, floor2);
|
||||
this.inBlockState = null;
|
||||
if (SectionPos.blockToSectionCoord(floor) != this.chunkPosition.x || SectionPos.blockToSectionCoord(floor2) != this.chunkPosition.z) {
|
||||
@@ -5131,7 +5133,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
this.levelCallback.onMove();
|
||||
- if (!this.firstTick && this.level instanceof ServerLevel serverLevel && !this.isRemoved()) {
|
||||
+ if ((org.dreeam.leaf.config.modules.opt.OptimizeWaypoint.enabled && blockUpdated) && !this.firstTick && this.level instanceof ServerLevel serverLevel && !this.isRemoved()) { // Leaf - optimize waypoint
|
||||
if (this instanceof WaypointTransmitter waypointTransmitter && waypointTransmitter.isTransmittingWaypoint()) {
|
||||
serverLevel.getWaypointManager().updateWaypoint(waypointTransmitter);
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class OptimizeBiome extends ConfigModules {
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config().getBoolean(getBasePath() + ".enabled", enabled);
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
|
||||
mobSpawn = config.getBoolean(getBasePath() + ".mob-spawning", false);
|
||||
advancement = config.getBoolean(getBasePath() + ".advancements", false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.dreeam.leaf.config.modules.opt;
|
||||
|
||||
import org.dreeam.leaf.config.ConfigModules;
|
||||
import org.dreeam.leaf.config.EnumConfigCategory;
|
||||
import org.dreeam.leaf.config.annotations.Experimental;
|
||||
|
||||
public class OptimizeWaypoint extends ConfigModules {
|
||||
public String getBasePath() {
|
||||
return EnumConfigCategory.PERF.getBaseKeyName() + ".optimize-waypoint";
|
||||
}
|
||||
|
||||
@Experimental
|
||||
public static boolean enabled = false;
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath(), enabled);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,6 @@ public class OptimizedPoweredRails extends ConfigModules {
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config().getBoolean(getBasePath(), enabled);
|
||||
enabled = config.getBoolean(getBasePath(), enabled);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user