-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back sun burn tick optimization of Gale
- Loading branch information
1 parent
25091d3
commit 0fd3883
Showing
26 changed files
with
76 additions
and
17 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...Optimize-villager-data-storage.patc.patch → ...Optimize-villager-data-storage.patc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
patches/server/0036-Sync-with-Gale-s-Optimize-sun-burn-tick.patch.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> | ||
Date: Sat, 3 Feb 2024 04:25:45 -0500 | ||
Subject: [PATCH] Sync with Gale's Optimize-sun-burn-tick.patch | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java | ||
index fc77f4ec5234ad0d450a8fa74f316b4355033022..e518c53123f04475d66dd2383ba9034d5ed17ef5 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/Entity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java | ||
@@ -567,13 +567,29 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S | ||
} | ||
|
||
// Purpur start - copied from Mob | ||
+ // Gale start - JettPack - optimize sun burn tick - cache eye blockpos | ||
+ private BlockPos cached_eye_blockpos; | ||
+ private int cached_position_hashcode; | ||
+ // Gale end - JettPack - optimize sun burn tick - cache eye blockpos | ||
+ | ||
public boolean isSunBurnTick() { | ||
if (this.level().isDay() && !this.level().isClientSide) { | ||
- float f = this.getLightLevelDependentMagicValue(); | ||
- BlockPos blockposition = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); | ||
+ // Gale start - JettPack - optimize sun burn tick - optimizations and cache eye blockpos | ||
+ int positionHashCode = this.position.hashCode(); | ||
+ if (this.cached_position_hashcode != positionHashCode) { | ||
+ this.cached_eye_blockpos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); | ||
+ this.cached_position_hashcode = positionHashCode; | ||
+ } | ||
+ | ||
+ float f = this.getLightLevelDependentMagicValue(cached_eye_blockpos); // Pass BlockPos to getBrightness | ||
+ | ||
+ // Check brightness first | ||
+ if (f <= 0.5F) return false; | ||
+ if (this.random.nextFloat() * 30.0F >= (f - 0.4F) * 2.0F) return false; | ||
+ // Gale end - JettPack - optimize sun burn tick - optimizations and cache eye blockpos | ||
boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow; | ||
|
||
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && !flag && this.level().canSeeSky(blockposition)) { | ||
+ if (!flag && this.level().canSeeSky(this.cached_eye_blockpos)) { // Gale - JettPack - optimize sun burn tick - optimizations and cache eye blockpos | ||
return true; | ||
} | ||
} | ||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java | ||
index b171c53efae9cc39bc68164fbe0f90afb47769be..8d18d64ef57b6270f098ff1fab8d8a30bb779b44 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/Mob.java | ||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java | ||
@@ -1733,11 +1733,6 @@ public abstract class Mob extends LivingEntity implements Targeting { | ||
|
||
} | ||
|
||
- // Gale start - JettPack - optimize sun burn tick - cache eye blockpos | ||
- private BlockPos cached_eye_blockpos; | ||
- private int cached_position_hashcode; | ||
- // Gale end - JettPack - optimize sun burn tick - cache eye blockpos | ||
- | ||
public boolean isSunBurnTick() { | ||
return super.isSunBurnTick(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.