Disable LazyYCondition logic in situations where it has no effect
This saves roughly 10% of time in surface rule evaluation in some tests. Closes #585 Co-authored-by: Voidsong Dragonfly <voidsongdragonfly@pm.me>
This commit is contained in:
parent
f71277eb64
commit
25976f3b87
|
|
@ -0,0 +1,30 @@
|
|||
package org.embeddedt.modernfix.common.mixin.perf.worldgen_allocation;
|
||||
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(targets = {
|
||||
"net/minecraft/world/level/levelgen/SurfaceRules$BiomeConditionSource$1BiomeCondition",
|
||||
"net/minecraft/world/level/levelgen/SurfaceRules$StoneDepthCheck$1StoneDepthCondition",
|
||||
"net/minecraft/world/level/levelgen/SurfaceRules$VerticalGradientConditionSource$1VerticalGradientCondition",
|
||||
"net/minecraft/world/level/levelgen/SurfaceRules$WaterConditionSource$1WaterCondition",
|
||||
"net/minecraft/world/level/levelgen/SurfaceRules$YConditionSource$1YCondition",
|
||||
})
|
||||
public abstract class SurfaceRulesMixin extends SurfaceRules.LazyCondition {
|
||||
protected SurfaceRulesMixin(SurfaceRules.Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author VoidsongDragonfly
|
||||
* @reason Replacing Vanilla's use of {@link SurfaceRules.LazyYCondition LazyYCondition} that causes performance
|
||||
* detriments due to unused caching behavior. The `lastUpdateY` field is updated every time the block position
|
||||
* changes (making the cache useful only within a single block), and the targeted condition objects are not interned
|
||||
* (meaning there is no caching happening anyway, as each instance uses its own cache).
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean test() {
|
||||
return compute();
|
||||
}
|
||||
}
|
||||
|
|
@ -11,8 +11,11 @@ accessible field net/minecraft/world/level/Level blockEntityTickers Ljava/util/L
|
|||
accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType
|
||||
accessible method net/minecraft/nbt/CompoundTag <init> (Ljava/util/Map;)V
|
||||
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$Condition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$LazyCondition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$SequenceRule
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$SurfaceRule
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$Context
|
||||
accessible class net/minecraft/world/level/levelgen/DensityFunctions$Marker
|
||||
accessible class net/minecraft/world/level/levelgen/DensityFunctions$Marker$Type
|
||||
accessible method net/minecraft/world/level/levelgen/DensityFunctions$Marker <init> (Lnet/minecraft/world/level/levelgen/DensityFunctions$Marker$Type;Lnet/minecraft/world/level/levelgen/DensityFunction;)V
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user