Skip to content

Commit 931bf29

Browse files
committed
Merge remote-tracking branch 'origin/1.18' into 1.19.2
2 parents f8771a2 + 3996804 commit 931bf29

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

common/src/main/java/org/embeddedt/modernfix/ModernFix.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.embeddedt.modernfix;
22

3+
import net.minecraft.SharedConstants;
34
import net.minecraft.Util;
45
import net.minecraft.server.MinecraftServer;
56
import net.minecraft.server.level.ChunkMap;
@@ -24,6 +25,8 @@ public class ModernFix {
2425

2526
public static final String MODID = "modernfix";
2627

28+
public static String NAME = "ModernFix";
29+
2730
public static ModernFix INSTANCE;
2831

2932
// Used to skip computing the blockstate caches twice
@@ -46,6 +49,8 @@ public static ExecutorService resourceReloadExecutor() {
4649

4750
public ModernFix() {
4851
INSTANCE = this;
52+
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.snapshot_easter_egg.NameChange") && !SharedConstants.getCurrentVersion().isStable())
53+
NAME = "PreemptiveFix";
4954
ModernFixPlatformHooks.onServerCommandRegister(ModernFixCommands::register);
5055
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spam_thread_dump.ThreadDumper")) {
5156
Thread t = new Thread() {

common/src/main/java/org/embeddedt/modernfix/ModernFixClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ModernFixClient() {
4545
// clear reserve as it's not needed
4646
MemoryReserve.release();
4747
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.branding.F3Screen")) {
48-
brandingString = "ModernFix " + ModernFixPlatformHooks.getVersionString();
48+
brandingString = ModernFix.NAME + " " + ModernFixPlatformHooks.getVersionString();
4949
}
5050
SearchTreeProviderRegistry.register(JEIBackedSearchTree.PROVIDER);
5151
SearchTreeProviderRegistry.register(REIBackedSearchTree.PROVIDER);

common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/dynamic_resources/BlockModelShaperMixin.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import net.minecraft.client.renderer.block.BlockModelShaper;
44
import net.minecraft.client.resources.model.BakedModel;
55
import net.minecraft.client.resources.model.ModelManager;
6+
import net.minecraft.client.resources.model.ModelResourceLocation;
67
import net.minecraft.world.level.block.state.BlockState;
78
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
89
import org.embeddedt.modernfix.dynamicresources.ModelLocationCache;
@@ -37,9 +38,14 @@ private void replaceModelMap(CallbackInfo ci) {
3738
public void rebuildCache() {
3839
}
3940

41+
/**
42+
* @author embeddedt
43+
* @reason get the model from the dynamic model provider
44+
*/
4045
@Overwrite
4146
public BakedModel getBlockModel(BlockState state) {
42-
BakedModel model = modelManager.getModel(ModelLocationCache.get(state));
47+
ModelResourceLocation mrl = ModelLocationCache.get(state);
48+
BakedModel model = mrl == null ? null : modelManager.getModel(mrl);
4349
if (model == null) {
4450
model = modelManager.getMissingModel();
4551
}

common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ else if(isClientOnly && !ModernFixPlatformHooks.isClient())
148148
.put("mixin.feature.integrated_server_watchdog", true)
149149
.put("mixin.perf.faster_item_rendering", false)
150150
.put("mixin.feature.spam_thread_dump", false)
151+
.put("mixin.feature.snapshot_easter_egg", true)
151152
.put("mixin.devenv", isDevEnv)
152153
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
153154
.build();

common/src/main/java/org/embeddedt/modernfix/dynamicresources/ModelLocationCache.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public ModelResourceLocation load(Item key) throws Exception {
3131
});
3232

3333
public static ModelResourceLocation get(BlockState state) {
34+
if(state == null)
35+
return null;
3436
try {
3537
return blockLocationCache.get(state);
3638
} catch(ExecutionException e) {
@@ -39,6 +41,8 @@ public static ModelResourceLocation get(BlockState state) {
3941
}
4042

4143
public static ModelResourceLocation get(Item item) {
44+
if(item == null)
45+
return null;
4246
try {
4347
return itemLocationCache.get(item);
4448
} catch(ExecutionException e) {

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"fabric-screen-api-v1": "*",
3535
"fabric-command-api-v2": "*",
3636
"fabric-models-v0": "*",
37-
"minecraft": ">=1.16.5"
37+
"minecraft": ">=1.16.2"
3838
},
3939
"breaks": {
4040
"dashloader": "*"

0 commit comments

Comments
 (0)