Facades should use names, not ids.
This commit is contained in:
@@ -27,6 +27,8 @@ import appeng.facade.FacadePart;
|
|||||||
import appeng.facade.IFacadeItem;
|
import appeng.facade.IFacadeItem;
|
||||||
import appeng.items.AEBaseItem;
|
import appeng.items.AEBaseItem;
|
||||||
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;
|
||||||
|
|
||||||
@@ -158,6 +160,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
ds[0] = Item.getIdFromItem( l.getItem() );
|
ds[0] = Item.getIdFromItem( l.getItem() );
|
||||||
ds[1] = metadata;
|
ds[1] = metadata;
|
||||||
data.setIntArray( "x", ds );
|
data.setIntArray( "x", ds );
|
||||||
|
UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
|
||||||
|
data.setString( "modid", ui.modId );
|
||||||
|
data.setString( "itemname", ui.name );
|
||||||
is.setTagCompound( data );
|
is.setTagCompound( data );
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
@@ -170,9 +175,16 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
NBTTagCompound data = is.getTagCompound();
|
NBTTagCompound data = is.getTagCompound();
|
||||||
if ( data != null )
|
if ( data != null )
|
||||||
{
|
{
|
||||||
int[] blk = data.getIntArray( "x" );
|
if ( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
|
||||||
if ( blk != null && blk.length == 2 )
|
{
|
||||||
return Block.getBlockById( blk[0] );
|
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int[] blk = data.getIntArray( "x" );
|
||||||
|
if ( blk != null && blk.length == 2 )
|
||||||
|
return Block.getBlockById( blk[0] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Blocks.glass;
|
return Blocks.glass;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user