Files
MinecraftForge/patches/minecraft/net/minecraft/client/gui/components/Button.java.patch
T
7b782e5b05 1.20.6 Initial Update
New Decompiler
Runtime Official mappings
ItemStacks arnt Capability providers anymore, use Vanilla's system.

Co-authored-by: RealMangoRage <[email protected]>
Co-authored-by: Paint_Ninja <[email protected]>
2024-04-30 11:42:52 -07:00

32 lines
1000 B
Diff

--- a/net/minecraft/client/gui/components/Button.java
+++ b/net/minecraft/client/gui/components/Button.java
@@ -31,6 +_,12 @@
this.createNarration = p_259552_;
}
+ // Forge (GH-9238)
+ protected Button(Builder builder) {
+ this(builder.x, builder.y, builder.width, builder.height, builder.message, builder.onPress, builder.createNarration);
+ this.setTooltip(builder.tooltip);
+ }
+
@Override
public void onPress() {
this.onPress.onPress(this);
@@ -95,9 +_,12 @@
}
public Button build() {
- Button button = new Button(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
- button.setTooltip(this.tooltip);
- return button;
+ return build(Button::new);
+ }
+
+ // Forge (GH-9238)
+ public Button build(java.util.function.Function<Builder, Button> builder) {
+ return builder.apply(this);
}
}