From aca429f17b4ceb9794ff0c0cdc959d7592e545bc Mon Sep 17 00:00:00 2001 From: Gerard Bruwn Date: Mon, 30 Jun 2014 11:54:08 -0700 Subject: [PATCH] Add RenderItemInFrameEvent --- .../tileentity/RenderItemFrame.java.patch | 20 ++++++++++++++ .../client/event/RenderItemInFrameEvent.java | 27 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch create mode 100644 src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch new file mode 100644 index 000000000..1093c0637 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +@@ -176,6 +176,9 @@ + GL11.glTranslatef(0.16F, -0.16F, 0.0F); + } + ++ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { + if (item == Items.field_151098_aY) + { + this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); +@@ -244,6 +247,7 @@ + } + } + } ++ } + + GL11.glPopMatrix(); + } diff --git a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java new file mode 100644 index 000000000..16bffea83 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java @@ -0,0 +1,27 @@ +package net.minecraftforge.client.event; + +import net.minecraft.client.renderer.tileentity.RenderItemFrame; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.eventhandler.Cancelable; +import cpw.mods.fml.common.eventhandler.Event; + +/** + * This event is called when an item is rendered in an item frame. + * + * You can set canceled to do no further vanilla processing. + */ +@Cancelable +public class RenderItemInFrameEvent extends Event +{ + public final ItemStack item; + public final EntityItemFrame entityItemFrame; + public final RenderItemFrame renderer; + + public RenderItemInFrameEvent(EntityItemFrame itemFrame, RenderItemFrame renderItemFrame) + { + item = itemFrame.getDisplayedItem(); + entityItemFrame = itemFrame; + renderer = renderItemFrame; + } +}