Search By Mod ID

This commit is contained in:
AlgorithmX2 2014-07-02 21:09:17 -05:00
parent 4a88f87e2a
commit ab68154885
4 changed files with 41 additions and 1 deletions

View file

@ -198,6 +198,13 @@ public class ItemRepo
boolean terminalSearchToolTips = AEConfig.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
boolean searchMod = false;
if ( searchString.startsWith( "@" ) )
{
searchMod = true;
searchString = searchString.substring( 1 );
}
Pattern m = null;
try
{
@ -236,7 +243,7 @@ public class ItemRepo
if ( vmode == ViewItems.STORED && is.getStackSize() == 0 )
continue;
String dspName = Platform.getItemDisplayName( is );
String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
notDone = true;
if ( m.matcher( dspName.toLowerCase() ).find() )

View file

@ -791,6 +791,15 @@ public class Platform
}
}
public static String getModId(IAEItemStack is)
{
if ( is == null )
return "** Null";
String n = ((AEItemStack) is).getModID();
return n == null ? "** Null" : n;
}
public static String getItemDisplayName(Object o)
{
if ( o == null )

View file

@ -7,6 +7,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -32,6 +33,9 @@ public class AEItemDef
@SideOnly(Side.CLIENT)
public List tooltip;
@SideOnly(Side.CLIENT)
public UniqueIdentifier uniqueID;
public OreRefrence isOre;
static AESharedNBT lowTag = new AESharedNBT( Integer.MIN_VALUE );

View file

@ -18,6 +18,8 @@ import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAETagCompound;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -273,6 +275,23 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return def.displayName = Platform.getItemDisplayName( getItemStack() );
}
@SideOnly(Side.CLIENT)
public String getModID()
{
if ( def.uniqueID != null )
return getModName( def.uniqueID );
return getModName( def.uniqueID = GameRegistry.findUniqueIdentifierFor( def.item ) );
}
private String getModName(UniqueIdentifier uniqueIdentifier)
{
if ( uniqueIdentifier == null )
return "** Null";
return uniqueIdentifier.modId == null ? "** Null" : uniqueIdentifier.modId;
}
@Override
public IAEItemStack empty()
{
@ -588,4 +607,5 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
return def.isOre != null;
}
}