Merge remote-tracking branch 'origin/main' into 1.18
This commit is contained in:
commit
3996804e71
|
|
@ -1,5 +1,6 @@
|
||||||
package org.embeddedt.modernfix;
|
package org.embeddedt.modernfix;
|
||||||
|
|
||||||
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ChunkMap;
|
import net.minecraft.server.level.ChunkMap;
|
||||||
|
|
@ -24,6 +25,8 @@ public class ModernFix {
|
||||||
|
|
||||||
public static final String MODID = "modernfix";
|
public static final String MODID = "modernfix";
|
||||||
|
|
||||||
|
public static String NAME = "ModernFix";
|
||||||
|
|
||||||
public static ModernFix INSTANCE;
|
public static ModernFix INSTANCE;
|
||||||
|
|
||||||
// Used to skip computing the blockstate caches twice
|
// Used to skip computing the blockstate caches twice
|
||||||
|
|
@ -46,6 +49,8 @@ public class ModernFix {
|
||||||
|
|
||||||
public ModernFix() {
|
public ModernFix() {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.snapshot_easter_egg.NameChange") && !SharedConstants.getCurrentVersion().isStable())
|
||||||
|
NAME = "PreemptiveFix";
|
||||||
ModernFixPlatformHooks.onServerCommandRegister(ModernFixCommands::register);
|
ModernFixPlatformHooks.onServerCommandRegister(ModernFixCommands::register);
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spam_thread_dump.ThreadDumper")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spam_thread_dump.ThreadDumper")) {
|
||||||
Thread t = new Thread() {
|
Thread t = new Thread() {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class ModernFixClient {
|
||||||
// clear reserve as it's not needed
|
// clear reserve as it's not needed
|
||||||
MemoryReserve.release();
|
MemoryReserve.release();
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.branding.F3Screen")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.branding.F3Screen")) {
|
||||||
brandingString = "ModernFix " + ModernFixPlatformHooks.getVersionString();
|
brandingString = ModernFix.NAME + " " + ModernFixPlatformHooks.getVersionString();
|
||||||
}
|
}
|
||||||
SearchTreeProviderRegistry.register(JEIBackedSearchTree.PROVIDER);
|
SearchTreeProviderRegistry.register(JEIBackedSearchTree.PROVIDER);
|
||||||
SearchTreeProviderRegistry.register(REIBackedSearchTree.PROVIDER);
|
SearchTreeProviderRegistry.register(REIBackedSearchTree.PROVIDER);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.common.mixin.perf.dynamic_resources;
|
||||||
import net.minecraft.client.renderer.block.BlockModelShaper;
|
import net.minecraft.client.renderer.block.BlockModelShaper;
|
||||||
import net.minecraft.client.resources.model.BakedModel;
|
import net.minecraft.client.resources.model.BakedModel;
|
||||||
import net.minecraft.client.resources.model.ModelManager;
|
import net.minecraft.client.resources.model.ModelManager;
|
||||||
|
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||||
import org.embeddedt.modernfix.dynamicresources.ModelLocationCache;
|
import org.embeddedt.modernfix.dynamicresources.ModelLocationCache;
|
||||||
|
|
@ -37,9 +38,14 @@ public class BlockModelShaperMixin {
|
||||||
public void rebuildCache() {
|
public void rebuildCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author embeddedt
|
||||||
|
* @reason get the model from the dynamic model provider
|
||||||
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public BakedModel getBlockModel(BlockState state) {
|
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) {
|
if (model == null) {
|
||||||
model = modelManager.getMissingModel();
|
model = modelManager.getMissingModel();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,7 @@ public class ModernFixEarlyConfig {
|
||||||
.put("mixin.feature.integrated_server_watchdog", true)
|
.put("mixin.feature.integrated_server_watchdog", true)
|
||||||
.put("mixin.perf.faster_item_rendering", false)
|
.put("mixin.perf.faster_item_rendering", false)
|
||||||
.put("mixin.feature.spam_thread_dump", false)
|
.put("mixin.feature.spam_thread_dump", false)
|
||||||
|
.put("mixin.feature.snapshot_easter_egg", true)
|
||||||
.put("mixin.devenv", isDevEnv)
|
.put("mixin.devenv", isDevEnv)
|
||||||
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
|
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ public class ModelLocationCache {
|
||||||
});
|
});
|
||||||
|
|
||||||
public static ModelResourceLocation get(BlockState state) {
|
public static ModelResourceLocation get(BlockState state) {
|
||||||
|
if(state == null)
|
||||||
|
return null;
|
||||||
try {
|
try {
|
||||||
return blockLocationCache.get(state);
|
return blockLocationCache.get(state);
|
||||||
} catch(ExecutionException e) {
|
} catch(ExecutionException e) {
|
||||||
|
|
@ -39,6 +41,8 @@ public class ModelLocationCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModelResourceLocation get(Item item) {
|
public static ModelResourceLocation get(Item item) {
|
||||||
|
if(item == null)
|
||||||
|
return null;
|
||||||
try {
|
try {
|
||||||
return itemLocationCache.get(item);
|
return itemLocationCache.get(item);
|
||||||
} catch(ExecutionException e) {
|
} catch(ExecutionException e) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
"fabric-screen-api-v1": "*",
|
"fabric-screen-api-v1": "*",
|
||||||
"fabric-command-api-v1": "*",
|
"fabric-command-api-v1": "*",
|
||||||
"fabric-models-v0": "*",
|
"fabric-models-v0": "*",
|
||||||
"minecraft": ">=1.16.5"
|
"minecraft": ">=1.16.2"
|
||||||
},
|
},
|
||||||
"breaks": {
|
"breaks": {
|
||||||
"dashloader": "*"
|
"dashloader": "*"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user