Merge remote-tracking branch 'origin/1.18' into 1.19.2
This commit is contained in:
commit
0568c8f841
|
|
@ -29,6 +29,7 @@ configurations {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
|
modIncludeImplementation(fabricApi.module("fabric-api-base", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modIncludeImplementation(fabricApi.module("fabric-screen-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modIncludeImplementation(fabricApi.module("fabric-screen-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
// Remove the next line if you don't want to depend on the API
|
// Remove the next line if you don't want to depend on the API
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.fabric.mixin.perf.dynamic_resources;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.RemovalNotification;
|
import com.google.common.cache.RemovalNotification;
|
||||||
|
import com.google.common.collect.ForwardingMap;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.mojang.math.Transformation;
|
import com.mojang.math.Transformation;
|
||||||
|
|
@ -45,6 +46,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
@ -103,7 +105,19 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
|
||||||
.softValues()
|
.softValues()
|
||||||
.build();
|
.build();
|
||||||
this.bakedCache = loadedBakedModels.asMap();
|
this.bakedCache = loadedBakedModels.asMap();
|
||||||
this.unbakedCache = loadedModels.asMap();
|
ConcurrentMap<ResourceLocation, UnbakedModel> unbakedCacheBackingMap = loadedModels.asMap();
|
||||||
|
this.unbakedCache = new ForwardingMap<ResourceLocation, UnbakedModel>() {
|
||||||
|
@Override
|
||||||
|
protected Map<ResourceLocation, UnbakedModel> delegate() {
|
||||||
|
return unbakedCacheBackingMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnbakedModel put(ResourceLocation key, UnbakedModel value) {
|
||||||
|
smallLoadingCache.put(key, value);
|
||||||
|
return super.put(key, value);
|
||||||
|
}
|
||||||
|
};
|
||||||
this.bakedTopLevelModels = new DynamicBakedModelProvider((ModelBakery)(Object)this, bakedCache);
|
this.bakedTopLevelModels = new DynamicBakedModelProvider((ModelBakery)(Object)this, bakedCache);
|
||||||
filler.push(s);
|
filler.push(s);
|
||||||
}
|
}
|
||||||
|
|
@ -209,11 +223,6 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
|
||||||
return unbakedCache.get(rl);
|
return unbakedCache.get(rl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "cacheAndQueueDependencies", at = @At("RETURN"))
|
|
||||||
private void addToSmallLoadingCache(ResourceLocation location, UnbakedModel model, CallbackInfo ci) {
|
|
||||||
smallLoadingCache.put(location, model);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author embeddedt
|
* @author embeddedt
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
"modernfix-common.mixins.json"
|
"modernfix-common.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
|
"fabric-lifecycle-events-v1": "*",
|
||||||
|
"fabric-screen-api-v1": "*",
|
||||||
"minecraft": ">=1.16.5"
|
"minecraft": ">=1.16.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user