Merge branch '5.0.x' into 6.0.x
Conflicts: common/buildcraft/BuildCraftBuilders.java common/buildcraft/BuildCraftCore.java common/buildcraft/BuildCraftEnergy.java common/buildcraft/BuildCraftFactory.java common/buildcraft/BuildCraftSilicon.java common/buildcraft/BuildCraftTransport.java common/buildcraft/builders/network/PacketHandlerBuilders.java common/buildcraft/core/network/PacketHandler.java common/buildcraft/core/network/PacketTileState.java common/buildcraft/factory/network/PacketHandlerFactory.java common/buildcraft/silicon/network/PacketHandlerSilicon.java common/buildcraft/transport/network/PacketHandlerTransport.java
This commit is contained in:
commit
8bff372360
11 changed files with 83 additions and 74 deletions
|
@ -77,6 +77,7 @@ import buildcraft.core.ItemWrench;
|
||||||
import buildcraft.core.SpringPopulate;
|
import buildcraft.core.SpringPopulate;
|
||||||
import buildcraft.core.TickHandlerCoreClient;
|
import buildcraft.core.TickHandlerCoreClient;
|
||||||
import buildcraft.core.Version;
|
import buildcraft.core.Version;
|
||||||
|
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||||
import buildcraft.core.network.EntityIds;
|
import buildcraft.core.network.EntityIds;
|
||||||
import buildcraft.core.network.PacketHandler;
|
import buildcraft.core.network.PacketHandler;
|
||||||
import buildcraft.core.network.PacketUpdate;
|
import buildcraft.core.network.PacketUpdate;
|
||||||
|
@ -320,7 +321,7 @@ public class BuildCraftCore extends BuildCraftMod {
|
||||||
BuildCraftAPI.proxy = CoreProxy.proxy;
|
BuildCraftAPI.proxy = CoreProxy.proxy;
|
||||||
|
|
||||||
channels = NetworkRegistry.INSTANCE.newChannel
|
channels = NetworkRegistry.INSTANCE.newChannel
|
||||||
(DefaultProps.NET_CHANNEL_NAME + "-CORE", new PacketHandler());
|
(DefaultProps.NET_CHANNEL_NAME + "-CORE", new BuildCraftChannelHandler(), new PacketHandler());
|
||||||
|
|
||||||
ActionManager.registerTriggerProvider(new DefaultTriggerProvider());
|
ActionManager.registerTriggerProvider(new DefaultTriggerProvider());
|
||||||
ActionManager.registerActionProvider(new DefaultActionProvider());
|
ActionManager.registerActionProvider(new DefaultActionProvider());
|
||||||
|
|
|
@ -52,6 +52,7 @@ import buildcraft.core.BlockSpring;
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.InterModComms;
|
import buildcraft.core.InterModComms;
|
||||||
import buildcraft.core.Version;
|
import buildcraft.core.Version;
|
||||||
|
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.triggers.BCTrigger;
|
import buildcraft.core.triggers.BCTrigger;
|
||||||
import buildcraft.energy.BlockBuildcraftFluid;
|
import buildcraft.energy.BlockBuildcraftFluid;
|
||||||
|
@ -328,7 +329,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent evt) {
|
public void init(FMLInitializationEvent evt) {
|
||||||
channels = NetworkRegistry.INSTANCE.newChannel
|
channels = NetworkRegistry.INSTANCE.newChannel
|
||||||
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new PacketHandlerTransport());
|
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new BuildCraftChannelHandler(), new PacketHandlerTransport());
|
||||||
|
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import buildcraft.builders.schematics.SchematicIgnoreMeta;
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.InterModComms;
|
import buildcraft.core.InterModComms;
|
||||||
import buildcraft.core.Version;
|
import buildcraft.core.Version;
|
||||||
|
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.utils.ConfigUtils;
|
import buildcraft.core.utils.ConfigUtils;
|
||||||
import buildcraft.factory.BlockAutoWorkbench;
|
import buildcraft.factory.BlockAutoWorkbench;
|
||||||
|
@ -161,7 +162,7 @@ public class BuildCraftFactory extends BuildCraftMod {
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void initialize(FMLPreInitializationEvent evt) {
|
public void initialize(FMLPreInitializationEvent evt) {
|
||||||
channels = NetworkRegistry.INSTANCE.newChannel
|
channels = NetworkRegistry.INSTANCE.newChannel
|
||||||
(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new PacketHandlerFactory());
|
(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new BuildCraftChannelHandler(), new PacketHandlerFactory());
|
||||||
|
|
||||||
ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, Configuration.CATEGORY_GENERAL);
|
ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, Configuration.CATEGORY_GENERAL);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import buildcraft.builders.schematics.SchematicRotateMeta;
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.InterModComms;
|
import buildcraft.core.InterModComms;
|
||||||
import buildcraft.core.Version;
|
import buildcraft.core.Version;
|
||||||
|
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.silicon.BlockLaser;
|
import buildcraft.silicon.BlockLaser;
|
||||||
import buildcraft.silicon.BlockLaserTable;
|
import buildcraft.silicon.BlockLaserTable;
|
||||||
|
@ -83,7 +84,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent evt) {
|
public void init(FMLInitializationEvent evt) {
|
||||||
channels = NetworkRegistry.INSTANCE.newChannel
|
channels = NetworkRegistry.INSTANCE.newChannel
|
||||||
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new PacketHandlerSilicon());
|
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new BuildCraftChannelHandler(), new PacketHandlerSilicon());
|
||||||
|
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
||||||
CoreProxy.proxy.registerTileEntity(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
|
CoreProxy.proxy.registerTileEntity(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
|
||||||
|
|
|
@ -46,6 +46,7 @@ import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.InterModComms;
|
import buildcraft.core.InterModComms;
|
||||||
import buildcraft.core.ItemBuildCraft;
|
import buildcraft.core.ItemBuildCraft;
|
||||||
import buildcraft.core.Version;
|
import buildcraft.core.Version;
|
||||||
|
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.triggers.BCAction;
|
import buildcraft.core.triggers.BCAction;
|
||||||
import buildcraft.core.triggers.BCTrigger;
|
import buildcraft.core.triggers.BCTrigger;
|
||||||
|
@ -425,7 +426,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent evt) {
|
public void init(FMLInitializationEvent evt) {
|
||||||
channels = NetworkRegistry.INSTANCE.newChannel
|
channels = NetworkRegistry.INSTANCE.newChannel
|
||||||
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", new PacketHandlerTransport());
|
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", new BuildCraftChannelHandler(), new PacketHandlerTransport());
|
||||||
|
|
||||||
// Register connection handler
|
// Register connection handler
|
||||||
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
||||||
|
|
|
@ -10,8 +10,9 @@ package buildcraft.core.network;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.network.INetHandler;
|
import net.minecraft.network.INetHandler;
|
||||||
|
@ -20,13 +21,10 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
|
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
|
||||||
|
|
||||||
public class PacketHandler extends BuildCraftChannelHandler {
|
|
||||||
|
|
||||||
|
@Sharable
|
||||||
|
public class PacketHandler extends SimpleChannelInboundHandler<BuildCraftPacket> {
|
||||||
private void onTileUpdate(EntityPlayer player, PacketTileUpdate packet) throws IOException {
|
private void onTileUpdate(EntityPlayer player, PacketTileUpdate packet) throws IOException {
|
||||||
World world = player.worldObj;
|
World world = player.worldObj;
|
||||||
|
|
||||||
|
@ -46,10 +44,7 @@ public class PacketHandler extends BuildCraftChannelHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
|
||||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
|
||||||
super.decodeInto(ctx, data, packet);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
||||||
|
@ -69,7 +64,7 @@ public class PacketHandler extends BuildCraftChannelHandler {
|
||||||
TileEntity tile = world.getTileEntity(pkt.posX, pkt.posY, pkt.posZ);
|
TileEntity tile = world.getTileEntity(pkt.posX, pkt.posY, pkt.posZ);
|
||||||
|
|
||||||
if (tile instanceof ISyncedTile) {
|
if (tile instanceof ISyncedTile) {
|
||||||
pkt.applyStates(data, (ISyncedTile) tile);
|
pkt.applyStates((ISyncedTile) tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -92,36 +87,32 @@ public class PacketHandler extends BuildCraftChannelHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
case PacketIds.RPC_PIPE: {
|
case PacketIds.RPC_PIPE: {
|
||||||
PacketRPCPipe rpc = new PacketRPCPipe();
|
// TODO: RPC pipes are not used right now. Ressurect this
|
||||||
rpc.sender = player;
|
// code if needed later.
|
||||||
|
/*
|
||||||
|
* PacketRPCPipe rpc = new PacketRPCPipe(); rpc.sender = player;
|
||||||
|
*
|
||||||
|
* int dimId = data.readShort(); World world = null;
|
||||||
|
*
|
||||||
|
* if (!rpc.sender.worldObj.isRemote) { // if this is a server,
|
||||||
|
* then get the world
|
||||||
|
*
|
||||||
|
* world = DimensionManager.getProvider(dimId).worldObj; } else
|
||||||
|
* if (rpc.sender.worldObj.provider.dimensionId == dimId) { //
|
||||||
|
* if the player is on this world, then synchronize things
|
||||||
|
*
|
||||||
|
* world = rpc.sender.worldObj; }
|
||||||
|
*
|
||||||
|
* if (world != null) { int x = data.readInt(); int y =
|
||||||
|
* data.readInt(); int z = data.readInt();
|
||||||
|
*
|
||||||
|
* TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
*
|
||||||
|
* if (tile instanceof TileGenericPipe) { rpc.setPipe
|
||||||
|
* (((TileGenericPipe) tile).pipe); rpc.readData(data); } }
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
|
||||||
int dimId = data.readShort();
|
|
||||||
World world = null;
|
|
||||||
|
|
||||||
if (!rpc.sender.worldObj.isRemote) {
|
|
||||||
// if this is a server, then get the world
|
|
||||||
|
|
||||||
world = DimensionManager.getProvider(dimId).worldObj;
|
|
||||||
} else if (rpc.sender.worldObj.provider.dimensionId == dimId) {
|
|
||||||
// if the player is on this world, then synchronize things
|
|
||||||
|
|
||||||
world = rpc.sender.worldObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (world != null) {
|
|
||||||
int x = data.readInt();
|
|
||||||
int y = data.readInt();
|
|
||||||
int z = data.readInt();
|
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
|
||||||
rpc.setPipe (((TileGenericPipe) tile).pipe);
|
|
||||||
rpc.readData(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
|
|
||||||
|
// TODO: This is not yet used
|
||||||
public class PacketRPCPipe extends BuildCraftPacket {
|
public class PacketRPCPipe extends BuildCraftPacket {
|
||||||
|
|
||||||
public Pipe pipe;
|
public Pipe pipe;
|
||||||
|
|
|
@ -13,9 +13,12 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
public class PacketTileState extends PacketCoordinates {
|
public class PacketTileState extends PacketCoordinates {
|
||||||
|
|
||||||
|
private ByteBuf state;
|
||||||
|
|
||||||
private class StateWithId {
|
private class StateWithId {
|
||||||
public byte stateId;
|
public byte stateId;
|
||||||
public IClientState state;
|
public IClientState state;
|
||||||
|
@ -36,7 +39,7 @@ public class PacketTileState extends PacketCoordinates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for outgoing packets
|
* Constructor for outgoing packets
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* , y, z - the coordinates the tile to sync
|
* , y, z - the coordinates the tile to sync
|
||||||
*/
|
*/
|
||||||
|
@ -50,16 +53,11 @@ public class PacketTileState extends PacketCoordinates {
|
||||||
return PacketIds.STATE_UPDATE;
|
return PacketIds.STATE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void applyStates(ISyncedTile tile) throws IOException {
|
||||||
public void readData(ByteBuf data) {
|
byte stateCount = state.readByte();
|
||||||
super.readData(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void applyStates(ByteBuf data, ISyncedTile tile) throws IOException {
|
|
||||||
byte stateCount = data.readByte();
|
|
||||||
for (int i = 0; i < stateCount; i++) {
|
for (int i = 0; i < stateCount; i++) {
|
||||||
byte stateId = data.readByte();
|
byte stateId = state.readByte();
|
||||||
tile.getStateInstance(stateId).readData(data);
|
tile.getStateInstance(stateId).readData(state);
|
||||||
tile.afterStateUpdated(stateId);
|
tile.afterStateUpdated(stateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,10 +69,25 @@ public class PacketTileState extends PacketCoordinates {
|
||||||
@Override
|
@Override
|
||||||
public void writeData(ByteBuf data) {
|
public void writeData(ByteBuf data) {
|
||||||
super.writeData(data);
|
super.writeData(data);
|
||||||
data.writeByte(stateList.size());
|
|
||||||
|
ByteBuf tmpState = Unpooled.buffer();
|
||||||
|
|
||||||
|
tmpState.writeByte(stateList.size());
|
||||||
for (StateWithId stateWithId : stateList) {
|
for (StateWithId stateWithId : stateList) {
|
||||||
data.writeByte(stateWithId.stateId);
|
tmpState.writeByte(stateWithId.stateId);
|
||||||
stateWithId.state.writeData(data);
|
stateWithId.state.writeData(tmpState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.writeInt(tmpState.readableBytes());
|
||||||
|
data.writeBytes(tmpState.readBytes(tmpState.readableBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readData(ByteBuf data) {
|
||||||
|
super.readData(data);
|
||||||
|
|
||||||
|
state = Unpooled.buffer();
|
||||||
|
int length = data.readInt();
|
||||||
|
state.writeBytes(data.readBytes(length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ package buildcraft.factory.network;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.network.INetHandler;
|
import net.minecraft.network.INetHandler;
|
||||||
|
@ -22,19 +24,17 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
|
||||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
|
||||||
import buildcraft.core.network.BuildCraftPacket;
|
import buildcraft.core.network.BuildCraftPacket;
|
||||||
import buildcraft.core.network.PacketIds;
|
import buildcraft.core.network.PacketIds;
|
||||||
import buildcraft.core.network.PacketUpdate;
|
import buildcraft.core.network.PacketUpdate;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.factory.TileRefinery;
|
import buildcraft.factory.TileRefinery;
|
||||||
|
|
||||||
public class PacketHandlerFactory extends BuildCraftChannelHandler {
|
@Sharable
|
||||||
|
public class PacketHandlerFactory extends SimpleChannelInboundHandler<BuildCraftPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
|
||||||
super.decodeInto(ctx, data, packet);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.silicon.network;
|
package buildcraft.silicon.network;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
@ -19,7 +20,6 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
|
||||||
import buildcraft.core.network.BuildCraftPacket;
|
import buildcraft.core.network.BuildCraftPacket;
|
||||||
import buildcraft.core.network.PacketCoordinates;
|
import buildcraft.core.network.PacketCoordinates;
|
||||||
import buildcraft.core.network.PacketIds;
|
import buildcraft.core.network.PacketIds;
|
||||||
|
@ -31,12 +31,11 @@ import buildcraft.silicon.TileAssemblyTable;
|
||||||
import buildcraft.silicon.TileAssemblyTable.SelectionMessage;
|
import buildcraft.silicon.TileAssemblyTable.SelectionMessage;
|
||||||
import buildcraft.silicon.gui.ContainerAssemblyTable;
|
import buildcraft.silicon.gui.ContainerAssemblyTable;
|
||||||
|
|
||||||
public class PacketHandlerSilicon extends BuildCraftChannelHandler {
|
@Sharable
|
||||||
|
public class PacketHandlerSilicon extends SimpleChannelInboundHandler<BuildCraftPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
|
||||||
super.decodeInto(ctx, data, packet);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.transport.network;
|
package buildcraft.transport.network;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
@ -19,7 +20,6 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
|
||||||
import buildcraft.core.network.BuildCraftPacket;
|
import buildcraft.core.network.BuildCraftPacket;
|
||||||
import buildcraft.core.network.PacketCoordinates;
|
import buildcraft.core.network.PacketCoordinates;
|
||||||
import buildcraft.core.network.PacketIds;
|
import buildcraft.core.network.PacketIds;
|
||||||
|
@ -33,7 +33,8 @@ import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.pipes.PipeItemsDiamond;
|
import buildcraft.transport.pipes.PipeItemsDiamond;
|
||||||
import buildcraft.transport.pipes.PipeItemsEmerald;
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
|
|
||||||
public class PacketHandlerTransport extends BuildCraftChannelHandler {
|
@Sharable
|
||||||
|
public class PacketHandlerTransport extends SimpleChannelInboundHandler<BuildCraftPacket> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: A lot of this is based on the player to retrieve the world.
|
* TODO: A lot of this is based on the player to retrieve the world.
|
||||||
|
@ -42,8 +43,7 @@ public class PacketHandlerTransport extends BuildCraftChannelHandler {
|
||||||
* RPCs.
|
* RPCs.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
|
||||||
super.decodeInto(ctx, data, packet);
|
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
||||||
|
|
Loading…
Reference in a new issue