Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 23aa8fd72d | |||
| 106003ebf9 | |||
| 8271597394 | |||
| 9210069d9b | |||
| f364359905 | |||
| fb618b939f | |||
| 43a47f8971 | |||
| e85acf2bee | |||
| bbde2443e1 | |||
| ad2f63ba0d | |||
| ee977720ca | |||
| ca953f4596 |
@@ -22,7 +22,6 @@ package appeng.core;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
@@ -562,10 +561,16 @@ public final class Registration
|
||||
registration.registerAchievements();
|
||||
|
||||
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 ) )
|
||||
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 )
|
||||
|
||||
@@ -3,8 +3,6 @@ package appeng.core.api.definitions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
@@ -91,13 +89,9 @@ public class DefinitionConstructor
|
||||
|
||||
for( AEColor color : AEColor.values() )
|
||||
{
|
||||
ItemStackSrc multiPartSource = target.createPart( type, color );
|
||||
final Optional<ItemStackSrc> maybeSource = Optional.fromNullable( multiPartSource );
|
||||
final ItemStackSrc multiPartSource = target.createPart( type, color );
|
||||
|
||||
if( maybeSource.isPresent() )
|
||||
{
|
||||
definition.add( color, multiPartSource );
|
||||
}
|
||||
definition.add( color, multiPartSource );
|
||||
}
|
||||
|
||||
return definition;
|
||||
|
||||
@@ -79,9 +79,7 @@ public enum AEFeature
|
||||
|
||||
AEFeature( String cat )
|
||||
{
|
||||
this.category = cat;
|
||||
this.isVisible = !this.name().equals( "Core" );
|
||||
this.defaultValue = true;
|
||||
this(cat, true);
|
||||
}
|
||||
|
||||
AEFeature( String cat, boolean defaultValue )
|
||||
|
||||
@@ -31,16 +31,17 @@ import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class PacketConfigButton extends AppEngPacket
|
||||
public final class PacketConfigButton extends AppEngPacket
|
||||
{
|
||||
|
||||
public final Settings option;
|
||||
public final boolean rotationDirection;
|
||||
private final Settings option;
|
||||
private final boolean rotationDirection;
|
||||
|
||||
// automatic.
|
||||
@Reflected
|
||||
public PacketConfigButton( ByteBuf stream )
|
||||
{
|
||||
this.option = Settings.values()[stream.readInt()];
|
||||
@@ -66,12 +67,15 @@ public class PacketConfigButton extends AppEngPacket
|
||||
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
|
||||
{
|
||||
EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
if( baseContainer.getTarget() instanceof IConfigurableObject )
|
||||
if ( sender.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
|
||||
Enum newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
|
||||
cm.putSetting( this.option, newState );
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
if( baseContainer.getTarget() instanceof IConfigurableObject )
|
||||
{
|
||||
IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
|
||||
Enum<?> newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
|
||||
cm.putSetting( this.option, newState );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -28,6 +29,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
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.SideOnly;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -48,7 +52,6 @@ import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.NameResolver;
|
||||
@@ -58,27 +61,55 @@ import appeng.integration.IntegrationType;
|
||||
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;
|
||||
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 )
|
||||
{
|
||||
Preconditions.checkNotNull( partHelper );
|
||||
|
||||
this.registered = new HashMap<Integer, PartTypeWithVariant>();
|
||||
this.unregistered = new HashMap<Integer, PartTypeWithVariant>();
|
||||
|
||||
this.nameResolver = new NameResolver( this.getClass() );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
partHelper.setItemBusRenderer( this );
|
||||
this.setHasSubtypes( true );
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
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
|
||||
for( PartTypeIst p : this.dmgToPart.values() )
|
||||
for( PartTypeWithVariant p : this.registered.values() )
|
||||
{
|
||||
if( p.part == mat && p.variant == varID )
|
||||
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() )
|
||||
enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType );
|
||||
|
||||
int newPartNum = mat.baseDamage + varID;
|
||||
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
|
||||
final int partDamage = mat.baseDamage + varID;
|
||||
final ItemStackSrc output = new ItemStackSrc( this, partDamage );
|
||||
|
||||
if( enabled )
|
||||
{
|
||||
PartTypeIst pti = new PartTypeIst();
|
||||
pti.part = mat;
|
||||
pti.variant = varID;
|
||||
final PartTypeWithVariant pti = new PartTypeWithVariant( mat, varID );
|
||||
|
||||
if( this.dmgToPart.get( newPartNum ) == null )
|
||||
{
|
||||
this.dmgToPart.put( newPartNum, pti );
|
||||
return output;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( "Meta Overlap detected." );
|
||||
}
|
||||
}
|
||||
this.processMetaOverlap( enabled, partDamage, mat, pti );
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public ItemStackSrc createPart( PartType mat, Enum variant )
|
||||
private void processMetaOverlap( boolean enabled, int partDamage, PartType mat, PartTypeWithVariant pti )
|
||||
{
|
||||
try
|
||||
{
|
||||
// I think this still works?
|
||||
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..
|
||||
}
|
||||
assert partDamage >= 0;
|
||||
assert mat != null;
|
||||
assert pti != null;
|
||||
|
||||
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
|
||||
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;
|
||||
reference.put( partDamage, pti );
|
||||
}
|
||||
|
||||
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 )
|
||||
return pt.getKey();
|
||||
@@ -183,7 +167,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
@Override
|
||||
public IIcon getIconFromDamage( int dmg )
|
||||
{
|
||||
return this.dmgToPart.get( dmg ).ico;
|
||||
return this.registered.get( dmg ).ico;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,36 +182,16 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
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
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
{
|
||||
PartType pt = this.getTypeByStack( is );
|
||||
if( pt == null )
|
||||
return "Unnamed";
|
||||
final PartType pt = this.getTypeByStack( is );
|
||||
|
||||
if( pt.isCable() )
|
||||
{
|
||||
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 )
|
||||
@@ -239,60 +203,96 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
@Override
|
||||
public void getSubItems( Item number, CreativeTabs tab, List cList )
|
||||
{
|
||||
List<Entry<Integer, PartTypeIst>> types = new ArrayList<Entry<Integer, PartTypeIst>>( this.dmgToPart.entrySet() );
|
||||
Collections.sort( types, new Comparator<Entry<Integer, PartTypeIst>>()
|
||||
List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
|
||||
Collections.sort( types, new Comparator<Entry<Integer, PartTypeWithVariant>>()
|
||||
{
|
||||
|
||||
@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() );
|
||||
}
|
||||
} );
|
||||
|
||||
for( Entry<Integer, PartTypeIst> part : types )
|
||||
for( Entry<Integer, PartTypeWithVariant> part : types )
|
||||
cList.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
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() ) );
|
||||
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
|
||||
public IPart createPartFromItemStack( ItemStack is )
|
||||
{
|
||||
final PartType type = this.getTypeByStack( is );
|
||||
final Class<? extends IPart> part = type.getPart();
|
||||
|
||||
try
|
||||
{
|
||||
PartType t = this.getTypeByStack( is );
|
||||
if( t != null )
|
||||
{
|
||||
if( t.constructor == null )
|
||||
t.constructor = t.getPart().getConstructor( ItemStack.class );
|
||||
if( type.constructor == null )
|
||||
type.constructor = part.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 )
|
||||
{
|
||||
if( this.dmgToPart.containsKey( itemDamage ) )
|
||||
return this.dmgToPart.get( itemDamage ).variant;
|
||||
if( this.registered.containsKey( itemDamage ) )
|
||||
return this.registered.get( itemDamage ).variant;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
|
||||
{
|
||||
@@ -307,22 +307,19 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
if( stack.getItem() == this )
|
||||
{
|
||||
PartType pt = this.getTypeByStack( stack );
|
||||
if ( pt != null )
|
||||
switch( pt )
|
||||
{
|
||||
switch( pt )
|
||||
{
|
||||
case ImportBus:
|
||||
importBus = true;
|
||||
if( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
case ExportBus:
|
||||
exportBus = true;
|
||||
if( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
case ImportBus:
|
||||
importBus = true;
|
||||
if( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
case ExportBus:
|
||||
exportBus = true;
|
||||
if( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,17 +330,21 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getStackFromTypeAndVariant( PartType mt, int variant )
|
||||
private static final class PartTypeWithVariant
|
||||
{
|
||||
return new ItemStack( this, 1, mt.baseDamage + variant );
|
||||
}
|
||||
|
||||
private static class PartTypeIst
|
||||
{
|
||||
private PartType part;
|
||||
private int variant;
|
||||
private final PartType part;
|
||||
private final int variant;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
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.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
@@ -39,109 +44,116 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
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> nonCellMappings;
|
||||
|
||||
public DisassembleRecipe()
|
||||
{
|
||||
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.nonCellMappings = new HashMap<IItemDefinition, IItemDefinition>( 5 );
|
||||
|
||||
this.cellMappings.put( this.items.cell1k(), this.mats.cell1kPart() );
|
||||
this.cellMappings.put( this.items.cell4k(), this.mats.cell4kPart() );
|
||||
this.cellMappings.put( this.items.cell16k(), this.mats.cell16kPart() );
|
||||
this.cellMappings.put( this.items.cell64k(), this.mats.cell64kPart() );
|
||||
this.cellMappings.put( items.cell1k(), mats.cell1kPart() );
|
||||
this.cellMappings.put( items.cell4k(), mats.cell4kPart() );
|
||||
this.cellMappings.put( items.cell16k(), mats.cell16kPart() );
|
||||
this.cellMappings.put( items.cell64k(), mats.cell64kPart() );
|
||||
|
||||
this.nonCellMappings.put( this.items.encodedPattern(), this.mats.blankPattern() );
|
||||
this.nonCellMappings.put( this.blocks.craftingStorage1k(), this.mats.cell1kPart() );
|
||||
this.nonCellMappings.put( this.blocks.craftingStorage4k(), this.mats.cell4kPart() );
|
||||
this.nonCellMappings.put( this.blocks.craftingStorage16k(), this.mats.cell16kPart() );
|
||||
this.nonCellMappings.put( this.blocks.craftingStorage64k(), this.mats.cell64kPart() );
|
||||
this.nonCellMappings.put( items.encodedPattern(), mats.blankPattern() );
|
||||
this.nonCellMappings.put( blocks.craftingStorage1k(), mats.cell1kPart() );
|
||||
this.nonCellMappings.put( blocks.craftingStorage4k(), mats.cell4kPart() );
|
||||
this.nonCellMappings.put( blocks.craftingStorage16k(), mats.cell16kPart() );
|
||||
this.nonCellMappings.put( blocks.craftingStorage64k(), mats.cell64kPart() );
|
||||
}
|
||||
|
||||
@Override
|
||||
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 );
|
||||
if( is != null )
|
||||
ItemStack stackInSlot = inventory.getStackInSlot( slotIndex );
|
||||
if( stackInSlot != null )
|
||||
{
|
||||
if( hasCell != null )
|
||||
return null;
|
||||
// needs a single input in the recipe
|
||||
itemCount++;
|
||||
if ( itemCount > 1 )
|
||||
return MISMATCHED_STACK;
|
||||
|
||||
hasCell = this.getCellOutput( is );
|
||||
|
||||
// make sure the storage cell is empty...
|
||||
if( hasCell != null )
|
||||
// handle storage cells
|
||||
for( ItemStack storageCellStack : this.getCellOutput( stackInSlot ).asSet() )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
if( !list.isEmpty() )
|
||||
return null;
|
||||
}
|
||||
|
||||
output = storageCellStack;
|
||||
}
|
||||
|
||||
hasCell = this.getNonCellOutput( is );
|
||||
|
||||
if( hasCell == null )
|
||||
return null;
|
||||
// handle crafting storage blocks
|
||||
for( ItemStack craftingStorageStack : this.getNonCellOutput( stackInSlot ).asSet() )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
if( entry.getKey().isSameAs( compared ) )
|
||||
{
|
||||
return entry.getValue().maybeStack( 1 ).get();
|
||||
return entry.getValue().maybeStack( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return Optional.absent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getCraftingResult( InventoryCrafting inv )
|
||||
{
|
||||
return this.getOutput( inv, true );
|
||||
return this.getOutput( inv );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,6 +162,7 @@ public class DisassembleRecipe implements IRecipe
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() // no default output..
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//Blocs
|
||||
tile.appliedenergistics2.BlockCableBus.name=Câble et/ou bus AE2
|
||||
tile.appliedenergistics2.BlockCellWorkbench.name=Etabli de cellules
|
||||
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.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.SettingCleared=Paramètres effacés.
|
||||
chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée.
|
||||
chat.appliedenergistics2.InvalidMachine=Machine invalide.
|
||||
chat.appliedenergistics2.LoadedSettings=Paramètres chargés avec succès.
|
||||
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.CommunicationError=Erreur de communication avec le réseau.
|
||||
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.isNowUnlocked=Le moniteur est maintenant déverrouillé.
|
||||
|
||||
// Creative Tabs
|
||||
itemGroup.appliedenergistics2=Applied Energistics 2
|
||||
itemGroup.appliedenergistics2.facades=Façades Applied Energistics 2
|
||||
|
||||
// GUI
|
||||
gui.appliedenergistics2.CraftingTerminal=Terminal de craft
|
||||
gui.appliedenergistics2.METunnel=ME
|
||||
gui.appliedenergistics2.ItemTunnel=Objet
|
||||
@@ -205,7 +212,11 @@ gui.appliedenergistics2.Excluded=Exclus
|
||||
gui.appliedenergistics2.Partitioned=Partitionné
|
||||
gui.appliedenergistics2.Precise=Précis
|
||||
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.StashDesc=Renvoie les objets de la grille de craft dans le réseau.
|
||||
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.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.ItemsStored=Eléments stockés: %s
|
||||
gui.tooltips.appliedenergistics2.ItemsRequestable=Eléments recherchable: %s
|
||||
|
||||
// Units
|
||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||
gui.appliedenergistics2.units.ic2=Energy Units
|
||||
gui.appliedenergistics2.units.mekanism=Joules
|
||||
gui.appliedenergistics2.units.rotarycraft=Watts
|
||||
gui.appliedenergistics2.units.thermalexpansion=Redstone Flux
|
||||
|
||||
// Colors
|
||||
gui.appliedenergistics2.White=Blanc
|
||||
gui.appliedenergistics2.Orange=Orange
|
||||
gui.appliedenergistics2.Magenta=Magenta
|
||||
@@ -315,6 +330,7 @@ gui.appliedenergistics2.Red=Rouge
|
||||
gui.appliedenergistics2.Black=Noir
|
||||
gui.appliedenergistics2.Fluix=Fluix
|
||||
|
||||
// Waila
|
||||
waila.appliedenergistics2.Crafting=Fabrication
|
||||
waila.appliedenergistics2.DeviceOnline=Dispositif en ligne
|
||||
waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne
|
||||
@@ -325,6 +341,7 @@ waila.appliedenergistics2.Showing=Affichant
|
||||
waila.appliedenergistics2.Contains=Contient
|
||||
waila.appliedenergistics2.Channels=%1$d of %2$d Canaux
|
||||
|
||||
// Items
|
||||
item.appliedenergistics2.ItemBasicStorageCell.1k.name=Disque de stockage 1k
|
||||
item.appliedenergistics2.ItemBasicStorageCell.4k.name=Disque de stockage 4k
|
||||
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.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.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.ChunkLoggerOn=Le chargement de chunks est en actif
|
||||
commands.ae2.ChunkLoggerOff=Le chargement de morceaux est inactif
|
||||
commands.ae2.ChunkLoggerOn=Le chargement des chunks est en actif
|
||||
commands.ae2.ChunkLoggerOff=Le chargement des chunks est inactif
|
||||
commands.ae2.Supporters=Affiche une liste des supporters de AE2
|
||||
|
||||
// Achievements
|
||||
achievement.ae2.Compass=Chasseur de météorites
|
||||
achievement.ae2.Compass.desc=Crafter une boussole à météorite.
|
||||
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.desc=Crafter un lien quantique.
|
||||
|
||||
// Stats
|
||||
stat.ae2.ItemsInserted=Eléments ajoutés aux disques ME
|
||||
stat.ae2.ItemsExtracted=Eléments extraits des disques ME
|
||||
stat.ae2.TurnedCranks=Tours de manivelle
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Blocks
|
||||
tile.appliedenergistics2.BlockCableBus.name=Cavo ME
|
||||
tile.appliedenergistics2.BlockCellWorkbench.name=Banco da lavoro per celle
|
||||
tile.appliedenergistics2.BlockCharger.name=Caricatore
|
||||
@@ -60,6 +61,7 @@ tile.appliedenergistics2.SkyStoneBrickStairBlock.name=Scalini di roccia del ciel
|
||||
tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Scalini di mattoni di roccia del cielo
|
||||
tile.appliedenergistics2.SkyStoneStairBlock.name=Scalini di roccia del cielo
|
||||
|
||||
// Chat Messages
|
||||
chat.appliedenergistics2.ChestCannotReadStorageCell=Baule ME non riesce a leggere cella di immagazzinaggio.
|
||||
chat.appliedenergistics2.SettingCleared=Impostazioni cancellate.
|
||||
chat.appliedenergistics2.OutOfRange=Wireless fuori portata.
|
||||
@@ -76,9 +78,11 @@ chat.appliedenergistics2.AmmoDepleted=Arma scarica.
|
||||
chat.appliedenergistics2.isNowLocked=Il monitor è ora bloccato.
|
||||
chat.appliedenergistics2.isNowUnlocked=Il monitor è ora sbloccato.
|
||||
|
||||
// Creative Tabs
|
||||
itemGroup.appliedenergistics2=Applied Energistics 2
|
||||
itemGroup.appliedenergistics2.facades=Applied Energistics 2 - Facciate
|
||||
|
||||
// GUI
|
||||
gui.appliedenergistics2.CraftingTerminal=Terminale con banco da lavoro
|
||||
gui.appliedenergistics2.METunnel=ME
|
||||
gui.appliedenergistics2.ItemTunnel=Oggetto
|
||||
@@ -132,7 +136,7 @@ gui.appliedenergistics2.GrindStone=Macina di quarzo
|
||||
gui.appliedenergistics2.ImportBus=Bus importatore ME
|
||||
gui.appliedenergistics2.Interface=Interfacia ME
|
||||
gui.appliedenergistics2.LevelEmitter=Emettitore di pietrarossa ME
|
||||
gui.appliedenergistics2.Of=Di
|
||||
gui.appliedenergistics2.Of=di
|
||||
gui.appliedenergistics2.Patterns=Modelli
|
||||
gui.appliedenergistics2.SpatialIOPort=Porta IO per spazio
|
||||
gui.appliedenergistics2.StoredEnergy=Energia conservata
|
||||
@@ -208,7 +212,11 @@ gui.appliedenergistics2.Excluded=Escluso
|
||||
gui.appliedenergistics2.Partitioned=Suddiviso
|
||||
gui.appliedenergistics2.Precise=Preciso
|
||||
gui.appliedenergistics2.Fuzzy=Vago
|
||||
gui.appliedenergistics2.SmallFontCraft=Fabbrica
|
||||
gui.appliedenergistics2.LargeFontCraft=+
|
||||
gui.appliedenergistics2.Nothing=Niente
|
||||
|
||||
// GUI Tooltips
|
||||
gui.tooltips.appliedenergistics2.Stash=Oggetti immagazinati
|
||||
gui.tooltips.appliedenergistics2.StashDesc=Manda gli oggetti sulla griglia di fabbricazione nel deposito del sistema.
|
||||
gui.tooltips.appliedenergistics2.Substitutions=Sostituzione Ore-Dict
|
||||
@@ -293,13 +301,17 @@ gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=No: Solo oggetti estr
|
||||
gui.tooltips.appliedenergistics2.BlockPlacement=Piazzamento di blocco
|
||||
gui.tooltips.appliedenergistics2.BlockPlacementYes=I blocchi saranno piazzati come blocco.
|
||||
gui.tooltips.appliedenergistics2.BlockPlacementNo=I blocchi saranno fatti cadere come oggetti.
|
||||
gui.tooltips.appliedenergistics2.ItemsStored=Oggetti contenuti: %s
|
||||
gui.tooltips.appliedenergistics2.ItemsRequestable=Oggetti richiedibili: %s
|
||||
|
||||
// Units
|
||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||
gui.appliedenergistics2.units.ic2=Energy Units
|
||||
gui.appliedenergistics2.units.mekanism=Joules
|
||||
gui.appliedenergistics2.units.rotarycraft=Watts
|
||||
gui.appliedenergistics2.units.thermalexpansion=Redstone Flux
|
||||
|
||||
// Colors
|
||||
gui.appliedenergistics2.White=Bianco
|
||||
gui.appliedenergistics2.Orange=Arancione
|
||||
gui.appliedenergistics2.Magenta=Magenta
|
||||
@@ -318,6 +330,7 @@ gui.appliedenergistics2.Red=Rosso
|
||||
gui.appliedenergistics2.Black=Nero
|
||||
gui.appliedenergistics2.Fluix=Fluix
|
||||
|
||||
// Waila
|
||||
waila.appliedenergistics2.Crafting=Fabbricazione
|
||||
waila.appliedenergistics2.DeviceOnline=Dispositivo online
|
||||
waila.appliedenergistics2.DeviceOffline=Dispositivo offline
|
||||
@@ -326,8 +339,9 @@ waila.appliedenergistics2.Locked=Bloccato
|
||||
waila.appliedenergistics2.Unlocked=Sbloccato
|
||||
waila.appliedenergistics2.Showing=Mostra
|
||||
waila.appliedenergistics2.Contains=Contiene
|
||||
waila.appliedenergistics2.Channels=%1$d of %2$d Canali
|
||||
waila.appliedenergistics2.Channels=Canali %1$d di %2$d
|
||||
|
||||
// Items
|
||||
item.appliedenergistics2.ItemBasicStorageCell.1k.name=Cella di immagazzinaggio da 1k ME
|
||||
item.appliedenergistics2.ItemBasicStorageCell.4k.name=Cella di immagazzinaggio da 4k ME
|
||||
item.appliedenergistics2.ItemBasicStorageCell.16k.name=Cella di immagazzinaggio da 16k ME
|
||||
@@ -458,6 +472,7 @@ item.appliedenergistics2.ToolBiometricCard.name=Scheda biometrica
|
||||
item.appliedenergistics2.ToolDebugCard.name=Dev.DebugCard
|
||||
item.appliedenergistics2.ToolReplicatorCard.name=Dev.ReplicatorCard
|
||||
|
||||
// Commands
|
||||
commands.ae2.usage=Comandi forniti da Applied Energistics 2 - usa /ae2 list per una lista, e /ae2 help _____ per aiuto con i comandi.
|
||||
commands.ae2.permissions=Non hai il permesso di usare questo comando.
|
||||
commands.ae2.ChunkLogger=Altera tra Chunk Loading e Unloading nel server log. ( OP )
|
||||
@@ -465,6 +480,7 @@ commands.ae2.ChunkLoggerOn=Chunk Logging è ora attivato
|
||||
commands.ae2.ChunkLoggerOff=Chunk Logging è ora disattivato
|
||||
commands.ae2.Supporters=Mostra una lista dei Sostenitori di AE2
|
||||
|
||||
// Achievements
|
||||
achievement.ae2.Compass=Cacciatore di meteoriti
|
||||
achievement.ae2.Compass.desc=Fabbrica una Bussola per meteoriti
|
||||
achievement.ae2.Presses=Tecnologia sconosciuta
|
||||
@@ -516,6 +532,7 @@ achievement.ae2.StorageBus.desc=Fabbrica un Bus di immagazzinaggio
|
||||
achievement.ae2.QNB=Tunnel quantistico
|
||||
achievement.ae2.QNB.desc=Crea un Collegamento quantistico
|
||||
|
||||
// Stats
|
||||
stat.ae2.ItemsInserted=Oggetti aggiunti al Deposito ME
|
||||
stat.ae2.ItemsExtracted=Oggetti estratti dal Deposito ME
|
||||
stat.ae2.TurnedCranks=Manovelle girate
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user