mixin-hook包
This commit is contained in:
parent
06a5dafaaa
commit
d7a690da14
|
|
@ -1,10 +1,9 @@
|
|||
package com.extendedae_plus.mixin.hooks;
|
||||
|
||||
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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
|
|
@ -18,16 +17,11 @@ import com.extendedae_plus.hooks.BuiltInModelHooks;
|
|||
*/
|
||||
@Mixin(ModelBakery.class)
|
||||
public class ModelBakeryMixin {
|
||||
@Inject(method = "loadModel", at = @At("HEAD"), cancellable = true)
|
||||
private void extendedae_plus$loadModelHook(ResourceLocation id, CallbackInfo ci) {
|
||||
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
|
||||
private void extendedae_plus$getModelHook(ResourceLocation id, CallbackInfoReturnable<UnbakedModel> cir) {
|
||||
var model = BuiltInModelHooks.getBuiltInModel(id);
|
||||
if (model != null) {
|
||||
cacheAndQueueDependencies(id, model);
|
||||
ci.cancel();
|
||||
cir.setReturnValue(model);
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow
|
||||
protected void cacheAndQueueDependencies(ResourceLocation id, UnbakedModel unbakedModel) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user