Pattern Rendering and other Rendering

This commit is contained in:
Sebastian Hartte
2020-07-20 20:13:20 +02:00
parent d053c9b1bc
commit 019f570331
69 changed files with 994 additions and 1398 deletions
@@ -0,0 +1,26 @@
package appeng.mixins;
import appeng.hooks.ItemRendererHooks;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* This mixin specifically targets rendering of items in the user interface to allow us to
* customize _only_ the UI representation of an item, and none of the others (held items, in-world, etc.)
*/
@Mixin(ItemRenderer.class)
public abstract class RenderEncodedPatternMixin {
@Inject(method = "renderGuiItemModel", at = @At("HEAD"), cancellable = true)
protected void renderGuiItemModel(ItemStack stack, int x, int y, BakedModel model, CallbackInfo ci) {
if (ItemRendererHooks.onRenderGuiItemModel((ItemRenderer) (Object) this, stack, x, y, model)) {
ci.cancel();
}
}
}