You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After update from 1.20.1 to 1.21.1 this java code does not work
package com.breelock.autoclicky.widgets;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.widget.CheckboxWidget;
import net.minecraft.text.Text;
public class TooltipCheckboxWidget extends CheckboxWidget {
private final String tooltipText;
public TooltipCheckboxWidget(int x, int y, int width, int height, Text message, boolean checked, String tooltipText) {
super(x, y, width, height, message, checked);
this.tooltipText = tooltipText;
}
@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
// Check if the mouse is hovering over the checkbox
if (this.isMouseOver(mouseX, mouseY) && this.tooltipText != null && !this.tooltipText.trim().isEmpty()) {
renderTooltip(context, mouseX, mouseY);
}
}
private void renderTooltip(DrawContext context, int mouseX, int mouseY) {
context.drawTooltip(MinecraftClient.
getInstance
().textRenderer, Text.
of
(tooltipText), mouseX, mouseY);
}
}
errors: 'CheckboxWidget(int, int, int, net.minecraft.text.Text, net.minecraft.client.font.TextRenderer, boolean, net.minecraft.client.gui.widget.CheckboxWidget.Callback)' is not public in 'net.minecraft.client.gui.widget.CheckboxWidget'. Cannot be accessed from outside package.
'render(DrawContext, int, int, float)' cannot override 'render(DrawContext, int, int, float)' in 'net.minecraft.client.gui.widget.ClickableWidget'; overridden method is final.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Description
After update from 1.20.1 to 1.21.1 this java code does not work
errors: 'CheckboxWidget(int, int, int, net.minecraft.text.Text, net.minecraft.client.font.TextRenderer, boolean, net.minecraft.client.gui.widget.CheckboxWidget.Callback)' is not public in 'net.minecraft.client.gui.widget.CheckboxWidget'. Cannot be accessed from outside package.
'render(DrawContext, int, int, float)' cannot override 'render(DrawContext, int, int, float)' in 'net.minecraft.client.gui.widget.ClickableWidget'; overridden method is final.
how to fix it?
Beta Was this translation helpful? Give feedback.
All reactions