Fix handling of ItemStacks using getShareTag or Capabilites (#3171)

Temporary fix, ideally we would have a way to reference the original ItemStack so we don't need to send the full NBT data to the client.
This commit is contained in:
fscan
2017-10-26 17:59:55 +02:00
committed by GitHub
parent 74b9610b45
commit 3749742231
8 changed files with 116 additions and 181 deletions
+2 -20
View File
@@ -19,8 +19,6 @@
package appeng.util.item;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import appeng.api.storage.data.IAEStack;
@@ -144,23 +142,7 @@ public abstract class AEStack<StackType extends IAEStack<StackType>> implements
this.countRequestable -= i;
}
@Override
public void writeToPacket( final ByteBuf i ) throws IOException
{
final byte mask = (byte) ( this.getType( 0 ) | ( this.getType( this.stackSize ) << 2 ) | ( this
.getType( this.countRequestable ) << 4 ) | ( (byte) ( this.isCraftable ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 );
i.writeByte( mask );
this.writeToStream( i );
this.putPacketValue( i, this.stackSize );
this.putPacketValue( i, this.countRequestable );
}
protected abstract void writeToStream( final ByteBuf data ) throws IOException;
private byte getType( final long num )
protected byte getType( final long num )
{
if( num <= 255 )
{
@@ -182,7 +164,7 @@ public abstract class AEStack<StackType extends IAEStack<StackType>> implements
abstract boolean hasTagCompound();
private void putPacketValue( final ByteBuf tag, final long num )
protected void putPacketValue( final ByteBuf tag, final long num )
{
if( num <= 255 )
{