Added NEI Sync.
This commit is contained in:
@@ -30,6 +30,7 @@ import appeng.container.implementations.ContainerMEMonitorable;
|
|||||||
import appeng.container.slot.AppEngSlot;
|
import appeng.container.slot.AppEngSlot;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.AppEng;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
@@ -132,8 +133,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
maxRows = getMaxRows();
|
maxRows = getMaxRows();
|
||||||
perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
|
perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
|
||||||
|
|
||||||
int NEI = 0;
|
boolean hasNEI = AppEng.instance.isIntegrationEnabled( "NEI" );
|
||||||
int top = 4;
|
|
||||||
|
int NEI = hasNEI ? 4 : 0;
|
||||||
|
int top = hasNEI ? 22 : 4;
|
||||||
|
|
||||||
int magicNumber = 114 + 1;
|
int magicNumber = 114 + 1;
|
||||||
int extraSpace = height - magicNumber - NEI - top - reservedSpace;
|
int extraSpace = height - magicNumber - NEI - top - reservedSpace;
|
||||||
|
|
||||||
@@ -144,6 +148,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
rows = maxRows;
|
rows = maxRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( hasNEI )
|
||||||
|
rows--;
|
||||||
|
|
||||||
meSlots.clear();
|
meSlots.clear();
|
||||||
for (int y = 0; y < rows; y++)
|
for (int y = 0; y < rows; y++)
|
||||||
{
|
{
|
||||||
@@ -181,7 +188,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
.getSetting( Settings.SEARCH_MODE ) ) );
|
.getSetting( Settings.SEARCH_MODE ) ) );
|
||||||
offset += 20;
|
offset += 20;
|
||||||
|
|
||||||
if ( !(this instanceof GuiMEPortableCell ) )
|
if ( !(this instanceof GuiMEPortableCell) )
|
||||||
{
|
{
|
||||||
buttonList.add( terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings
|
buttonList.add( terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings
|
||||||
.getSetting( Settings.TERMINAL_STYLE ) ) );
|
.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||||
@@ -299,7 +306,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
bindTexture( getBackground() );
|
bindTexture( getBackground() );
|
||||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
||||||
|
|
||||||
if ( viewCell || ( this instanceof GuiSecurity))
|
if ( viewCell || (this instanceof GuiSecurity) )
|
||||||
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
|
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
|
||||||
|
|
||||||
for (int x = 0; x < rows; x++)
|
for (int x = 0; x < rows; x++)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package appeng.client.me;
|
package appeng.client.me;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -8,6 +10,7 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.config.SearchBoxMode;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.SortOrder;
|
import appeng.api.config.SortOrder;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
@@ -26,6 +29,7 @@ import appeng.util.prioitylist.FuzzyPriorityList;
|
|||||||
import appeng.util.prioitylist.IPartitionList;
|
import appeng.util.prioitylist.IPartitionList;
|
||||||
import appeng.util.prioitylist.MergedPriorityList;
|
import appeng.util.prioitylist.MergedPriorityList;
|
||||||
import appeng.util.prioitylist.PrecisePriorityList;
|
import appeng.util.prioitylist.PrecisePriorityList;
|
||||||
|
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||||
|
|
||||||
public class ItemRepo
|
public class ItemRepo
|
||||||
{
|
{
|
||||||
@@ -151,6 +155,32 @@ public class ItemRepo
|
|||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String NEIWord = null;
|
||||||
|
|
||||||
|
private void updateNEI(String filter)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( NEIWord == null || !NEIWord.equals( filter ) )
|
||||||
|
{
|
||||||
|
Class c = ReflectionHelper.getClass( getClass().getClassLoader(), "codechicken.nei.LayoutManager" );
|
||||||
|
Field fldSearchField = c.getField( "searchField" );
|
||||||
|
Object searchField = fldSearchField.get( c );
|
||||||
|
|
||||||
|
Method a = searchField.getClass().getMethod( "setText", String.class );
|
||||||
|
Method b = searchField.getClass().getMethod( "onTextChange", String.class );
|
||||||
|
|
||||||
|
NEIWord = filter;
|
||||||
|
a.invoke( searchField, filter );
|
||||||
|
b.invoke( searchField, "" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Throwable _)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateView()
|
public void updateView()
|
||||||
{
|
{
|
||||||
view.clear();
|
view.clear();
|
||||||
@@ -159,6 +189,10 @@ public class ItemRepo
|
|||||||
view.ensureCapacity( list.size() );
|
view.ensureCapacity( list.size() );
|
||||||
dsp.ensureCapacity( list.size() );
|
dsp.ensureCapacity( list.size() );
|
||||||
|
|
||||||
|
Enum mode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||||
|
if ( mode == SearchBoxMode.NEI_AUTOSEARCH || mode == SearchBoxMode.NEI_MANUAL_SEARCH )
|
||||||
|
updateNEI( searchString );
|
||||||
|
|
||||||
boolean terminalSearchToolTips = AEConfig.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
boolean terminalSearchToolTips = AEConfig.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||||
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user