mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Unified build script (#175)
* Update build script * Update build script to import fix for shadow in dev and sources artifacts * Update fixed build script to shadow csv dependency in dev jar as well * Moved jitpack * Move new files
This commit is contained in:
1 parent
43b71b1de6
commit
a7ca6c8527
188 files changed
+646
-968
No files matched your search
@@ -0,0 +1,74 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
public abstract class Button extends Widget
|
||||
{
|
||||
public Button(String s) {
|
||||
label = s;
|
||||
}
|
||||
|
||||
public Button() {
|
||||
label = "";
|
||||
}
|
||||
|
||||
public int contentWidth() {
|
||||
return getRenderIcon() == null ? getStringWidth(label) : getRenderIcon().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
LayoutManager.getLayoutStyle().drawButton(this, mousex, mousey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
if (button == 1 || button == 0)
|
||||
if (onButtonPress(button == 1))
|
||||
NEIClientUtils.playClickSound();
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract boolean onButtonPress(boolean rightclick);
|
||||
|
||||
public Image getRenderIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mx, int my, List<String> tooltip) {
|
||||
if (!contains(mx, my))
|
||||
return tooltip;
|
||||
|
||||
final String tip = getButtonTip();
|
||||
if (tip != null)
|
||||
tooltip.add(tip);
|
||||
|
||||
addTooltips(tooltip);
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
public String getButtonTip() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addTooltips(List<String> tooltip) {}
|
||||
|
||||
public String getRenderLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public final String label;
|
||||
public Image icon;
|
||||
|
||||
/**
|
||||
* 0x4 = state flag, as opposed to 1 click
|
||||
* 0 = normal
|
||||
* 1 = on
|
||||
* 2 = disabled
|
||||
*/
|
||||
public int state;
|
||||
}
|
||||
Reference in new issue
Block a user