-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Reuse a single ThreadingDetector instance for all PalettedContainers (#…
…14) We make all instance methods on ThreadingDetector no-op already, so no point in keeping multiple instances around. This saves around 100mb in my ATM10 SP world.
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...in/java/ca/spottedleaf/moonrise/mixin/util_threading_detector/PalettedContainerMixin.java
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,29 @@ | ||
package ca.spottedleaf.moonrise.mixin.util_threading_detector; | ||
|
||
import net.minecraft.util.ThreadingDetector; | ||
import net.minecraft.world.level.chunk.PalettedContainer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(PalettedContainer.class) | ||
abstract class PalettedContainerMixin { | ||
@Unique | ||
private static final ThreadingDetector THREADING_DETECTOR = new ThreadingDetector("PalettedContainer"); | ||
|
||
/** | ||
* @reason our ThreadingDetectorMixin makes all instance methods no-op, no use in having multiple instances | ||
* @author jpenilla | ||
*/ | ||
@Redirect( | ||
method = "<init>*", | ||
at = @At( | ||
value = "NEW", | ||
target = "Lnet/minecraft/util/ThreadingDetector;" | ||
) | ||
) | ||
private static ThreadingDetector threadingDetector(final String name) { | ||
return THREADING_DETECTOR; | ||
} | ||
} |
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