Merge remote-tracking branch 'origin/1.20' into 1.21.1

This commit is contained in:
embeddedt 2025-05-15 21:45:35 -04:00
commit 6f3f75416f
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
5 changed files with 8 additions and 57 deletions

View File

@ -84,11 +84,12 @@ repositories {
exclusiveContent {
forRepository {
maven {
url = 'https://maven.saps.dev/minecraft'
url = 'https://maven.latvian.dev/releases'
}
}
filter {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}
exclusiveContent {

View File

@ -12,7 +12,7 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_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
}
modApi("dev.latvian.mods:rhino:${rhino_version}") {

View File

@ -15,8 +15,8 @@ jei_version=19.0.0.9
rei_version=13.0.678
ctm_version=1.21-1.2.0+2
ldlib_version=5782845
kubejs_version=1902.6.0-build.142
rhino_version=1902.2.2-build.268
kubejs_version=2101.7.1-build.181
rhino_version=2101.2.7-build.74
supported_minecraft_versions=1.21.1
fabric_loader_version=0.16.10

View File

@ -52,7 +52,9 @@ dependencies {
modCompileOnly("curse.maven:jeresources-240630:3951643")
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")
modCompileOnly("team.chisel.ctm:CTM:${ctm_version}")
modCompileOnly("curse.maven:ldlib-626676:${ldlib_version}")

View File

@ -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);
}
}
}
}