Files
MinecraftForge/patches/minecraft/net/minecraft/client/gui/components/Button.java.patch
T

30 lines
938 B
Diff

--- a/net/minecraft/client/gui/components/Button.java
+++ b/net/minecraft/client/gui/components/Button.java
@@ -30,6 +_,11 @@
this.createNarration = p_259552_;
}
+ protected Button(Builder builder) {
+ this(builder.x, builder.y, builder.width, builder.height, builder.message, builder.onPress, builder.createNarration);
+ setTooltip(builder.tooltip); // Forge: Make use of the Builder tooltip
+ }
+
public void onPress() {
this.onPress.onPress(this);
}
@@ -93,9 +_,11 @@
}
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);
+ }
+
+ public Button build(java.util.function.Function<Builder, Button> builder) {
+ return builder.apply(this);
}
}