DetailedButtonWidget.java 1.3 KB

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