1010import net .minecraft .network .chat .Component ;
1111import org .jetbrains .annotations .ApiStatus ;
1212import org .jetbrains .annotations .NotNull ;
13+ import org .jetbrains .annotations .Nullable ;
1314
1415public abstract class SplicingTableIotaRenderer {
1516 @ NotNull
@@ -19,6 +20,9 @@ public abstract class SplicingTableIotaRenderer {
1920 private int x ;
2021 private int y ;
2122
23+ @ Nullable
24+ private Tooltip tooltip ;
25+
2226 public SplicingTableIotaRenderer (
2327 @ NotNull IotaType <?> type ,
2428 @ NotNull SplicingTableIotaClientView iota ,
@@ -59,6 +63,24 @@ public void setY(int y) {
5963 this .y = y ;
6064 }
6165
66+ /**
67+ * Returns the current tooltip for this renderer. This is called every frame, immediately after
68+ * {@link SplicingTableIotaRenderer#render}.
69+ */
70+ @ Nullable
71+ public Tooltip getTooltip () {
72+ return tooltip ;
73+ }
74+
75+ /**
76+ * Sets the cached tooltip for this renderer. By default, this is called only when the renderer
77+ * is moved to a new position, receiving the value returned by
78+ * {@link SplicingTableIotaRenderer#createTooltip}.
79+ */
80+ public void setTooltip (@ Nullable Tooltip tooltip ) {
81+ this .tooltip = tooltip ;
82+ }
83+
6284 /** Renders one frame of this iota. */
6385 public abstract void render (@ NotNull GuiGraphics guiGraphics , int mouseX , int mouseY , float partialTick );
6486
@@ -69,7 +91,8 @@ public SplicingTableIotaBackgroundType getBackgroundType() {
6991 }
7092
7193 /**
72- * Creates and returns a new {@link Tooltip} for the provided iota.
94+ * Creates and returns a new {@link Tooltip} for the provided iota. By default, this is called
95+ * only when the renderer is moved to a new position.
7396 * <br>
7497 * In most cases, you'll likely want to override
7598 * {@link SplicingTableIotaRenderer#buildTooltip} instead.
0 commit comments