QueuedTooltip.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Roughly Enough Items by Danielshe.
  3. * Licensed under the MIT License.
  4. */
  5. package me.shedaniel.rei.gui.widget;
  6. import com.google.common.collect.Lists;
  7. import me.shedaniel.math.api.Point;
  8. import me.shedaniel.math.impl.PointHelper;
  9. import java.util.List;
  10. import java.util.function.Consumer;
  11. public class QueuedTooltip {
  12. private Point location;
  13. private List<String> text;
  14. private Consumer<QueuedTooltip> consumer = null;
  15. private QueuedTooltip(Point location, List<String> text) {
  16. this.location = location;
  17. this.text = Lists.newArrayList(text);
  18. }
  19. public static QueuedTooltip create(Point location, List<String> text) {
  20. return new QueuedTooltip(location, text);
  21. }
  22. public static QueuedTooltip create(Point location, String... text) {
  23. return QueuedTooltip.create(location, Lists.newArrayList(text));
  24. }
  25. public static QueuedTooltip create(List<String> text) {
  26. return QueuedTooltip.create(PointHelper.fromMouse(), text);
  27. }
  28. public static QueuedTooltip create(String... text) {
  29. return QueuedTooltip.create(PointHelper.fromMouse(), text);
  30. }
  31. @Deprecated
  32. public QueuedTooltip setSpecialRenderer(Consumer<QueuedTooltip> consumer) {
  33. this.consumer = consumer;
  34. return this;
  35. }
  36. @Deprecated
  37. public Consumer<QueuedTooltip> getConsumer() {
  38. return consumer;
  39. }
  40. public Point getLocation() {
  41. return location;
  42. }
  43. public int getX() {
  44. return getLocation().x;
  45. }
  46. public int getY() {
  47. return getLocation().y;
  48. }
  49. public List<String> getText() {
  50. return text;
  51. }
  52. }