mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Alright, almost done with network changes (63 errors!)
This commit is contained in:
1 parent
84055986d0
commit
659b963af6
90 files changed
+413
-475
No files matched your search
@@ -1,23 +1,23 @@
|
||||
package mekanism.common.network;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.ITileNetwork;
|
||||
import mekanism.common.PacketHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class PacketTileEntity extends MekanismPacket
|
||||
{
|
||||
public Coord4D coord4D;
|
||||
|
||||
public ArrayList parameters;
|
||||
|
||||
public ByteBuf storedBuffer = null;
|
||||
|
||||
public PacketTileEntity(Coord4D coord, ArrayList params)
|
||||
{
|
||||
@@ -25,21 +25,8 @@ public class PacketTileEntity extends MekanismPacket
|
||||
parameters = params;
|
||||
}
|
||||
|
||||
public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception
|
||||
{
|
||||
int x = dataStream.readInt();
|
||||
int y = dataStream.readInt();
|
||||
int z = dataStream.readInt();
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof ITileNetwork)
|
||||
{
|
||||
((ITileNetwork)tileEntity).handlePacketData(dataStream);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(DataOutputStream dataStream) throws Exception
|
||||
@Override
|
||||
public void write(ChannelHandlerContext ctx, ByteBuf dataStream) throws Exception
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
@@ -49,26 +36,34 @@ public class PacketTileEntity extends MekanismPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
public void read(ChannelHandlerContext ctx, ByteBuf dataStream) throws Exception
|
||||
{
|
||||
|
||||
int x = dataStream.readInt();
|
||||
int y = dataStream.readInt();
|
||||
int z = dataStream.readInt();
|
||||
|
||||
storedBuffer = dataStream.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
public void handleClientSide(EntityPlayer player) throws Exception
|
||||
{
|
||||
|
||||
TileEntity tileEntity = coord4D.getTileEntity(player.worldObj);
|
||||
|
||||
if(tileEntity instanceof ITileNetwork)
|
||||
{
|
||||
((ITileNetwork)tileEntity).handlePacketData(storedBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player)
|
||||
public void handleServerSide(EntityPlayer player) throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player)
|
||||
{
|
||||
|
||||
TileEntity tileEntity = coord4D.getTileEntity(player.worldObj);
|
||||
|
||||
if(tileEntity instanceof ITileNetwork)
|
||||
{
|
||||
((ITileNetwork)tileEntity).handlePacketData(storedBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user