Fixed an issue where Parts/Blocks would not properly identify them selves with the proper ItemStack.

This commit is contained in:
AlgorithmX2
2014-02-09 01:55:44 -06:00
parent 7367502d75
commit 49da876b6f
9 changed files with 66 additions and 27 deletions
+4 -4
View File
@@ -27,6 +27,7 @@ import appeng.api.implementations.items.IUpgradeModule;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.ItemStackSrc;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
@@ -109,7 +110,7 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
}
}
public ItemStack createMaterial(MaterialType mat)
public ItemStackSrc createMaterial(MaterialType mat)
{
String name = mat.name();
@@ -123,13 +124,12 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
{
int newMaterialNum = AEConfig.instance.get( "materials", name, AEConfig.instance.getFreeMaterial() ).getInt();
mat.damageValue = newMaterialNum;
ItemStack output = new ItemStack( this, 1, newMaterialNum );
output.setItemDamage( newMaterialNum );
ItemStackSrc output = new ItemStackSrc( this, newMaterialNum );
dmgToMaterial.put( newMaterialNum, mat );
if ( mat.getOreName() != null )
OreDictionary.registerOre( mat.getOreName(), output );
OreDictionary.registerOre( mat.getOreName(), output.stack( 1 ) );
return output;
}
+4 -3
View File
@@ -19,6 +19,7 @@ import appeng.api.parts.IPartItem;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.ItemStackSrc;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import cpw.mods.fml.relauncher.Side;
@@ -47,10 +48,11 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
setHasSubtypes( true );
}
public ItemStack createPart(PartType mat, Enum varient)
public ItemStackSrc createPart(PartType mat, Enum varient)
{
try
{
// I think this still works?
ItemStack is = new ItemStack( this );
mat.getPart().getConstructor( ItemStack.class ).newInstance( is );
}
@@ -76,8 +78,7 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
if ( enabled )
{
int newPartNum = AEConfig.instance.get( "parts", name, AEConfig.instance.getFreePart() ).getInt();
ItemStack output = new ItemStack( this );
output.setItemDamage( newPartNum );
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
PartTypeIst pti = new PartTypeIst();
pti.part = mat;