Search By Mod ID
This commit is contained in:
@@ -198,6 +198,13 @@ public class ItemRepo
|
|||||||
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;
|
||||||
|
|
||||||
|
boolean searchMod = false;
|
||||||
|
if ( searchString.startsWith( "@" ) )
|
||||||
|
{
|
||||||
|
searchMod = true;
|
||||||
|
searchString = searchString.substring( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
Pattern m = null;
|
Pattern m = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -236,7 +243,7 @@ public class ItemRepo
|
|||||||
if ( vmode == ViewItems.STORED && is.getStackSize() == 0 )
|
if ( vmode == ViewItems.STORED && is.getStackSize() == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String dspName = Platform.getItemDisplayName( is );
|
String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
|
||||||
notDone = true;
|
notDone = true;
|
||||||
|
|
||||||
if ( m.matcher( dspName.toLowerCase() ).find() )
|
if ( m.matcher( dspName.toLowerCase() ).find() )
|
||||||
|
|||||||
@@ -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)
|
public static String getItemDisplayName(Object o)
|
||||||
{
|
{
|
||||||
if ( o == null )
|
if ( o == null )
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@@ -32,6 +33,9 @@ public class AEItemDef
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public List tooltip;
|
public List tooltip;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public UniqueIdentifier uniqueID;
|
||||||
|
|
||||||
public OreRefrence isOre;
|
public OreRefrence isOre;
|
||||||
|
|
||||||
static AESharedNBT lowTag = new AESharedNBT( Integer.MIN_VALUE );
|
static AESharedNBT lowTag = new AESharedNBT( Integer.MIN_VALUE );
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import appeng.api.storage.StorageChannel;
|
|||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IAETagCompound;
|
import appeng.api.storage.data.IAETagCompound;
|
||||||
import appeng.util.Platform;
|
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.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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() );
|
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
|
@Override
|
||||||
public IAEItemStack empty()
|
public IAEItemStack empty()
|
||||||
{
|
{
|
||||||
@@ -588,4 +607,5 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
{
|
{
|
||||||
return def.isOre != null;
|
return def.isOre != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user