This commit is contained in:
AlgorithmX2 2014-07-30 18:02:13 -05:00
commit 82f5db7ea2
9 changed files with 179 additions and 7 deletions

View file

@ -17,6 +17,12 @@ public class BlockCraftingStorage extends BlockCraftingUnit
setTileEntiy( TileCraftingStorageTile.class );
}
@Override
public Class getItemBlockClass()
{
return ItemCraftingStorage.class;
}
@Override
public String getUnlocalizedName(ItemStack is)
{

View file

@ -0,0 +1,29 @@
package appeng.block.crafting;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.block.AEBaseItemBlock;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class ItemCraftingStorage extends AEBaseItemBlock
{
public ItemCraftingStorage(Block id) {
super( id );
}
@Override
public boolean hasContainerItem()
{
return AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting );
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
return AEApi.instance().blocks().blockCraftingUnit.stack( 1 );
}
}

View file

@ -305,7 +305,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
{
if ( e == setting )
{
String Category = e.getClass().getSimpleName();
String Category = "Client";
Property p = this.get( Category, e.name(), settings.getSetting( e ).name(), getListComment( newValue ) );
p.set( newValue.name() );
}

View file

@ -139,6 +139,7 @@ import appeng.me.storage.AEExternalHandler;
import appeng.parts.PartPlacement;
import appeng.recipes.AEItemResolver;
import appeng.recipes.RecipeHandler;
import appeng.recipes.game.DisassembleRecipe;
import appeng.recipes.game.FacadeRecipe;
import appeng.recipes.game.ShapedRecipe;
import appeng.recipes.game.ShapelessRecipe;
@ -562,6 +563,9 @@ public class Registration
recipeHandler.injectRecipes();
if ( AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting ) )
CraftingManager.getInstance().getRecipeList().add( new DisassembleRecipe() );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.enableFacadeCrafting ) )
CraftingManager.getInstance().getRecipeList().add( new FacadeRecipe() );
}

View file

@ -52,7 +52,9 @@ public enum AEFeature
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false),
AlphaPass("Rendering"), PaintBalls("Tools"), PacketLogging("Misc", false), CraftingLog("Misc", false), InterfaceTerminal("Crafting"), LightDetector("Misc");
AlphaPass("Rendering"), PaintBalls("Tools"), PacketLogging("Misc", false), CraftingLog("Misc", false), InterfaceTerminal("Crafting"), LightDetector("Misc"),
enableDisassemblyCrafting("Crafting");
String Category;
boolean visible = true;

View file

@ -741,8 +741,8 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
TileEntity tile = iHost.getTileEntity();
World w = tile.getWorldObj();
boolean allAreBusy=true;
boolean allAreBusy = true;
for (ForgeDirection s : possibleDirections)
{
TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
@ -757,7 +757,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
}
}
}
busy = allAreBusy;
}
@ -814,7 +814,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
if ( ad.simulateRemove( 1, null, null ) != null )
continue;
}
if ( acceptsItems( ad, table ) )
{
for (int x = 0; x < table.getSizeInventory(); x++)
@ -876,7 +876,13 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if ( ad != null )
{
whatToSend = ad.addItems( whatToSend );
ItemStack Result = ad.addItems( whatToSend );
if ( Result == null )
whatToSend = null;
else
whatToSend.stackSize -= whatToSend.stackSize - Result.stackSize;
if ( whatToSend == null )
break;
}

View file

@ -20,6 +20,7 @@ import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
@ -226,4 +227,17 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
{
return dissassembleDrive( stack, world, player );
}
@Override
public boolean hasContainerItem()
{
return AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting );
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
return AEApi.instance().materials().materialEmptyStorageCell.stack( 1 );
}
}

View file

@ -0,0 +1,106 @@
package appeng.recipes.game;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.Items;
import appeng.api.definitions.Materials;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
public class DisassembleRecipe implements IRecipe
{
private Materials mats = AEApi.instance().materials();
private Items items = AEApi.instance().items();
private Blocks blks = AEApi.instance().blocks();
private ItemStack getOutput(InventoryCrafting inv, boolean createFacade)
{
ItemStack hasCell = null;
for (int x = 0; x < inv.getSizeInventory(); x++)
{
ItemStack is = inv.getStackInSlot( x );
if ( is != null )
{
if ( hasCell != null )
return null;
if ( items.itemCell1k.sameAsStack( is ) )
hasCell = mats.materialCell1kPart.stack( 1 );
if ( items.itemCell4k.sameAsStack( is ) )
hasCell = mats.materialCell4kPart.stack( 1 );
if ( items.itemCell16k.sameAsStack( is ) )
hasCell = mats.materialCell16kPart.stack( 1 );
if ( items.itemCell64k.sameAsStack( is ) )
hasCell = mats.materialCell64kPart.stack( 1 );
// make sure the storage cell is empty...
if ( hasCell != null )
{
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
if ( cellInv != null )
{
IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
if ( !list.isEmpty() )
return null;
}
}
if ( items.itemEncodedPattern.sameAsStack( is ) )
hasCell = mats.materialBlankPattern.stack( 1 );
if ( blks.blockCraftingStorage1k.sameAsStack( is ) )
hasCell = mats.materialCell1kPart.stack( 1 );
if ( blks.blockCraftingStorage4k.sameAsStack( is ) )
hasCell = mats.materialCell4kPart.stack( 1 );
if ( blks.blockCraftingStorage16k.sameAsStack( is ) )
hasCell = mats.materialCell16kPart.stack( 1 );
if ( blks.blockCraftingStorage64k.sameAsStack( is ) )
hasCell = mats.materialCell64kPart.stack( 1 );
if ( hasCell == null )
return null;
}
}
return hasCell;
}
@Override
public boolean matches(InventoryCrafting inv, World w)
{
return getOutput( inv, false ) != null;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv)
{
return getOutput( inv, true );
}
@Override
public int getRecipeSize()
{
return 1;
}
@Override
public ItemStack getRecipeOutput() // no default output..
{
return null;
}
}

View file

@ -133,6 +133,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
forcePlan = false;
myPlan = null;
myPattern = null;
pushDirection = ForgeDirection.UNKNOWN;
}
updateSleepyness();
@ -206,6 +207,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
NBTTagCompound pdata = new NBTTagCompound();
pattern.writeToNBT( pdata );
data.setTag( "myPlan", pdata );
data.setInteger( "pushDirection", pushDirection.ordinal() );
}
}
@ -230,6 +232,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
{
forcePlan = true;
myPlan = ph;
pushDirection = ForgeDirection.getOrientation( data.getInteger( "pushDirection" ) );
}
}
}
@ -439,7 +442,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
{
forcePlan = false;
myPlan = null;
pushDirection = ForgeDirection.UNKNOWN;
}
ejectHeldItems();
try