DetailedButtonWidget.java 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Roughly Enough Items by Danielshe.
  3. * Licensed under the MIT License.
  4. */
  5. package me.shedaniel.rei.gui.widget;
  6. import net.minecraft.network.chat.Component;
  7. import java.awt.*;
  8. public class DetailedButtonWidget extends ButtonWidget {
  9. private DetailedButtonWidget.PressAction pressAction;
  10. public DetailedButtonWidget(Rectangle rectangle, Component text, PressAction pressAction) {
  11. super(rectangle, text);
  12. this.pressAction = pressAction;
  13. }
  14. public DetailedButtonWidget(Rectangle rectangle, String text, PressAction pressAction) {
  15. super(rectangle, text);
  16. this.pressAction = pressAction;
  17. }
  18. public DetailedButtonWidget(int x, int y, int width, int height, String text, PressAction pressAction) {
  19. super(x, y, width, height, text);
  20. this.pressAction = pressAction;
  21. }
  22. public DetailedButtonWidget(int x, int y, int width, int height, Component text, PressAction pressAction) {
  23. super(x, y, width, height, text);
  24. this.pressAction = pressAction;
  25. }
  26. @Override
  27. public void onPressed() {
  28. if (pressAction != null)
  29. pressAction.onPress(this);
  30. }
  31. public interface PressAction {
  32. void onPress(ButtonWidget var1);
  33. }
  34. }