Move from ByteBuf to PacketBuffer
This commit is contained in:
@@ -29,7 +29,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -199,7 +199,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
return data;
|
||||
}
|
||||
|
||||
private boolean readUpdateData( ByteBuf stream )
|
||||
private boolean readUpdateData( PacketBuffer stream )
|
||||
{
|
||||
boolean output = false;
|
||||
|
||||
@@ -248,7 +248,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
@Override
|
||||
public void handleUpdateTag( CompoundNBT tag )
|
||||
{
|
||||
final ByteBuf stream = Unpooled.copiedBuffer( tag.getByteArray( "X" ) );
|
||||
final PacketBuffer stream = new PacketBuffer( Unpooled.copiedBuffer( tag.getByteArray( "X" ) ) );
|
||||
|
||||
if( this.readUpdateData( stream ) )
|
||||
{
|
||||
@@ -256,7 +256,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
if( this.canBeRotated() )
|
||||
{
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.tile.crafting;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -51,7 +49,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
|
||||
private AEColor paintedColor = AEColor.TRANSPARENT;
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final AEColor oldPaintedColor = this.paintedColor;
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.tile.crafting;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -197,7 +195,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final boolean oldPower = this.isPowered;
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
@@ -91,7 +89,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
this.rotation = data.readInt();
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
@@ -80,7 +78,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
try
|
||||
|
||||
@@ -28,8 +28,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
@@ -149,7 +147,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int slot = data.readByte();
|
||||
|
||||
@@ -27,8 +27,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -185,7 +183,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
boolean oldOmniDirectional = this.omniDirectional;
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -36,7 +35,7 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.helpers.Splotch;
|
||||
@@ -59,19 +58,19 @@ public class TilePaint extends AEBaseTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT( final CompoundNBT data )
|
||||
public CompoundNBT write( final CompoundNBT data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
final ByteBuf myDat = Unpooled.buffer();
|
||||
super.write( data );
|
||||
final PacketBuffer myDat = new PacketBuffer( Unpooled.buffer() );
|
||||
this.writeBuffer( myDat );
|
||||
if( myDat.hasArray() )
|
||||
{
|
||||
data.setByteArray( "dots", myDat.array() );
|
||||
data.putByteArray( "dots", myDat.array() );
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private void writeBuffer( final ByteBuf out )
|
||||
private void writeBuffer( final PacketBuffer out )
|
||||
{
|
||||
if( this.dots == null )
|
||||
{
|
||||
@@ -88,16 +87,16 @@ public class TilePaint extends AEBaseTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
public void read( final CompoundNBT data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
if( data.contains("dots") )
|
||||
super.read( data );
|
||||
if( data.contains( "dots" ) )
|
||||
{
|
||||
this.readBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) );
|
||||
this.readBuffer( new PacketBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void readBuffer( final ByteBuf in )
|
||||
private void readBuffer( final PacketBuffer in )
|
||||
{
|
||||
final byte howMany = in.readByte();
|
||||
|
||||
@@ -135,7 +134,7 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
if( this.world != null )
|
||||
{
|
||||
this.world.getLightFor( EnumSkyBlock.BLOCK, this.pos );
|
||||
this.world.getLightFor( LightType.BLOCK, this.pos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +146,7 @@ public class TilePaint extends AEBaseTile
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
super.readFromStream( data );
|
||||
this.readBuffer( data );
|
||||
@@ -176,7 +175,7 @@ public class TilePaint extends AEBaseTile
|
||||
{
|
||||
final BlockPos p = this.pos.offset( side );
|
||||
final BlockState blk = this.world.getBlockState( p );
|
||||
return blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() );
|
||||
return blk.isSolidSide( world, p, side.getOpposite() );
|
||||
}
|
||||
|
||||
private void removeSide( final Direction side )
|
||||
@@ -215,7 +214,7 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
if( this.dots == null )
|
||||
{
|
||||
this.world.removeBlock(this.pos, false);
|
||||
this.world.removeBlock( this.pos, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +240,7 @@ public class TilePaint extends AEBaseTile
|
||||
final BlockPos p = this.pos.offset( side );
|
||||
|
||||
final BlockState blk = this.world.getBlockState( p );
|
||||
if( blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ) )
|
||||
if( blk.isSolidSide( this.world, p, side.getOpposite() ) )
|
||||
{
|
||||
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.tile.misc;
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
@@ -63,7 +61,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
public boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final boolean hadPower = this.isPowered();
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -137,7 +135,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final boolean wasActive = this.isActive;
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.io.IOException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -81,7 +79,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final boolean wasOn = this.isOn;
|
||||
|
||||
@@ -25,8 +25,6 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -81,7 +79,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
boolean ret = this.getCableBus().readFromStream( data );
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.tile.networking;
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -85,7 +83,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int old = this.getClientFlags();
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Optional;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -106,7 +104,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int oldValue = this.constructed;
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.tile.spatial;
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
@@ -218,7 +216,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int old = this.displayBits;
|
||||
|
||||
@@ -26,8 +26,6 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -35,7 +33,6 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.FluidTankProperties;
|
||||
@@ -415,7 +412,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
@@ -123,7 +121,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int oldState = this.state;
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.tile.storage;
|
||||
import java.io.IOException;
|
||||
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -64,7 +63,7 @@ public class TileSkyChest extends AEBaseInvTile implements ITickableTileEntity,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
protected boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int wasOpen = this.getPlayerOpen();
|
||||
|
||||
Reference in New Issue
Block a user