Compare commits

...

8 Commits

Author SHA1 Message Date
thatsIch 23aa8fd72d Merge pull request #1337 from thatsIch/e-1333-recipe-sorter
Fixes #1333: Updated old code parts related to recipes
2015-04-28 19:44:55 +02:00
yueh 106003ebf9 Merge pull request #1349 from yueh/fix-1348
Removed MJ as icon
2015-04-28 19:11:21 +02:00
thatsIch 8271597394 Merge pull request #1341 from thatsIch/b-1339-server-crash
Fixes #1339: Was not able to retrieve the name of an unregistered part
2015-04-28 18:42:42 +02:00
thatsIch 9210069d9b Fixes #1333: Updated old code parts related to recipes
Fixed an additional bug, where the disassembling recipes were not working properly. The fail logic was flawed, so that it would never match the recipe
2015-04-28 18:37:46 +02:00
yueh f364359905 Removed MJ as icon
Fixes #1348
2015-04-28 18:28:54 +02:00
thatsIch fb618b939f Merge pull request #1342 from Mazdallier/patch-1
Update fr_FR.lang
2015-04-27 15:48:33 +02:00
Yves 43a47f8971 Update fr_FR.lang
Minor correction and group organisation
2015-04-27 13:23:28 +02:00
thatsIch e85acf2bee Fixes #1339: Was not able to retrieve the name of an unregistered part
Added an additional map to store all parts and be able to access them if needed.
Added public preconditions
Added private asserts
Excluded public overridden methods, since behaviour can be unexpected
2015-04-27 09:51:40 +02:00
7 changed files with 219 additions and 188 deletions
+8 -3
View File
@@ -22,7 +22,6 @@ package appeng.core;
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.item.crafting.CraftingManager;
import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.ChestGenHooks;
@@ -562,10 +561,16 @@ public final class Registration
registration.registerAchievements(); registration.registerAchievements();
if( AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting ) ) if( AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting ) )
CraftingManager.getInstance().getRecipeList().add( new DisassembleRecipe() ); {
GameRegistry.addRecipe( new DisassembleRecipe() );
RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS, "after:minecraft:shapeless" );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.enableFacadeCrafting ) ) if( AEConfig.instance.isFeatureEnabled( AEFeature.enableFacadeCrafting ) )
CraftingManager.getInstance().getRecipeList().add( new FacadeRecipe() ); {
GameRegistry.addRecipe( new FacadeRecipe() );
RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED, "after:minecraft:shaped" );
}
} }
public void postInit( FMLPostInitializationEvent event ) public void postInit( FMLPostInitializationEvent event )
@@ -3,8 +3,6 @@ package appeng.core.api.definitions;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import com.google.common.base.Optional;
import appeng.api.definitions.IBlockDefinition; import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IItemDefinition; import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.ITileDefinition; import appeng.api.definitions.ITileDefinition;
@@ -91,13 +89,9 @@ public class DefinitionConstructor
for( AEColor color : AEColor.values() ) for( AEColor color : AEColor.values() )
{ {
ItemStackSrc multiPartSource = target.createPart( type, color ); final ItemStackSrc multiPartSource = target.createPart( type, color );
final Optional<ItemStackSrc> maybeSource = Optional.fromNullable( multiPartSource );
if( maybeSource.isPresent() ) definition.add( color, multiPartSource );
{
definition.add( color, multiPartSource );
}
} }
return definition; return definition;
@@ -79,9 +79,7 @@ public enum AEFeature
AEFeature( String cat ) AEFeature( String cat )
{ {
this.category = cat; this(cat, true);
this.isVisible = !this.name().equals( "Core" );
this.defaultValue = true;
} }
AEFeature( String cat, boolean defaultValue ) AEFeature( String cat, boolean defaultValue )
@@ -19,6 +19,7 @@
package appeng.items.parts; package appeng.items.parts;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@@ -28,6 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -41,6 +43,8 @@ import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.base.Preconditions;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IItemGroup;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
@@ -48,7 +52,6 @@ import appeng.api.parts.IPartHelper;
import appeng.api.parts.IPartItem; import appeng.api.parts.IPartItem;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.core.features.ItemStackSrc; import appeng.core.features.ItemStackSrc;
import appeng.core.features.NameResolver; import appeng.core.features.NameResolver;
@@ -58,27 +61,55 @@ import appeng.integration.IntegrationType;
import appeng.items.AEBaseItem; import appeng.items.AEBaseItem;
public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
{ {
public static ItemMultiPart instance; public static ItemMultiPart instance;
private final NameResolver nameResolver; private final NameResolver nameResolver;
private final Map<Integer, PartTypeIst> dmgToPart = new HashMap<Integer, PartTypeIst>(); private final Map<Integer, PartTypeWithVariant> registered;
private final Map<Integer, PartTypeWithVariant> unregistered;
public ItemMultiPart( IPartHelper partHelper ) public ItemMultiPart( IPartHelper partHelper )
{ {
Preconditions.checkNotNull( partHelper );
this.registered = new HashMap<Integer, PartTypeWithVariant>();
this.unregistered = new HashMap<Integer, PartTypeWithVariant>();
this.nameResolver = new NameResolver( this.getClass() ); this.nameResolver = new NameResolver( this.getClass() );
this.setFeature( EnumSet.of( AEFeature.Core ) ); this.setFeature( EnumSet.of( AEFeature.Core ) );
partHelper.setItemBusRenderer( this ); partHelper.setItemBusRenderer( this );
this.setHasSubtypes( true ); this.setHasSubtypes( true );
instance = this; instance = this;
} }
@Nonnull
public final ItemStackSrc createPart( PartType mat ) public final ItemStackSrc createPart( PartType mat )
{ {
int varID = 0; Preconditions.checkNotNull( mat );
return this.createPart( mat, 0 );
}
@Nonnull
public ItemStackSrc createPart( PartType mat, AEColor color )
{
Preconditions.checkNotNull( mat );
Preconditions.checkNotNull( color );
final int varID = color.ordinal();
return this.createPart( mat, varID );
}
@Nonnull
private ItemStackSrc createPart( PartType mat, int varID )
{
assert mat != null;
assert varID >= 0;
// verify // verify
for( PartTypeIst p : this.dmgToPart.values() ) for( PartTypeWithVariant p : this.registered.values() )
{ {
if( p.part == mat && p.variant == varID ) if( p.part == mat && p.variant == varID )
throw new IllegalStateException( "Cannot create the same material twice..." ); throw new IllegalStateException( "Cannot create the same material twice..." );
@@ -91,81 +122,34 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
for( IntegrationType integrationType : mat.getIntegrations() ) for( IntegrationType integrationType : mat.getIntegrations() )
enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType ); enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType );
int newPartNum = mat.baseDamage + varID; final int partDamage = mat.baseDamage + varID;
ItemStackSrc output = new ItemStackSrc( this, newPartNum ); final ItemStackSrc output = new ItemStackSrc( this, partDamage );
if( enabled ) final PartTypeWithVariant pti = new PartTypeWithVariant( mat, varID );
{
PartTypeIst pti = new PartTypeIst();
pti.part = mat;
pti.variant = varID;
if( this.dmgToPart.get( newPartNum ) == null ) this.processMetaOverlap( enabled, partDamage, mat, pti );
{
this.dmgToPart.put( newPartNum, pti );
return output;
}
else
{
throw new IllegalStateException( "Meta Overlap detected." );
}
}
return output; return output;
} }
public ItemStackSrc createPart( PartType mat, Enum variant ) private void processMetaOverlap( boolean enabled, int partDamage, PartType mat, PartTypeWithVariant pti )
{ {
try assert partDamage >= 0;
{ assert mat != null;
// I think this still works? assert pti != null;
ItemStack is = new ItemStack( this );
mat.getPart().getConstructor( ItemStack.class ).newInstance( is );
}
catch( Throwable e )
{
AELog.integration( e );
e.printStackTrace();
return null; // part not supported..
}
int varID = variant == null ? 0 : variant.ordinal(); final Map<Integer, PartTypeWithVariant> reference = ( enabled ) ? this.registered : this.unregistered;
if( reference.containsKey( partDamage ) )
throw new IllegalStateException( "Meta Overlap detected with type " + mat + " and damage " + partDamage + ". Found " + reference.get( partDamage ) + " there already." );
// verify reference.put( partDamage, pti );
for( PartTypeIst p : this.dmgToPart.values() )
{
if( p.part == mat && p.variant == varID )
throw new IllegalStateException( "Cannot create the same material twice..." );
}
boolean enabled = true;
for( AEFeature f : mat.getFeature() )
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
if( enabled )
{
int newPartNum = mat.baseDamage + varID;
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
PartTypeIst pti = new PartTypeIst();
pti.part = mat;
pti.variant = varID;
if( this.dmgToPart.get( newPartNum ) == null )
{
this.dmgToPart.put( newPartNum, pti );
return output;
}
else
throw new IllegalStateException( "Meta Overlap detected." );
}
return null;
} }
public int getDamageByType( PartType t ) public int getDamageByType( PartType t )
{ {
for( Entry<Integer, PartTypeIst> pt : this.dmgToPart.entrySet() ) Preconditions.checkNotNull( t );
for( Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
{ {
if( pt.getValue().part == t ) if( pt.getValue().part == t )
return pt.getKey(); return pt.getKey();
@@ -183,7 +167,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
@Override @Override
public IIcon getIconFromDamage( int dmg ) public IIcon getIconFromDamage( int dmg )
{ {
return this.dmgToPart.get( dmg ).ico; return this.registered.get( dmg ).ico;
} }
@Override @Override
@@ -198,36 +182,16 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
return "item.appliedenergistics2." + this.getName( is ); return "item.appliedenergistics2." + this.getName( is );
} }
public String getName( ItemStack is )
{
return this.nameResolver.getName( this.getTypeByStack( is ).name() );
}
@Nullable
public PartType getTypeByStack( ItemStack is )
{
if( is == null )
return null;
PartTypeIst pt = this.dmgToPart.get( is.getItemDamage() );
if( pt != null )
return pt.part;
return null;
}
@Override @Override
public String getItemStackDisplayName( ItemStack is ) public String getItemStackDisplayName( ItemStack is )
{ {
PartType pt = this.getTypeByStack( is ); final PartType pt = this.getTypeByStack( is );
if( pt == null )
return "Unnamed";
if( pt.isCable() ) if( pt.isCable() )
{ {
final AEColor[] variants = AEColor.values(); final AEColor[] variants = AEColor.values();
return super.getItemStackDisplayName( is ) + " - " + variants[this.dmgToPart.get( is.getItemDamage() ).variant].toString(); return super.getItemStackDisplayName( is ) + " - " + variants[this.registered.get( is.getItemDamage() ).variant].toString();
} }
if( pt.getExtraName() != null ) if( pt.getExtraName() != null )
@@ -239,60 +203,96 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
@Override @Override
public void getSubItems( Item number, CreativeTabs tab, List cList ) public void getSubItems( Item number, CreativeTabs tab, List cList )
{ {
List<Entry<Integer, PartTypeIst>> types = new ArrayList<Entry<Integer, PartTypeIst>>( this.dmgToPart.entrySet() ); List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
Collections.sort( types, new Comparator<Entry<Integer, PartTypeIst>>() Collections.sort( types, new Comparator<Entry<Integer, PartTypeWithVariant>>()
{ {
@Override @Override
public int compare( Entry<Integer, PartTypeIst> o1, Entry<Integer, PartTypeIst> o2 ) public int compare( Entry<Integer, PartTypeWithVariant> o1, Entry<Integer, PartTypeWithVariant> o2 )
{ {
return o1.getValue().part.name().compareTo( o2.getValue().part.name() ); return o1.getValue().part.name().compareTo( o2.getValue().part.name() );
} }
} ); } );
for( Entry<Integer, PartTypeIst> part : types ) for( Entry<Integer, PartTypeWithVariant> part : types )
cList.add( new ItemStack( this, 1, part.getKey() ) ); cList.add( new ItemStack( this, 1, part.getKey() ) );
} }
@Override @Override
public void registerIcons( IIconRegister par1IconRegister ) public void registerIcons( IIconRegister par1IconRegister )
{ {
for( Entry<Integer, PartTypeIst> part : this.dmgToPart.entrySet() ) for( Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
{ {
String tex = "appliedenergistics2:" + this.getName( new ItemStack( this, 1, part.getKey() ) ); String tex = "appliedenergistics2:" + this.getName( new ItemStack( this, 1, part.getKey() ) );
part.getValue().ico = par1IconRegister.registerIcon( tex ); part.getValue().ico = par1IconRegister.registerIcon( tex );
} }
} }
public String getName( ItemStack is )
{
Preconditions.checkNotNull( is );
final PartType stackType = this.getTypeByStack( is );
final String typeName = stackType.name();
return this.nameResolver.getName( typeName );
}
@Nonnull
public PartType getTypeByStack( ItemStack is )
{
Preconditions.checkNotNull( is );
final PartTypeWithVariant pt = this.registered.get( is.getItemDamage() );
if( pt != null )
return pt.part;
final PartTypeWithVariant unregisteredPartType = this.unregistered.get( is.getItemDamage() );
if( unregisteredPartType != null )
return unregisteredPartType.part;
throw new IllegalStateException( "ItemStack " + is + " has to be either registered or unregistered, but was not found in either." );
}
@Nonnull
@Override @Override
public IPart createPartFromItemStack( ItemStack is ) public IPart createPartFromItemStack( ItemStack is )
{ {
final PartType type = this.getTypeByStack( is );
final Class<? extends IPart> part = type.getPart();
try try
{ {
PartType t = this.getTypeByStack( is ); if( type.constructor == null )
if( t != null ) type.constructor = part.getConstructor( ItemStack.class );
{
if( t.constructor == null )
t.constructor = t.getPart().getConstructor( ItemStack.class );
return t.constructor.newInstance( is ); return type.constructor.newInstance( is );
}
} }
catch( Throwable e ) catch( InstantiationException e )
{ {
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + this.getTypeByStack( is ).getPart().getName() + " ; Possibly didn't have correct constructor( ItemStack )", e ); throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
catch( IllegalAccessException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
catch( InvocationTargetException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
catch( NoSuchMethodException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
} }
return null;
} }
public int variantOf( int itemDamage ) public int variantOf( int itemDamage )
{ {
if( this.dmgToPart.containsKey( itemDamage ) ) if( this.registered.containsKey( itemDamage ) )
return this.dmgToPart.get( itemDamage ).variant; return this.registered.get( itemDamage ).variant;
return 0; return 0;
} }
@Nullable
@Override @Override
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is ) public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
{ {
@@ -307,22 +307,19 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
if( stack.getItem() == this ) if( stack.getItem() == this )
{ {
PartType pt = this.getTypeByStack( stack ); PartType pt = this.getTypeByStack( stack );
if ( pt != null ) switch( pt )
{ {
switch( pt ) case ImportBus:
{ importBus = true;
case ImportBus: if( u == pt )
importBus = true; group = true;
if( u == pt ) break;
group = true; case ExportBus:
break; exportBus = true;
case ExportBus: if( u == pt )
exportBus = true; group = true;
if( u == pt ) break;
group = true; default:
break;
default:
}
} }
} }
} }
@@ -333,17 +330,21 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
return null; return null;
} }
public ItemStack getStackFromTypeAndVariant( PartType mt, int variant ) private static final class PartTypeWithVariant
{ {
return new ItemStack( this, 1, mt.baseDamage + variant ); private final PartType part;
} private final int variant;
private static class PartTypeIst
{
private PartType part;
private int variant;
@SideOnly( Side.CLIENT ) @SideOnly( Side.CLIENT )
private IIcon ico; private IIcon ico;
private PartTypeWithVariant( PartType part, int variant )
{
assert part != null;
assert variant >= 0;
this.part = part;
this.variant = variant;
}
} }
} }
@@ -21,12 +21,17 @@ package appeng.recipes.game;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.google.common.base.Optional;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.definitions.IBlocks; import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions; import appeng.api.definitions.IDefinitions;
@@ -39,109 +44,116 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
public class DisassembleRecipe implements IRecipe public final class DisassembleRecipe implements IRecipe
{ {
private static final ItemStack MISMATCHED_STACK = null;
private final IMaterials mats;
private final IItems items;
private final IBlocks blocks;
private final Map<IItemDefinition, IItemDefinition> cellMappings; private final Map<IItemDefinition, IItemDefinition> cellMappings;
private final Map<IItemDefinition, IItemDefinition> nonCellMappings; private final Map<IItemDefinition, IItemDefinition> nonCellMappings;
public DisassembleRecipe() public DisassembleRecipe()
{ {
final IDefinitions definitions = AEApi.instance().definitions(); final IDefinitions definitions = AEApi.instance().definitions();
final IBlocks blocks = definitions.blocks();
final IItems items = definitions.items();
final IMaterials mats = definitions.materials();
this.blocks = definitions.blocks();
this.items = definitions.items();
this.mats = definitions.materials();
this.cellMappings = new HashMap<IItemDefinition, IItemDefinition>( 4 ); this.cellMappings = new HashMap<IItemDefinition, IItemDefinition>( 4 );
this.nonCellMappings = new HashMap<IItemDefinition, IItemDefinition>( 5 ); this.nonCellMappings = new HashMap<IItemDefinition, IItemDefinition>( 5 );
this.cellMappings.put( this.items.cell1k(), this.mats.cell1kPart() ); this.cellMappings.put( items.cell1k(), mats.cell1kPart() );
this.cellMappings.put( this.items.cell4k(), this.mats.cell4kPart() ); this.cellMappings.put( items.cell4k(), mats.cell4kPart() );
this.cellMappings.put( this.items.cell16k(), this.mats.cell16kPart() ); this.cellMappings.put( items.cell16k(), mats.cell16kPart() );
this.cellMappings.put( this.items.cell64k(), this.mats.cell64kPart() ); this.cellMappings.put( items.cell64k(), mats.cell64kPart() );
this.nonCellMappings.put( this.items.encodedPattern(), this.mats.blankPattern() ); this.nonCellMappings.put( items.encodedPattern(), mats.blankPattern() );
this.nonCellMappings.put( this.blocks.craftingStorage1k(), this.mats.cell1kPart() ); this.nonCellMappings.put( blocks.craftingStorage1k(), mats.cell1kPart() );
this.nonCellMappings.put( this.blocks.craftingStorage4k(), this.mats.cell4kPart() ); this.nonCellMappings.put( blocks.craftingStorage4k(), mats.cell4kPart() );
this.nonCellMappings.put( this.blocks.craftingStorage16k(), this.mats.cell16kPart() ); this.nonCellMappings.put( blocks.craftingStorage16k(), mats.cell16kPart() );
this.nonCellMappings.put( this.blocks.craftingStorage64k(), this.mats.cell64kPart() ); this.nonCellMappings.put( blocks.craftingStorage64k(), mats.cell64kPart() );
} }
@Override @Override
public boolean matches( InventoryCrafting inv, World w ) public boolean matches( InventoryCrafting inv, World w )
{ {
return this.getOutput( inv, false ) != null; return this.getOutput( inv ) != null;
} }
private ItemStack getOutput( InventoryCrafting inv, boolean createFacade ) @Nullable
private ItemStack getOutput( IInventory inventory )
{ {
ItemStack hasCell = null; int itemCount = 0;
ItemStack output = MISMATCHED_STACK;
for( int x = 0; x < inv.getSizeInventory(); x++ ) for( int slotIndex = 0; slotIndex < inventory.getSizeInventory(); slotIndex++ )
{ {
ItemStack is = inv.getStackInSlot( x ); ItemStack stackInSlot = inventory.getStackInSlot( slotIndex );
if( is != null ) if( stackInSlot != null )
{ {
if( hasCell != null ) // needs a single input in the recipe
return null; itemCount++;
if ( itemCount > 1 )
return MISMATCHED_STACK;
hasCell = this.getCellOutput( is ); // handle storage cells
for( ItemStack storageCellStack : this.getCellOutput( stackInSlot ).asSet() )
// make sure the storage cell is empty...
if( hasCell != null )
{ {
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS ); // make sure the storage cell stackInSlot empty...
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null, StorageChannel.ITEMS );
if( cellInv != null ) if( cellInv != null )
{ {
IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() ); IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
if( !list.isEmpty() ) if( !list.isEmpty() )
return null; return null;
} }
output = storageCellStack;
} }
hasCell = this.getNonCellOutput( is ); // handle crafting storage blocks
for( ItemStack craftingStorageStack : this.getNonCellOutput( stackInSlot ).asSet() )
if( hasCell == null ) {
return null; output = craftingStorageStack;
}
} }
} }
return hasCell; return output;
} }
private ItemStack getCellOutput( ItemStack compared ) @Nonnull
private Optional<ItemStack> getCellOutput( ItemStack compared )
{ {
for( Map.Entry<IItemDefinition, IItemDefinition> entry : this.cellMappings.entrySet() ) for( Map.Entry<IItemDefinition, IItemDefinition> entry : this.cellMappings.entrySet() )
{ {
if( entry.getKey().isSameAs( compared ) ) if( entry.getKey().isSameAs( compared ) )
{ {
return entry.getValue().maybeStack( 1 ).get(); return entry.getValue().maybeStack( 1 );
} }
} }
return null; return Optional.absent();
} }
private ItemStack getNonCellOutput( ItemStack compared ) @Nonnull
private Optional<ItemStack> getNonCellOutput( ItemStack compared )
{ {
for( Map.Entry<IItemDefinition, IItemDefinition> entry : this.nonCellMappings.entrySet() ) for( Map.Entry<IItemDefinition, IItemDefinition> entry : this.nonCellMappings.entrySet() )
{ {
if( entry.getKey().isSameAs( compared ) ) if( entry.getKey().isSameAs( compared ) )
{ {
return entry.getValue().maybeStack( 1 ).get(); return entry.getValue().maybeStack( 1 );
} }
} }
return null; return Optional.absent();
} }
@Nullable
@Override @Override
public ItemStack getCraftingResult( InventoryCrafting inv ) public ItemStack getCraftingResult( InventoryCrafting inv )
{ {
return this.getOutput( inv, true ); return this.getOutput( inv );
} }
@Override @Override
@@ -150,6 +162,7 @@ public class DisassembleRecipe implements IRecipe
return 1; return 1;
} }
@Nullable
@Override @Override
public ItemStack getRecipeOutput() // no default output.. public ItemStack getRecipeOutput() // no default output..
{ {
@@ -1,3 +1,4 @@
//Blocs
tile.appliedenergistics2.BlockCableBus.name=Câble et/ou bus AE2 tile.appliedenergistics2.BlockCableBus.name=Câble et/ou bus AE2
tile.appliedenergistics2.BlockCellWorkbench.name=Etabli de cellules tile.appliedenergistics2.BlockCellWorkbench.name=Etabli de cellules
tile.appliedenergistics2.BlockCharger.name=Chargeur tile.appliedenergistics2.BlockCharger.name=Chargeur
@@ -60,12 +61,16 @@ tile.appliedenergistics2.SkyStoneBrickStairBlock.name=Escaliers de briques de pi
tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Escaliers de petites briques de pierre de ciel tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Escaliers de petites briques de pierre de ciel
tile.appliedenergistics2.SkyStoneStairBlock.name=Escaliers de pierre de ciel tile.appliedenergistics2.SkyStoneStairBlock.name=Escaliers de pierre de ciel
// Chat Messages
chat.appliedenergistics2.ChestCannotReadStorageCell=Le coffre ME Chest ne peut pas lire la cellule de stockage. chat.appliedenergistics2.ChestCannotReadStorageCell=Le coffre ME Chest ne peut pas lire la cellule de stockage.
chat.appliedenergistics2.SettingCleared=Paramètres effacés. chat.appliedenergistics2.SettingCleared=Paramètres effacés.
chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée. chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée.
chat.appliedenergistics2.InvalidMachine=Machine invalide. chat.appliedenergistics2.InvalidMachine=Machine invalide.
chat.appliedenergistics2.LoadedSettings=Paramètres chargés avec succès. chat.appliedenergistics2.LoadedSettings=Paramètres chargés avec succès.
chat.appliedenergistics2.DeviceNotPowered=Le dispositif manque de puissance. chat.appliedenergistics2.DeviceNotPowered=Le dispositif manque de puissance.
chat.appliedenergistics2.DeviceNotWirelessTerminal=Le dispositif n'est pas un terminal sans fil.
chat.appliedenergistics2.DeviceNotLinked=Le dispositif n'est pas lié.
chat.appliedenergistics2.StationCanNotBeLocated=la station ne peut pas être localisée.
chat.appliedenergistics2.MachineNotPowered=La machine n'est pas alimentée. chat.appliedenergistics2.MachineNotPowered=La machine n'est pas alimentée.
chat.appliedenergistics2.CommunicationError=Erreur de communication avec le réseau. chat.appliedenergistics2.CommunicationError=Erreur de communication avec le réseau.
chat.appliedenergistics2.SavedSettings=Paramètres sauvés avec succès. chat.appliedenergistics2.SavedSettings=Paramètres sauvés avec succès.
@@ -73,9 +78,11 @@ chat.appliedenergistics2.AmmoDepleted=Munitions épuisées.
chat.appliedenergistics2.isNowLocked=Le moniteur est maintenant verrouillé. chat.appliedenergistics2.isNowLocked=Le moniteur est maintenant verrouillé.
chat.appliedenergistics2.isNowUnlocked=Le moniteur est maintenant déverrouillé. chat.appliedenergistics2.isNowUnlocked=Le moniteur est maintenant déverrouillé.
// Creative Tabs
itemGroup.appliedenergistics2=Applied Energistics 2 itemGroup.appliedenergistics2=Applied Energistics 2
itemGroup.appliedenergistics2.facades=Façades Applied Energistics 2 itemGroup.appliedenergistics2.facades=Façades Applied Energistics 2
// GUI
gui.appliedenergistics2.CraftingTerminal=Terminal de craft gui.appliedenergistics2.CraftingTerminal=Terminal de craft
gui.appliedenergistics2.METunnel=ME gui.appliedenergistics2.METunnel=ME
gui.appliedenergistics2.ItemTunnel=Objet gui.appliedenergistics2.ItemTunnel=Objet
@@ -205,7 +212,11 @@ gui.appliedenergistics2.Excluded=Exclus
gui.appliedenergistics2.Partitioned=Partitionné gui.appliedenergistics2.Partitioned=Partitionné
gui.appliedenergistics2.Precise=Précis gui.appliedenergistics2.Precise=Précis
gui.appliedenergistics2.Fuzzy=Brouillon gui.appliedenergistics2.Fuzzy=Brouillon
gui.appliedenergistics2.SmallFontCraft=Craft
gui.appliedenergistics2.LargeFontCraft=+
gui.appliedenergistics2.Nothing=Rien
// GUI Tooltips
gui.tooltips.appliedenergistics2.Stash=Stocke des objets gui.tooltips.appliedenergistics2.Stash=Stocke des objets
gui.tooltips.appliedenergistics2.StashDesc=Renvoie les objets de la grille de craft dans le réseau. gui.tooltips.appliedenergistics2.StashDesc=Renvoie les objets de la grille de craft dans le réseau.
gui.tooltips.appliedenergistics2.Substitutions=Remplacements du Ore-Dictionnary gui.tooltips.appliedenergistics2.Substitutions=Remplacements du Ore-Dictionnary
@@ -290,13 +301,17 @@ gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=Non: Seuls les élém
gui.tooltips.appliedenergistics2.BlockPlacement=Placement de bloc gui.tooltips.appliedenergistics2.BlockPlacement=Placement de bloc
gui.tooltips.appliedenergistics2.BlockPlacementYes=Les blocs seront placés comme un bloc. gui.tooltips.appliedenergistics2.BlockPlacementYes=Les blocs seront placés comme un bloc.
gui.tooltips.appliedenergistics2.BlockPlacementNo=Les blocs seront jettés comme un élément. gui.tooltips.appliedenergistics2.BlockPlacementNo=Les blocs seront jettés comme un élément.
gui.tooltips.appliedenergistics2.ItemsStored=Eléments stockés: %s
gui.tooltips.appliedenergistics2.ItemsRequestable=Eléments recherchable: %s
// Units
gui.appliedenergistics2.units.appliedenergstics=AE gui.appliedenergistics2.units.appliedenergstics=AE
gui.appliedenergistics2.units.ic2=Energy Units gui.appliedenergistics2.units.ic2=Energy Units
gui.appliedenergistics2.units.mekanism=Joules gui.appliedenergistics2.units.mekanism=Joules
gui.appliedenergistics2.units.rotarycraft=Watts gui.appliedenergistics2.units.rotarycraft=Watts
gui.appliedenergistics2.units.thermalexpansion=Redstone Flux gui.appliedenergistics2.units.thermalexpansion=Redstone Flux
// Colors
gui.appliedenergistics2.White=Blanc gui.appliedenergistics2.White=Blanc
gui.appliedenergistics2.Orange=Orange gui.appliedenergistics2.Orange=Orange
gui.appliedenergistics2.Magenta=Magenta gui.appliedenergistics2.Magenta=Magenta
@@ -315,6 +330,7 @@ gui.appliedenergistics2.Red=Rouge
gui.appliedenergistics2.Black=Noir gui.appliedenergistics2.Black=Noir
gui.appliedenergistics2.Fluix=Fluix gui.appliedenergistics2.Fluix=Fluix
// Waila
waila.appliedenergistics2.Crafting=Fabrication waila.appliedenergistics2.Crafting=Fabrication
waila.appliedenergistics2.DeviceOnline=Dispositif en ligne waila.appliedenergistics2.DeviceOnline=Dispositif en ligne
waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne
@@ -325,6 +341,7 @@ waila.appliedenergistics2.Showing=Affichant
waila.appliedenergistics2.Contains=Contient waila.appliedenergistics2.Contains=Contient
waila.appliedenergistics2.Channels=%1$d of %2$d Canaux waila.appliedenergistics2.Channels=%1$d of %2$d Canaux
// Items
item.appliedenergistics2.ItemBasicStorageCell.1k.name=Disque de stockage 1k item.appliedenergistics2.ItemBasicStorageCell.1k.name=Disque de stockage 1k
item.appliedenergistics2.ItemBasicStorageCell.4k.name=Disque de stockage 4k item.appliedenergistics2.ItemBasicStorageCell.4k.name=Disque de stockage 4k
item.appliedenergistics2.ItemBasicStorageCell.16k.name=Disque de stockage 16k item.appliedenergistics2.ItemBasicStorageCell.16k.name=Disque de stockage 16k
@@ -455,13 +472,15 @@ item.appliedenergistics2.ToolBiometricCard.name=Carte Biométrique
item.appliedenergistics2.ToolDebugCard.name=Dev.DebugCard item.appliedenergistics2.ToolDebugCard.name=Dev.DebugCard
item.appliedenergistics2.ToolReplicatorCard.name=Dev.ReplicatorCard item.appliedenergistics2.ToolReplicatorCard.name=Dev.ReplicatorCard
// Commands
commands.ae2.usage=Commandes fournies par Applied Energistics 2 - utilisez /ae2 list pour lister et /ae2 help _____ pour l'aide sur une commande. commands.ae2.usage=Commandes fournies par Applied Energistics 2 - utilisez /ae2 list pour lister et /ae2 help _____ pour l'aide sur une commande.
commands.ae2.permissions=Vous n'avez pas les permissions adéquates pour exécuter cette commande. commands.ae2.permissions=Vous n'avez pas les permissions adéquates pour exécuter cette commande.
commands.ae2.ChunkLogger=Active le chargement et le déchargement des chunks dans le journal du serveur. ( OP ) commands.ae2.ChunkLogger=Active le chargement et le déchargement des chunks dans le journal du serveur. ( OP )
commands.ae2.ChunkLoggerOn=Le chargement de chunks est en actif commands.ae2.ChunkLoggerOn=Le chargement des chunks est en actif
commands.ae2.ChunkLoggerOff=Le chargement de morceaux est inactif commands.ae2.ChunkLoggerOff=Le chargement des chunks est inactif
commands.ae2.Supporters=Affiche une liste des supporters de AE2 commands.ae2.Supporters=Affiche une liste des supporters de AE2
// Achievements
achievement.ae2.Compass=Chasseur de météorites achievement.ae2.Compass=Chasseur de météorites
achievement.ae2.Compass.desc=Crafter une boussole à météorite. achievement.ae2.Compass.desc=Crafter une boussole à météorite.
achievement.ae2.Presses=Technologie inconnue achievement.ae2.Presses=Technologie inconnue
@@ -513,6 +532,7 @@ achievement.ae2.StorageBus.desc=Crafter un bus de stockage.
achievement.ae2.QNB=Ouvrir un tunnel quantique achievement.ae2.QNB=Ouvrir un tunnel quantique
achievement.ae2.QNB.desc=Crafter un lien quantique. achievement.ae2.QNB.desc=Crafter un lien quantique.
// Stats
stat.ae2.ItemsInserted=Eléments ajoutés aux disques ME stat.ae2.ItemsInserted=Eléments ajoutés aux disques ME
stat.ae2.ItemsExtracted=Eléments extraits des disques ME stat.ae2.ItemsExtracted=Eléments extraits des disques ME
stat.ae2.TurnedCranks=Tours de manivelle stat.ae2.TurnedCranks=Tours de manivelle
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB