mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-20 20:22:17 +00:00
Cleaned and generalised item loading/searching
Reimplemented subsets Added regex searching Fixed format error on delete all Fixed GuiButton handling clicks before NEI widgets could override Re-Implemented banned blocks implementation Added brewing recipes again note test obf ASM beacons Fixed some calls being intercepted by item panel when mouse was over a gui element Fixed crash on closing potion window with escape Disabled fast transfer, scrolling, and drag 'n' drop in creative Added item panel sorting Removed TMI uninstaller Fixed /give command Updated to 1.7.10
This commit is contained in:
1 parent
3c9ebc6961
commit
3c84527806
67 files changed
+3251
-2319
No files matched your search
@@ -4,9 +4,6 @@ import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -19,155 +16,129 @@ public abstract class OptionStringSet extends Option
|
||||
public Map<String, String> dependancies = new HashMap<String, String>();
|
||||
public Multimap<String, String> groups = ArrayListMultimap.create();
|
||||
|
||||
public OptionStringSet(String name)
|
||||
{
|
||||
public OptionStringSet(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void addDep(String base, String dep)
|
||||
{
|
||||
public void addDep(String base, String dep) {
|
||||
dependants.put(dep, base);
|
||||
dependancies.put(base, dep);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey, float frame)
|
||||
{
|
||||
public void draw(int mousex, int mousey, float frame) {
|
||||
drawPrefix();
|
||||
drawButtons();
|
||||
drawIcons();
|
||||
}
|
||||
|
||||
public void drawPrefix()
|
||||
{
|
||||
drawString(translateN(name), 10, 8, -1);
|
||||
|
||||
public void drawPrefix() {
|
||||
drawString(translateN(name), 10, 6, -1);
|
||||
}
|
||||
|
||||
public void drawButtons()
|
||||
{
|
||||
public void drawButtons() {
|
||||
int x = buttonX();
|
||||
List<String> values = values();
|
||||
for(int i = 0; i < options.size(); i++)
|
||||
{
|
||||
LayoutManager.drawButtonBackground(x, 2, 20, 20, true, values.contains(options.get(i)) ? 1 : 0);
|
||||
x+=24;
|
||||
for (String option : options) {
|
||||
LayoutManager.drawButtonBackground(x, 0, 20, 20, true, values.contains(option) ? 1 : 0);
|
||||
x += 24;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void drawIcons();
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip)
|
||||
{
|
||||
if(new Rectangle4i(4, 4, 50, 20).contains(mousex, mousey))
|
||||
currenttip.add(translateN(name+".tip"));
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip) {
|
||||
if (new Rectangle4i(4, 4, 50, 20).contains(mousex, mousey))
|
||||
currenttip.add(translateN(name + ".tip"));
|
||||
int x = buttonX();
|
||||
for(int i = 0; i < options.size(); i++)
|
||||
{
|
||||
if(new Rectangle4i(x, 2, 20, 20).contains(mousex, mousey))
|
||||
currenttip.add(translateN(name+"."+options.get(i)));
|
||||
|
||||
x+=24;
|
||||
for (String option : options) {
|
||||
if (new Rectangle4i(x, 0, 20, 20).contains(mousex, mousey))
|
||||
currenttip.add(translateN(name + "." + option));
|
||||
|
||||
x += 24;
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int button)
|
||||
{
|
||||
if(renderDefault())
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
if (defaulting())
|
||||
return;
|
||||
|
||||
if(clickButton(x, y, button))
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
if (clickButton(x, y, button))
|
||||
playClickSound();
|
||||
}
|
||||
|
||||
public boolean clickButton(int mousex, int mousey, int button)
|
||||
{
|
||||
|
||||
public boolean clickButton(int mousex, int mousey, int button) {
|
||||
int x = buttonX();
|
||||
List<String> values = values();
|
||||
for(int i = 0; i < options.size(); i++)
|
||||
{
|
||||
if(new Rectangle4i(x, 2, 20, 20).contains(mousex, mousey))
|
||||
{
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
if (new Rectangle4i(x, 0, 20, 20).contains(mousex, mousey)) {
|
||||
String s = options.get(i);
|
||||
boolean set = values.contains(s);
|
||||
if(button == 0 && !set)
|
||||
{
|
||||
if (button == 0 && !set) {
|
||||
setValue(s);
|
||||
return true;
|
||||
}
|
||||
if(button == 1 && set)
|
||||
{
|
||||
if (button == 1 && set) {
|
||||
remValue(s);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
x+=24;
|
||||
x += 24;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setValue(String s)
|
||||
{
|
||||
if(values().contains(s))
|
||||
public void setValue(String s) {
|
||||
if (values().contains(s))
|
||||
return;
|
||||
|
||||
|
||||
String dep = dependancies.get(s);
|
||||
if(dep != null)
|
||||
if (dep != null)
|
||||
setValue(dep);
|
||||
|
||||
if(groups.containsKey(s))
|
||||
{
|
||||
for(String grp : groups.get(s))
|
||||
if (groups.containsKey(s)) {
|
||||
for (String grp : groups.get(s))
|
||||
setValue(grp);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
List<String> setUtils = new LinkedList<String>(values());
|
||||
setUtils.add(s);
|
||||
setValues(setUtils);
|
||||
}
|
||||
}
|
||||
|
||||
public void remValue(String s)
|
||||
{
|
||||
for(String dep : dependants.get(s))
|
||||
public void remValue(String s) {
|
||||
for (String dep : dependants.get(s))
|
||||
remValue(dep);
|
||||
|
||||
if(groups.containsKey(s))
|
||||
{
|
||||
for(String grp : groups.get(s))
|
||||
|
||||
if (groups.containsKey(s)) {
|
||||
for (String grp : groups.get(s))
|
||||
remValue(grp);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
List<String> values = new LinkedList<String>(values());
|
||||
values.remove(s);
|
||||
setValues(values);
|
||||
}
|
||||
}
|
||||
|
||||
public void setValues(List<String> values)
|
||||
{
|
||||
public void setValues(List<String> values) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(String s : values)
|
||||
{
|
||||
if(sb.length() > 0)
|
||||
for (String s : values) {
|
||||
if (sb.length() > 0)
|
||||
sb.append(", ");
|
||||
sb.append(s);
|
||||
}
|
||||
getTag().setValue(sb.toString());
|
||||
}
|
||||
|
||||
public List<String> values()
|
||||
{
|
||||
public List<String> values() {
|
||||
return Arrays.asList(renderTag().getValue().replace(" ", "").split(","));
|
||||
}
|
||||
|
||||
public int buttonX()
|
||||
{
|
||||
return slot.contentWidth()-(24*options.size()-4);
|
||||
|
||||
public int buttonX() {
|
||||
return slot.slotWidth() - (24 * options.size() - 4);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user