File tree Expand file tree Collapse file tree 6 files changed +19
-3
lines changed
common/src/main/java/org/embeddedt/modernfix
common/mixin/perf/dynamic_resources
fabric/src/main/resources Expand file tree Collapse file tree 6 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 11package org .embeddedt .modernfix ;
22
3+ import net .minecraft .SharedConstants ;
34import net .minecraft .Util ;
45import net .minecraft .server .MinecraftServer ;
56import 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 () {
Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff line change 33import net .minecraft .client .renderer .block .BlockModelShaper ;
44import net .minecraft .client .resources .model .BakedModel ;
55import net .minecraft .client .resources .model .ModelManager ;
6+ import net .minecraft .client .resources .model .ModelResourceLocation ;
67import net .minecraft .world .level .block .state .BlockState ;
78import org .embeddedt .modernfix .annotation .ClientOnlyMixin ;
89import 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 }
Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 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" : " *"
You can’t perform that action at this time.
0 commit comments