Added all the crafting cpu "blocks" - needs textures and renders.

Updated API
This commit is contained in:
AlgorithmX2
2014-05-10 00:00:02 -05:00
parent f031972fcd
commit 08d6942643
22 changed files with 306 additions and 70 deletions
+51
View File
@@ -1,12 +1,58 @@
package appeng.tile.crafting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.AEApi;
import appeng.me.cluster.IAECluster;
import appeng.me.cluster.IAEMultiBlock;
import appeng.tile.AEBaseTile;
import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType;
public class TileCraftingTile extends AEBaseTile implements IAEMultiBlock
{
private long storageBytes = 0;
public TileCraftingTile() {
addNewHandler( new AETileEventHandler( TileEventType.NETWORK, TileEventType.WORLD_NBT ) {
public void writeToNBT(NBTTagCompound data)
{
if ( storageBytes > 0 )
data.setLong( "bytes", storageBytes );
}
public void readFromNBT(NBTTagCompound data)
{
storageBytes = data.getLong( "bytes" );
}
public boolean readFromStream(io.netty.buffer.ByteBuf data) throws java.io.IOException
{
storageBytes = data.readLong();
return false;
}
public void writeToStream(io.netty.buffer.ByteBuf data) throws java.io.IOException
{
data.writeLong( storageBytes );
}
} );
}
@Override
public void onPlacement(ItemStack stack, EntityPlayer player, int side)
{
if ( AEApi.instance().blocks().blockCraftingStorage.sameAsStack( stack ) && stack.hasTagCompound() )
{
NBTTagCompound data = stack.getTagCompound();
storageBytes = data.getLong( "bytes" );
}
}
@Override
public void disconnect()
{
@@ -28,4 +74,9 @@ public class TileCraftingTile extends AEBaseTile implements IAEMultiBlock
return false;
}
public long getStorageBytes()
{
return storageBytes;
}
}