Added Shit+Mouse wheel to pick up / drop items.

Added Partial ItemStack packets to report to the server what itemstack is the target of interation.
Fixed Repairing Items in CraftingTerminal.
This commit is contained in:
AlgorithmX2
2014-05-12 23:11:19 -05:00
parent 9ba6f195fd
commit ff12aa1673
7 changed files with 291 additions and 34 deletions
+6 -1
View File
@@ -13,6 +13,7 @@ import appeng.container.AEBaseContainer;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
public class PacketInventoryAction extends AppEngPacket
@@ -40,7 +41,7 @@ public class PacketInventoryAction extends AppEngPacket
if ( sender.openContainer instanceof AEBaseContainer )
{
AEBaseContainer aebc = (AEBaseContainer) sender.openContainer;
aebc.doAction( sender, action, slot, slotItem );
aebc.doAction( sender, action, slot );
}
}
@@ -58,6 +59,10 @@ public class PacketInventoryAction extends AppEngPacket
// api
public PacketInventoryAction(InventoryAction action, int slot, IAEItemStack slotItem) throws IOException {
if ( Platform.isClient() && slotItem != null )
throw new RuntimeException( "invalid packet, client cannot post inv actions with stacks." );
this.action = action;
this.slot = slot;
this.slotItem = slotItem;
+63
View File
@@ -0,0 +1,63 @@
package appeng.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import appeng.container.AEBaseContainer;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
public class PacketPartialItem extends AppEngPacket
{
short pageNum;
byte[] data;
// automatic.
public PacketPartialItem(ByteBuf stream) throws IOException {
pageNum = stream.readShort();
stream.readBytes( data = new byte[stream.readableBytes()] );
}
@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
if ( player.openContainer instanceof AEBaseContainer )
{
((AEBaseContainer) player.openContainer).postPartial( this );
}
}
// api
public PacketPartialItem(int page, int maxPages, byte[] buf) throws IOException {
ByteBuf data = Unpooled.buffer();
pageNum = (short) (page | (maxPages << 8));
this.data = buf;
data.writeInt( getPacketID() );
data.writeShort( pageNum );
data.writeBytes( buf );
configureWrite( data );
}
public int getPageCount()
{
return pageNum >> 8;
}
public int getSize()
{
return data.length;
}
public int write(byte[] buffer, int cursor)
{
System.arraycopy( data, 0, buffer, cursor, data.length );
return cursor + data.length;
}
}