mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-25 14:34:54 +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
@@ -2,182 +2,206 @@ package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.config.ConfigTag;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Option
|
||||
{
|
||||
public static void playClickSound() {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
|
||||
public OptionScrollSlot slot;
|
||||
|
||||
|
||||
public String namespace = null;
|
||||
public final String name;
|
||||
public OptionList parent;
|
||||
|
||||
public Option(String name)
|
||||
{
|
||||
|
||||
public Option(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String fullName()
|
||||
{
|
||||
|
||||
public String fullName() {
|
||||
return namespaced(name);
|
||||
}
|
||||
|
||||
public String configName()
|
||||
{
|
||||
return fullName().substring(configBase().fullName().length()+1);
|
||||
|
||||
public String configName() {
|
||||
return fullName().substring(configBase().fullName().length() + 1);
|
||||
}
|
||||
|
||||
public String namespaced(String name)
|
||||
{
|
||||
return namespace == null ? name : (namespace+"."+name);
|
||||
|
||||
public String namespaced(String name) {
|
||||
return namespace == null ? name : (namespace + "." + name);
|
||||
}
|
||||
|
||||
public String translateN(String s, Object... args)
|
||||
{
|
||||
|
||||
public String translateN(String s, Object... args) {
|
||||
return StatCollector.translateToLocalFormatted(namespaced(s), args);
|
||||
}
|
||||
|
||||
public ConfigSet globalConfigSet()
|
||||
{
|
||||
|
||||
public int getHeight() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public ConfigSet globalConfigSet() {
|
||||
return parent.globalConfigSet();
|
||||
}
|
||||
|
||||
public ConfigSet worldConfigSet()
|
||||
{
|
||||
|
||||
public ConfigSet worldConfigSet() {
|
||||
return parent.worldConfigSet();
|
||||
}
|
||||
|
||||
public OptionList configBase()
|
||||
{
|
||||
|
||||
public OptionList configBase() {
|
||||
return parent.configBase();
|
||||
}
|
||||
|
||||
public boolean worldSpecific()
|
||||
{
|
||||
|
||||
/**
|
||||
* @return true if the world config contains a tag with this name
|
||||
*/
|
||||
public boolean worldSpecific() {
|
||||
return worldSpecific(configName());
|
||||
}
|
||||
|
||||
public boolean worldSpecific(String s)
|
||||
{
|
||||
|
||||
/**
|
||||
* @return true if the world config contains a tag with this name
|
||||
*/
|
||||
public boolean worldSpecific(String s) {
|
||||
return worldConfigSet().config.containsTag(s);
|
||||
}
|
||||
|
||||
public ConfigSet configSet()
|
||||
{
|
||||
|
||||
/**
|
||||
* @return The currently config set for the gui based on the world/global button
|
||||
*/
|
||||
public ConfigSet configSet() {
|
||||
return worldConfig() ? worldConfigSet() : globalConfigSet();
|
||||
}
|
||||
|
||||
public ConfigTag renderTag()
|
||||
{
|
||||
|
||||
/**
|
||||
* @return The tag to render, world if world override, otherwise global
|
||||
*/
|
||||
public ConfigTag renderTag() {
|
||||
return renderTag(configName());
|
||||
}
|
||||
|
||||
public ConfigTag renderTag(String s)
|
||||
{
|
||||
|
||||
/**
|
||||
* @return The tag to render, world if world override, otherwise global
|
||||
*/
|
||||
public ConfigTag renderTag(String s) {
|
||||
return (worldConfig() && worldSpecific(s) ? worldConfigSet() : globalConfigSet()).config.getTag(s);
|
||||
}
|
||||
|
||||
public ConfigTag getTag()
|
||||
{
|
||||
|
||||
/**
|
||||
* @return The tag with this name from the current configSet
|
||||
*/
|
||||
public ConfigTag getTag() {
|
||||
return getTag(configName());
|
||||
}
|
||||
|
||||
public ConfigTag getTag(String s)
|
||||
{
|
||||
|
||||
/**
|
||||
* @return The tag with this name from the current configSet
|
||||
*/
|
||||
public ConfigTag getTag(String s) {
|
||||
return configSet().config.getTag(s);
|
||||
}
|
||||
|
||||
public boolean worldConfig()
|
||||
{
|
||||
/**
|
||||
* @return true if the gui is in world config mode
|
||||
*/
|
||||
public boolean worldConfig() {
|
||||
return slot.getGui().worldConfig();
|
||||
}
|
||||
|
||||
public boolean renderDefault()
|
||||
{
|
||||
return renderDefault(configName());
|
||||
|
||||
/**
|
||||
* @return true if in world mode, but this tag has no world override. Changes should not be made in this mode
|
||||
*/
|
||||
public boolean defaulting() {
|
||||
return defaulting(configName());
|
||||
}
|
||||
|
||||
public boolean renderDefault(String s)
|
||||
{
|
||||
|
||||
/**
|
||||
* @return true if in world mode, but this tag has no world override. Changes should not be made in this mode
|
||||
*/
|
||||
public boolean defaulting(String s) {
|
||||
return worldConfig() && !worldSpecific(s);
|
||||
}
|
||||
|
||||
public void useGlobal()
|
||||
{
|
||||
|
||||
/**
|
||||
* Called when world specific is disabled for this option. Should delete all world specific overrides
|
||||
*/
|
||||
public void useGlobals() {
|
||||
useGlobal(configName());
|
||||
}
|
||||
|
||||
public void useGlobal(String s)
|
||||
{
|
||||
if(worldConfig())
|
||||
|
||||
/**
|
||||
* Deletes a specific named tag from the worldConfig
|
||||
*/
|
||||
public void useGlobal(String s) {
|
||||
if (worldConfig())
|
||||
worldConfigSet().config.removeTag(s);
|
||||
}
|
||||
|
||||
public void copyGlobal()
|
||||
{
|
||||
|
||||
/**
|
||||
* Called when world specific is activated for this option. Should copy the global value into a world specific override
|
||||
*/
|
||||
public void copyGlobals() {
|
||||
copyGlobal(configName());
|
||||
}
|
||||
|
||||
public void copyGlobal(String s)
|
||||
{
|
||||
if(worldConfig())
|
||||
worldConfigSet().config.getTag(s).setValue(globalConfigSet().config.getTag(s).getValue());
|
||||
|
||||
/**
|
||||
* Copies the global value into a world specific override
|
||||
*/
|
||||
public void copyGlobal(String s) {
|
||||
copyGlobal(s, false);
|
||||
}
|
||||
|
||||
public void onAdded(OptionScrollSlot slot)
|
||||
{
|
||||
|
||||
public void copyGlobal(String s, boolean recursive) {
|
||||
if (!worldConfig())
|
||||
return;
|
||||
|
||||
ConfigTag tag = globalConfigSet().config.getTag(s);
|
||||
worldConfigSet().config.getTag(s).setValue(tag.getValue());
|
||||
if(recursive)
|
||||
for(String s2 : tag.childTagMap().keySet())
|
||||
copyGlobal(s+"."+s2);
|
||||
}
|
||||
|
||||
public void onAdded(OptionScrollSlot slot) {
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public void onAdded(OptionList list)
|
||||
{
|
||||
|
||||
public void onAdded(OptionList list) {
|
||||
parent = list;
|
||||
}
|
||||
|
||||
public void onMouseClicked(int mousex, int mousey, int button)
|
||||
{
|
||||
}
|
||||
|
||||
public void mouseClicked(int mousex, int mousey, int button)
|
||||
{
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
|
||||
/**
|
||||
* Mouse coordinates are relative to screen
|
||||
*/
|
||||
public void onMouseClicked(int mx, int my, int button) {
|
||||
}
|
||||
|
||||
public void draw(int mousex, int mousey, float frame)
|
||||
{
|
||||
public void mouseClicked(int mx, int my, int button) {
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int keycode)
|
||||
{
|
||||
public void update() {
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip)
|
||||
{
|
||||
public void draw(int mx, int my, float frame) {
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int keycode) {
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(int mx, int my, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public boolean showWorldSelector()
|
||||
{
|
||||
|
||||
public boolean showWorldSelector() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void copyGlobals()
|
||||
{
|
||||
copyGlobal();
|
||||
}
|
||||
|
||||
public void useGlobals()
|
||||
{
|
||||
useGlobal();
|
||||
}
|
||||
|
||||
public boolean hasWorldOverride()
|
||||
{
|
||||
|
||||
public boolean hasWorldOverride() {
|
||||
return worldSpecific();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user