Files
MinecraftForge/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch
T
2014-06-02 12:01:10 -07:00

87 lines
3.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java
@@ -17,6 +17,10 @@
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent;
+import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
+import net.minecraftforge.common.MinecraftForge;
+
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -111,7 +115,8 @@
}
}
- this.func_146283_a(list, p_146285_2_, p_146285_3_);
+ FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_);
+ drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font));
}
protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_)
@@ -121,6 +126,11 @@
protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_)
{
+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q);
+ }
+
+ protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font)
+ {
if (!p_146283_1_.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@@ -133,7 +143,7 @@
while (iterator.hasNext())
{
String s = (String)iterator.next();
- int l = this.field_146289_q.func_78256_a(s);
+ int l = font.func_78256_a(s);
if (l > k)
{
@@ -178,7 +188,7 @@
for (int i2 = 0; i2 < p_146283_1_.size(); ++i2)
{
String s1 = (String)p_146283_1_.get(i2);
- this.field_146289_q.func_78261_a(s1, j2, k2, -1);
+ font.func_78261_a(s1, j2, k2, -1);
if (i2 == 0)
{
@@ -207,9 +217,14 @@
if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_))
{
- this.field_146290_a = guibutton;
- guibutton.func_146113_a(this.field_146297_k.func_147118_V());
- this.func_146284_a(guibutton);
+ ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.field_146292_n);
+ if (MinecraftForge.EVENT_BUS.post(event))
+ break;
+ this.field_146290_a = event.button;
+ event.button.func_146113_a(this.field_146297_k.func_147118_V());
+ this.func_146284_a(event.button);
+ if (this.equals(this.field_146297_k.field_71462_r))
+ MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.field_146292_n));
}
}
}
@@ -234,8 +249,12 @@
this.field_146289_q = p_146280_1_.field_71466_p;
this.field_146294_l = p_146280_2_;
this.field_146295_m = p_146280_3_;
- this.field_146292_n.clear();
- this.func_73866_w_();
+ if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.field_146292_n)))
+ {
+ this.field_146292_n.clear();
+ this.func_73866_w_();
+ }
+ MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.field_146292_n));
}
public void func_73866_w_() {}