Merge remote-tracking branch 'origin/main' into 1.18

This commit is contained in:
embeddedt 2023-06-05 19:46:52 -04:00
commit 3996804e71
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
6 changed files with 19 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package org.embeddedt.modernfix;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ChunkMap;
@ -24,6 +25,8 @@ public class ModernFix {
public static final String MODID = "modernfix";
public static String NAME = "ModernFix";
public static ModernFix INSTANCE;
// Used to skip computing the blockstate caches twice
@ -46,6 +49,8 @@ public class ModernFix {
public ModernFix() {
INSTANCE = this;
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.snapshot_easter_egg.NameChange") && !SharedConstants.getCurrentVersion().isStable())
NAME = "PreemptiveFix";
ModernFixPlatformHooks.onServerCommandRegister(ModernFixCommands::register);
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spam_thread_dump.ThreadDumper")) {
Thread t = new Thread() {

View File

@ -45,7 +45,7 @@ public class ModernFixClient {
// clear reserve as it's not needed
MemoryReserve.release();
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.branding.F3Screen")) {
brandingString = "ModernFix " + ModernFixPlatformHooks.getVersionString();
brandingString = ModernFix.NAME + " " + ModernFixPlatformHooks.getVersionString();
}
SearchTreeProviderRegistry.register(JEIBackedSearchTree.PROVIDER);
SearchTreeProviderRegistry.register(REIBackedSearchTree.PROVIDER);

View File

@ -3,6 +3,7 @@ package org.embeddedt.modernfix.common.mixin.perf.dynamic_resources;
import net.minecraft.client.renderer.block.BlockModelShaper;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.world.level.block.state.BlockState;
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
import org.embeddedt.modernfix.dynamicresources.ModelLocationCache;
@ -37,9 +38,14 @@ public class BlockModelShaperMixin {
public void rebuildCache() {
}
/**
* @author embeddedt
* @reason get the model from the dynamic model provider
*/
@Overwrite
public BakedModel getBlockModel(BlockState state) {
BakedModel model = modelManager.getModel(ModelLocationCache.get(state));
ModelResourceLocation mrl = ModelLocationCache.get(state);
BakedModel model = mrl == null ? null : modelManager.getModel(mrl);
if (model == null) {
model = modelManager.getMissingModel();
}

View File

@ -148,6 +148,7 @@ public class ModernFixEarlyConfig {
.put("mixin.feature.integrated_server_watchdog", true)
.put("mixin.perf.faster_item_rendering", false)
.put("mixin.feature.spam_thread_dump", false)
.put("mixin.feature.snapshot_easter_egg", true)
.put("mixin.devenv", isDevEnv)
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
.build();

View File

@ -31,6 +31,8 @@ public class ModelLocationCache {
});
public static ModelResourceLocation get(BlockState state) {
if(state == null)
return null;
try {
return blockLocationCache.get(state);
} catch(ExecutionException e) {
@ -39,6 +41,8 @@ public class ModelLocationCache {
}
public static ModelResourceLocation get(Item item) {
if(item == null)
return null;
try {
return itemLocationCache.get(item);
} catch(ExecutionException e) {

View File

@ -33,7 +33,7 @@
"fabric-screen-api-v1": "*",
"fabric-command-api-v1": "*",
"fabric-models-v0": "*",
"minecraft": ">=1.16.5"
"minecraft": ">=1.16.2"
},
"breaks": {
"dashloader": "*"