From d193d2ebda5cb4115ff2b3a4895cfa10bb33e13f Mon Sep 17 00:00:00 2001 From: dags- Date: Thu, 12 Mar 2020 10:25:20 +0000 Subject: [PATCH] show tooltips over toggle buttons --- .../java/com/terraforged/mod/gui/element/Toggle.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/gui/element/Toggle.java b/TerraForgedMod/src/main/java/com/terraforged/mod/gui/element/Toggle.java index 2dd2163..e32fbf1 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/gui/element/Toggle.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/gui/element/Toggle.java @@ -30,11 +30,14 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraftforge.common.util.Constants; +import java.util.List; + public class Toggle extends TerraButton { private final String prefix; private final CompoundNBT value; private final ListNBT options; + private final List tooltip; private int index; private Runnable callback = () -> {}; @@ -43,6 +46,7 @@ public class Toggle extends TerraButton { super(value.getString("value")); this.value = value; this.prefix = prefix; + this.tooltip = Element.readTooltip(value); this.options = value.getList("#options", Constants.NBT.TAG_STRING); for (int i = 0; i < options.size(); i++) { String s = options.getString(i); @@ -59,6 +63,11 @@ public class Toggle extends TerraButton { return this; } + @Override + public List getTooltip() { + return tooltip; + } + @Override public boolean mouseClicked(double mx, double my, int button) { if (super.isValidClickButton(button)) {