Use up to 255 worker threads (matches 1.18)
This commit is contained in:
parent
17ee79c2a2
commit
d13fb0850d
25
src/main/java/org/embeddedt/modernfix/mixin/UtilMixin.java
Normal file
25
src/main/java/org/embeddedt/modernfix/mixin/UtilMixin.java
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.embeddedt.modernfix.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.util.Util;
|
||||||
|
import org.embeddedt.modernfix.ModernFix;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(Util.class)
|
||||||
|
public class UtilMixin {
|
||||||
|
@ModifyConstant(method = "makeExecutor", constant = @Constant(intValue = 7))
|
||||||
|
private static int useHigherThreadCount(int old) {
|
||||||
|
String requestedMax = System.getProperty("max.bg.threads");
|
||||||
|
if(requestedMax != null) {
|
||||||
|
try {
|
||||||
|
int newMax = Integer.parseInt(requestedMax);
|
||||||
|
if(newMax >= 1 && newMax <= 255)
|
||||||
|
return newMax;
|
||||||
|
} catch(NumberFormatException e) {
|
||||||
|
ModernFix.LOGGER.error("max.bg.threads is not a number");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
"SaveFormatAccessor",
|
"SaveFormatAccessor",
|
||||||
"AbstractBlockStateMixin",
|
"AbstractBlockStateMixin",
|
||||||
"GameDataMixin",
|
"GameDataMixin",
|
||||||
"BlockCallbacksMixin"
|
"BlockCallbacksMixin",
|
||||||
|
"UtilMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"MinecraftMixin",
|
"MinecraftMixin",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user