Merge remote-tracking branch 'origin/1.20' into 1.21.1
This commit is contained in:
parent
fd8f6689fb
commit
8ae2dbf876
|
|
@ -89,6 +89,7 @@ repositories {
|
||||||
}
|
}
|
||||||
filter {
|
filter {
|
||||||
includeGroup "dev.latvian.mods"
|
includeGroup "dev.latvian.mods"
|
||||||
|
includeGroup "dev.latvian.apps"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exclusiveContent {
|
exclusiveContent {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.mixinextras_version}"))
|
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.mixinextras_version}"))
|
||||||
|
|
||||||
modCompileOnly("dev.latvian.mods:kubejs:${kubejs_version}") {
|
modCompileOnly("dev.latvian.mods:kubejs-neoforge:${kubejs_version}") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
modApi("dev.latvian.mods:rhino:${rhino_version}") {
|
modApi("dev.latvian.mods:rhino:${rhino_version}") {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ rei_version=13.0.678
|
||||||
ctm_version=5541286
|
ctm_version=5541286
|
||||||
# ctm_version=1.21-1.2.0+2
|
# ctm_version=1.21-1.2.0+2
|
||||||
ldlib_version=5782845
|
ldlib_version=5782845
|
||||||
kubejs_version=2001.6.5-build.16
|
kubejs_version=2101.7.1-build.181
|
||||||
rhino_version=2001.2.3-build.10
|
rhino_version=2101.2.7-build.74
|
||||||
supported_minecraft_versions=1.21.5
|
supported_minecraft_versions=1.21.5
|
||||||
|
|
||||||
fabric_loader_version=0.16.10
|
fabric_loader_version=0.16.10
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ dependencies {
|
||||||
|
|
||||||
modCompileOnly("curse.maven:jeresources-240630:3951643")
|
modCompileOnly("curse.maven:jeresources-240630:3951643")
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}") { transitive false }
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}") { transitive false }
|
||||||
modCompileOnly("dev.latvian.mods:kubejs-forge:${kubejs_version}")
|
modCompileOnly("dev.latvian.mods:kubejs-neoforge:${kubejs_version}") {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
//modRuntimeOnly("curse.maven:ferritecore-429235:4441949")
|
//modRuntimeOnly("curse.maven:ferritecore-429235:4441949")
|
||||||
modCompileOnly("curse.maven:CTM-267602:${ctm_version}")
|
modCompileOnly("curse.maven:CTM-267602:${ctm_version}")
|
||||||
modCompileOnly("curse.maven:ldlib-626676:${ldlib_version}")
|
modCompileOnly("curse.maven:ldlib-626676:${ldlib_version}")
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package org.embeddedt.modernfix.neoforge.mixin.perf.kubejs;
|
|
||||||
|
|
||||||
import dev.latvian.mods.kubejs.recipe.RecipesEventJS;
|
|
||||||
import org.embeddedt.modernfix.ModernFix;
|
|
||||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mixin(RecipesEventJS.class)
|
|
||||||
@RequiresMod("kubejs")
|
|
||||||
public class RecipeEventJSMixin {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The recipe event object can be leaked in scripts and this wastes 40MB of memory.
|
|
||||||
*/
|
|
||||||
@Inject(method = "post", at = @At("RETURN"), remap = false)
|
|
||||||
private void clearRecipeLists(CallbackInfo ci) {
|
|
||||||
ModernFix.LOGGER.info("Clearing KubeJS recipe lists...");
|
|
||||||
// Even though we are a mixin class, use reflection so this works across a variety of versions
|
|
||||||
Field[] fields = RecipesEventJS.class.getDeclaredFields();
|
|
||||||
for(Field f : fields) {
|
|
||||||
try {
|
|
||||||
if(!Modifier.isStatic(f.getModifiers())
|
|
||||||
&& (Collection.class.isAssignableFrom(f.getType())
|
|
||||||
|| Map.class.isAssignableFrom(f.getType()))
|
|
||||||
) {
|
|
||||||
f.setAccessible(true);
|
|
||||||
Object collection = f.get(this);
|
|
||||||
int size;
|
|
||||||
if(collection instanceof Map) {
|
|
||||||
size = ((Map<?, ?>)collection).size();
|
|
||||||
((Map<?, ?>)collection).clear();
|
|
||||||
} else if(collection instanceof Collection) {
|
|
||||||
size = ((Collection<?>)collection).size();
|
|
||||||
((Collection<?>)collection).clear();
|
|
||||||
} else
|
|
||||||
throw new IllegalStateException();
|
|
||||||
ModernFix.LOGGER.debug("Cleared {} with {} entries", f.getName(), size);
|
|
||||||
}
|
|
||||||
} catch(RuntimeException | ReflectiveOperationException e) {
|
|
||||||
ModernFix.LOGGER.debug("Uh oh, couldn't clear field", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user