Conflicts:
	container/AEBaseContainer.java
	core/sync/AppEngPacketHandlerBase.java
This commit is contained in:
AlgorithmX2
2014-05-13 19:25:07 -05:00
57 changed files with 1270 additions and 152 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;
@@ -136,7 +136,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
is.writeToPacket( tmp );
compressFrame.flush();
if ( writtenBytes + tmp.readableBytes() > 30000 )
if ( writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
throw new BufferOverflowException();
else
{
+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;
}
}