From bd5e80fba147e033e1b6b87778bd728a01a5ebf8 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sun, 11 May 2014 11:41:31 -0500 Subject: [PATCH] Facades should use names, not ids. --- items/parts/ItemFacade.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/items/parts/ItemFacade.java b/items/parts/ItemFacade.java index 7ce29ec09..947dd5d4c 100644 --- a/items/parts/ItemFacade.java +++ b/items/parts/ItemFacade.java @@ -27,6 +27,8 @@ import appeng.facade.FacadePart; import appeng.facade.IFacadeItem; import appeng.items.AEBaseItem; 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; @@ -158,6 +160,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte ds[0] = Item.getIdFromItem( l.getItem() ); ds[1] = metadata; data.setIntArray( "x", ds ); + UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() ); + data.setString( "modid", ui.modId ); + data.setString( "itemname", ui.name ); is.setTagCompound( data ); return is; } @@ -170,9 +175,16 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte NBTTagCompound data = is.getTagCompound(); if ( data != null ) { - int[] blk = data.getIntArray( "x" ); - if ( blk != null && blk.length == 2 ) - return Block.getBlockById( blk[0] ); + if ( data.hasKey( "modid" ) && data.hasKey( "itemname" ) ) + { + 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; }