Consistent Seeds.

This commit is contained in:
AlgorithmX2 2014-07-28 21:52:17 -05:00
parent 4078000005
commit 5db06128f8
3 changed files with 29 additions and 10 deletions

View file

@ -18,6 +18,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.implementations.items.IGrowableCrystal; import appeng.api.implementations.items.IGrowableCrystal;
import appeng.api.recipes.ResolverResult;
import appeng.core.AppEng; import appeng.core.AppEng;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.entity.EntityGrowingCrystal; import appeng.entity.EntityGrowingCrystal;
@ -238,10 +239,18 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + Fluix ) ) ); l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + Fluix ) ) );
} }
private ItemStack newStyle(ItemStack itemStack) private static ItemStack newStyle(ItemStack itemStack)
{ {
getProgress( itemStack ); ((ItemCrystalSeed) itemStack.getItem()).getProgress( itemStack );
return itemStack; return itemStack;
} }
public static ResolverResult getResolver(int certus2)
{
ItemStack is = AEApi.instance().items().itemCrystalSeed.stack( 1 );
is.setItemDamage( certus2 );
is = newStyle( is );
return new ResolverResult( "ItemCrystalSeed", is.getItemDamage(), is.getTagCompound() );
}
} }

View file

@ -24,12 +24,12 @@ public class AEItemResolver implements ISubItemResolver
{ {
if ( itemName.startsWith( "PaintBall." ) ) if ( itemName.startsWith( "PaintBall." ) )
{ {
return paintBall(AEApi.instance().items().itemPaintBall, itemName.substring( itemName.indexOf( "." ) + 1 ),false ); return paintBall( AEApi.instance().items().itemPaintBall, itemName.substring( itemName.indexOf( "." ) + 1 ), false );
} }
if ( itemName.startsWith( "LumenPaintBall." ) ) if ( itemName.startsWith( "LumenPaintBall." ) )
{ {
return paintBall(AEApi.instance().items().itemPaintBall, itemName.substring( itemName.indexOf( "." ) + 1 ), true ); return paintBall( AEApi.instance().items().itemPaintBall, itemName.substring( itemName.indexOf( "." ) + 1 ), true );
} }
if ( itemName.equals( "CableGlass" ) ) if ( itemName.equals( "CableGlass" ) )
@ -75,7 +75,7 @@ public class AEItemResolver implements ISubItemResolver
if ( itemName.startsWith( "ItemCrystalSeed." ) ) if ( itemName.startsWith( "ItemCrystalSeed." ) )
{ {
if ( itemName.equalsIgnoreCase( "ItemCrystalSeed.Certus" ) ) if ( itemName.equalsIgnoreCase( "ItemCrystalSeed.Certus" ) )
return new ResolverResult( "ItemCrystalSeed", ItemCrystalSeed.Certus ); return ItemCrystalSeed.getResolver( ItemCrystalSeed.Certus );
if ( itemName.equalsIgnoreCase( "ItemCrystalSeed.Nether" ) ) if ( itemName.equalsIgnoreCase( "ItemCrystalSeed.Nether" ) )
return new ResolverResult( "ItemCrystalSeed", ItemCrystalSeed.Nether ); return new ResolverResult( "ItemCrystalSeed", ItemCrystalSeed.Nether );
if ( itemName.equalsIgnoreCase( "ItemCrystalSeed.Fluix" ) ) if ( itemName.equalsIgnoreCase( "ItemCrystalSeed.Fluix" ) )
@ -124,7 +124,7 @@ public class AEItemResolver implements ISubItemResolver
return null; return null;
ItemStack is = partType.stack( col, 1 ); ItemStack is = partType.stack( col, 1 );
return new ResolverResult( "ItemPaintBall", (lumen?20:0)+is.getItemDamage() ); return new ResolverResult( "ItemPaintBall", (lumen ? 20 : 0) + is.getItemDamage() );
} }
private Object cableItem(AEColoredItemDefinition partType, String substring) private Object cableItem(AEColoredItemDefinition partType, String substring)

View file

@ -5,6 +5,7 @@ import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
@ -23,6 +24,7 @@ public class Ingredient implements IIngredient
final public String nameSpace; final public String nameSpace;
final public String itemName; final public String itemName;
final public int meta; final public int meta;
NBTTagCompound nbt = null;
final public int qty; final public int qty;
@ -69,6 +71,7 @@ public class Ingredient implements IIngredient
ResolverResult rr = (ResolverResult) ro; ResolverResult rr = (ResolverResult) ro;
tmpName = rr.itemName; tmpName = rr.itemName;
sel = rr.damageValue; sel = rr.damageValue;
nbt = rr.compound;
} }
else if ( ro instanceof ResolverResultSet ) else if ( ro instanceof ResolverResultSet )
{ {
@ -126,7 +129,7 @@ public class Ingredient implements IIngredient
{ {
Item it = Item.getItemFromBlock( blk ); Item it = Item.getItemFromBlock( blk );
if ( it != null ) if ( it != null )
return new ItemStack( it, qty, meta ); return MakeItemStack( it, qty, meta, nbt );
} }
Item it = GameRegistry.findItem( nameSpace, itemName ); Item it = GameRegistry.findItem( nameSpace, itemName );
@ -134,7 +137,7 @@ public class Ingredient implements IIngredient
it = GameRegistry.findItem( nameSpace, "item." + itemName ); it = GameRegistry.findItem( nameSpace, "item." + itemName );
if ( it != null ) if ( it != null )
return new ItemStack( it, qty, meta ); return MakeItemStack( it, qty, meta, nbt );
/* /*
* Object o = Item.itemRegistry.getObject( nameSpace + ":" + itemName ); if ( o instanceof Item ) return new * Object o = Item.itemRegistry.getObject( nameSpace + ":" + itemName ); if ( o instanceof Item ) return new
@ -152,6 +155,13 @@ public class Ingredient implements IIngredient
throw new MissingIngredientError( "Unable to find item: " + toString() ); throw new MissingIngredientError( "Unable to find item: " + toString() );
} }
private ItemStack MakeItemStack(Item it, int quantity, int damageValue, NBTTagCompound compound)
{
ItemStack is = new ItemStack( it, quantity, damageValue );
is.setTagCompound( compound );
return is;
}
@Override @Override
public String toString() public String toString()
{ {