-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update NeoForge, adjust dynamic resources for NF API
- Loading branch information
Showing
5 changed files
with
60 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
common/src/main/java/org/embeddedt/modernfix/duck/IExtendedModelBakery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
package org.embeddedt.modernfix.duck; | ||
|
||
import net.minecraft.client.resources.model.ModelResourceLocation; | ||
import net.minecraft.client.resources.model.UnbakedModel; | ||
|
||
public interface IExtendedModelBakery { | ||
void mfix$tick(); | ||
void mfix$finishLoading(); | ||
UnbakedModel mfix$loadUnbakedModelDynamic(ModelResourceLocation location); | ||
UnbakedModel mfix$getMissingModel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...va/org/embeddedt/modernfix/neoforge/mixin/perf/dynamic_resources/ModelBakerImplMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.embeddedt.modernfix.neoforge.mixin.perf.dynamic_resources; | ||
|
||
import net.minecraft.client.resources.model.ModelBakery; | ||
import net.minecraft.client.resources.model.ModelResourceLocation; | ||
import net.minecraft.client.resources.model.UnbakedModel; | ||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin; | ||
import org.embeddedt.modernfix.duck.IExtendedModelBakery; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(targets = {"net/minecraft/client/resources/model/ModelBakery$ModelBakerImpl"}) | ||
@ClientOnlyMixin | ||
public class ModelBakerImplMixin { | ||
@Shadow @Final private ModelBakery field_40571; | ||
|
||
/** | ||
* @author embeddedt | ||
* @reason Handle dynamic model loading | ||
*/ | ||
@Overwrite(remap = false) | ||
public UnbakedModel getTopLevelModel(ModelResourceLocation location) { | ||
IExtendedModelBakery bakery = (IExtendedModelBakery)this.field_40571; | ||
UnbakedModel model = bakery.mfix$loadUnbakedModelDynamic(location); | ||
return model == bakery.mfix$getMissingModel() ? null : model; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters