Move mixin to ModelLoader
This commit is contained in:
parent
f03001699b
commit
9dc046491f
|
@ -1,28 +0,0 @@
|
||||||
package net.shadowfacts.simplemultipart.mixin.client;
|
|
||||||
|
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
|
||||||
import net.minecraft.client.render.model.BakedModelManager;
|
|
||||||
import net.minecraft.client.render.model.ModelLoader;
|
|
||||||
import net.minecraft.client.util.ModelIdentifier;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.shadowfacts.simplemultipart.client.MultipartContainerBakedModel;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author shadowfacts
|
|
||||||
*/
|
|
||||||
@Mixin(BakedModelManager.class)
|
|
||||||
public class MixinBakedModelManager {
|
|
||||||
|
|
||||||
@Redirect(method = "onResourceReload", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/model/ModelLoader;getBakedModelMap()Ljava/util/Map;"))
|
|
||||||
public Map<Identifier, BakedModel> getBakedModelMap(ModelLoader loader) {
|
|
||||||
Map<Identifier, BakedModel> map = loader.getBakedModelMap();
|
|
||||||
map.put(new ModelIdentifier("simplemultipart:container#"), new MultipartContainerBakedModel());
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package net.shadowfacts.simplemultipart.mixin.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
|
import net.minecraft.client.render.model.ModelLoader;
|
||||||
|
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||||
|
import net.minecraft.client.util.ModelIdentifier;
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.shadowfacts.simplemultipart.client.MultipartContainerBakedModel;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shadowfacts
|
||||||
|
*/
|
||||||
|
@Mixin(ModelLoader.class)
|
||||||
|
public class MixinModelLoader {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private Map<Identifier, BakedModel> bakedModels;
|
||||||
|
|
||||||
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
|
public void addMultipartModel(ResourceManager manager, SpriteAtlasTexture texture, CallbackInfo info) {
|
||||||
|
bakedModels.put(new ModelIdentifier("simplemultipart:container#"), new MultipartContainerBakedModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,8 +3,8 @@
|
||||||
"package": "net.shadowfacts.simplemultipart.mixin.client",
|
"package": "net.shadowfacts.simplemultipart.mixin.client",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinBakedModelManager",
|
"MixinBlockRenderManager",
|
||||||
"MixinBlockRenderManager"
|
"MixinModelLoader"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
Loading…
Reference in New Issue