Files
MinecraftForge/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch
T
LexManos f1cca475ea Initial patch update to 1.12.
Some things to note:
Netty is screwy so currently can't join single player. @cpw
Crafting has been MAJORY reworked. The current GameRegistry functions are nooped, this is IN THE WORKS.
  Just need to move the recipe list to a full class registry, and then re implement the in-code recipe registration.
  Also, it IS advised that modders move to JSON, because ideally we'll see a S->C recipe syncing system in 1.13
  which would allow servers to have custom recipes.
  OreDictionary currently 1/2 works, need to write a better algorithm for replacing ingredients.
  Please be patient
Rendering:
  A lot of functions got a new float parameter, this is similar to partial ticks, needs more research
2017-06-10 22:22:02 -04:00

111 lines
5.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java
@@ -61,6 +61,7 @@
private int field_146298_h;
private URI field_175286_t;
private boolean field_193977_u;
+ protected boolean keyHandled, mouseHandled; // Forge: allow canceling key and mouse Post events from handleMouseInput and handleKeyboardInput
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
@@ -131,7 +132,10 @@
protected void func_146285_a(ItemStack p_146285_1_, int p_146285_2_, int p_146285_3_)
{
- this.func_146283_a(this.func_191927_a(p_146285_1_), p_146285_2_, p_146285_3_);
+ FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_);
+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_146285_1_);
+ this.drawHoveringText(this.func_191927_a(p_146285_1_), p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font));
+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
}
public List<String> func_191927_a(ItemStack p_191927_1_)
@@ -170,7 +174,13 @@
public void func_146283_a(List<String> p_146283_1_, int p_146283_2_, int p_146283_3_)
{
- if (!p_146283_1_.isEmpty())
+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q);
+ }
+
+ protected void drawHoveringText(List<String> p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font)
+ {
+ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146294_l, field_146295_m, -1, font);
+ if (false && !p_146283_1_.isEmpty())
{
GlStateManager.func_179101_C();
RenderHelper.func_74518_a();
@@ -403,10 +413,13 @@
public void func_175281_b(String p_175281_1_, boolean p_175281_2_)
{
+ p_175281_1_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_175281_1_);
+ if (p_175281_1_.isEmpty()) return;
if (p_175281_2_)
{
this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_);
}
+ if (net.minecraftforge.client.ClientCommandHandler.instance.func_71556_a(field_146297_k.field_71439_g, p_175281_1_) != 0) return;
this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_);
}
@@ -421,9 +434,15 @@
if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_))
{
+ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.field_146292_n);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
+ break;
+ guibutton = event.getButton();
this.field_146290_a = guibutton;
guibutton.func_146113_a(this.field_146297_k.func_147118_V());
this.func_146284_a(guibutton);
+ if (this.equals(this.field_146297_k.field_71462_r))
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.getButton(), this.field_146292_n));
}
}
}
@@ -453,8 +472,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_;
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_146292_n)))
+ {
this.field_146292_n.clear();
this.func_73866_w_();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_146292_n));
}
public void func_183500_a(int p_183500_1_, int p_183500_2_)
@@ -473,7 +496,10 @@
{
while (Mouse.next())
{
+ this.mouseHandled = false;
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue;
this.func_146274_d();
+ if (this.equals(this.field_146297_k.field_71462_r) && !this.mouseHandled) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this));
}
}
@@ -481,7 +507,10 @@
{
while (Keyboard.next())
{
+ this.keyHandled = false;
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue;
this.func_146282_l();
+ if (this.equals(this.field_146297_k.field_71462_r) && !this.keyHandled) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this));
}
}
}
@@ -543,6 +572,7 @@
public void func_146276_q_()
{
this.func_146270_b(0);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this));
}
public void func_146270_b(int p_146270_1_)