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:
Johann Bernhardt authored and GitHub committed 2021-11-22 08:56:35 -08:00
1 parent 43b71b1de6
commit a7ca6c8527
188 files changed
+646 -968

No files matched your search

@@ -0,0 +1,101 @@
package codechicken.nei.config;
import codechicken.lib.vec.Rectangle4i;
import codechicken.nei.TextField;
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
import java.util.List;
import static codechicken.lib.gui.GuiDraw.drawString;
import static codechicken.lib.gui.GuiDraw.getStringWidth;
public class OptionTextField extends Option
{
private boolean focused = false;
private TextField textField = new TextField("test")
{
@Override
public void onTextChange(String oldText) {
if(focused() && isValidValue(text()))
if(!defaulting() || !text().equals(getTag().getValue())) //don't override global if text hasn't changed
getTag().setValue(text());
}
@Override
public boolean focused() {
return focused;
}
@Override
public void setFocus(boolean focus) {
if (!focus && !isValidValue(text()))
setText(renderTag().getValue());
focused = focus;
}
};
public OptionTextField(String name) {
super(name);
textField.h = 20;
}
@Override
public void onAdded(OptionScrollSlot slot) {
super.onAdded(slot);
}
@Override
public void update() {
textField.update();
if(!textField.focused())
textField.setText(renderTag().getValue());
}
public String getPrefix() {
return translateN(name);
}
@Override
public void draw(int mousex, int mousey, float frame) {
drawString(getPrefix(), 10, 6, -1);
textField.w = slot.slotWidth() - getStringWidth(getPrefix()) - 16;
textField.x = slot.slotWidth() - textField.w;
textField.draw(mousex, mousey);
}
@Override
public void keyTyped(char c, int keycode) {
textField.handleKeyPress(keycode, c);
}
@Override
public void mouseClicked(int mousex, int mousey, int button) {
if (textField.contains(mousex, mousey))
textField.handleClick(mousex, mousey, button);
}
@Override
public void onMouseClicked(int mousex, int mousey, int button) {
textField.onGuiClick(mousex, mousey);
}
@Override
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip) {
if (new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
String tip = translateN(name + ".tip");
if (!tip.equals(name + ".tip"))
currenttip.add(tip);
}
return currenttip;
}
public boolean isValidInput(String s) {
return true;
}
public boolean isValidValue(String s) {
return true;
}
}