show tooltips over toggle buttons
This commit is contained in:
parent
c6eec52518
commit
d193d2ebda
@ -30,11 +30,14 @@ import net.minecraft.nbt.CompoundNBT;
|
|||||||
import net.minecraft.nbt.ListNBT;
|
import net.minecraft.nbt.ListNBT;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Toggle extends TerraButton {
|
public class Toggle extends TerraButton {
|
||||||
|
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
private final CompoundNBT value;
|
private final CompoundNBT value;
|
||||||
private final ListNBT options;
|
private final ListNBT options;
|
||||||
|
private final List<String> tooltip;
|
||||||
|
|
||||||
private int index;
|
private int index;
|
||||||
private Runnable callback = () -> {};
|
private Runnable callback = () -> {};
|
||||||
@ -43,6 +46,7 @@ public class Toggle extends TerraButton {
|
|||||||
super(value.getString("value"));
|
super(value.getString("value"));
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
|
this.tooltip = Element.readTooltip(value);
|
||||||
this.options = value.getList("#options", Constants.NBT.TAG_STRING);
|
this.options = value.getList("#options", Constants.NBT.TAG_STRING);
|
||||||
for (int i = 0; i < options.size(); i++) {
|
for (int i = 0; i < options.size(); i++) {
|
||||||
String s = options.getString(i);
|
String s = options.getString(i);
|
||||||
@ -59,6 +63,11 @@ public class Toggle extends TerraButton {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTooltip() {
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double mx, double my, int button) {
|
public boolean mouseClicked(double mx, double my, int button) {
|
||||||
if (super.isValidClickButton(button)) {
|
if (super.isValidClickButton(button)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user