File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
java/org/embeddedt/modernfix/common/mixin/perf/worldgen_allocation Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .embeddedt .modernfix .common .mixin .perf .worldgen_allocation ;
2+
3+ import net .minecraft .world .level .levelgen .SurfaceRules ;
4+ import org .spongepowered .asm .mixin .Mixin ;
5+
6+ @ Mixin (targets = {
7+ "net/minecraft/world/level/levelgen/SurfaceRules$BiomeConditionSource$1BiomeCondition" ,
8+ "net/minecraft/world/level/levelgen/SurfaceRules$StoneDepthCheck$1StoneDepthCondition" ,
9+ "net/minecraft/world/level/levelgen/SurfaceRules$VerticalGradientConditionSource$1VerticalGradientCondition" ,
10+ "net/minecraft/world/level/levelgen/SurfaceRules$WaterConditionSource$1WaterCondition" ,
11+ "net/minecraft/world/level/levelgen/SurfaceRules$YConditionSource$1YCondition" ,
12+ })
13+ public abstract class SurfaceRulesMixin extends SurfaceRules .LazyCondition {
14+ protected SurfaceRulesMixin (SurfaceRules .Context context ) {
15+ super (context );
16+ }
17+
18+ /**
19+ * @author VoidsongDragonfly
20+ * @reason Replacing Vanilla's use of {@link SurfaceRules.LazyYCondition LazyYCondition} that causes performance
21+ * detriments due to unused caching behavior. The `lastUpdateY` field is updated every time the block position
22+ * changes (making the cache useful only within a single block), and the targeted condition objects are not interned
23+ * (meaning there is no caching happening anyway, as each instance uses its own cache).
24+ *
25+ */
26+ @ Override
27+ public boolean test () {
28+ return compute ();
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -11,8 +11,11 @@ accessible field net/minecraft/world/level/Level blockEntityTickers Ljava/util/L
1111accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType
1212accessible method net/minecraft/nbt/CompoundTag <init> (Ljava/util/Map;)V
1313
14+ accessible class net/minecraft/world/level/levelgen/SurfaceRules$Condition
15+ accessible class net/minecraft/world/level/levelgen/SurfaceRules$LazyCondition
1416accessible class net/minecraft/world/level/levelgen/SurfaceRules$SequenceRule
1517accessible class net/minecraft/world/level/levelgen/SurfaceRules$SurfaceRule
18+ accessible class net/minecraft/world/level/levelgen/SurfaceRules$Context
1619accessible class net/minecraft/world/level/levelgen/DensityFunctions$Marker
1720accessible class net/minecraft/world/level/levelgen/DensityFunctions$Marker$Type
1821accessible method net/minecraft/world/level/levelgen/DensityFunctions$Marker <init> (Lnet/minecraft/world/level/levelgen/DensityFunctions$Marker$Type;Lnet/minecraft/world/level/levelgen/DensityFunction;)V
You can’t perform that action at this time.
0 commit comments