mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Network stuffs -> 1.7
This commit is contained in:
1 parent
bb98f77de4
commit
8cd760ea06
34 files changed
+527
-595
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package tconstruct.util.network.packet;
|
||||
|
||||
import mantle.util.network.StringEncoder;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,22 +12,23 @@ public class PacketToolStation extends AbstractPacket {
|
||||
|
||||
private int x, y, z;
|
||||
private String toolName;
|
||||
|
||||
public PacketToolStation(){}
|
||||
|
||||
public PacketToolStation(int x, int y, int z, String toolName){
|
||||
|
||||
public PacketToolStation() {
|
||||
}
|
||||
|
||||
public PacketToolStation(int x, int y, int z, String toolName) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.toolName = toolName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
StringEncoder.encodeString(buffer, toolName);
|
||||
ByteBufUtils.writeUTF8String(buffer, toolName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,25 +36,24 @@ public class PacketToolStation extends AbstractPacket {
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
z = buffer.readInt();
|
||||
toolName = StringEncoder.decodeString(buffer);
|
||||
toolName = ByteBufUtils.readUTF8String(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
World world = player.worldObj;
|
||||
TileEntity te = world.func_147438_o(x, y, z);
|
||||
World world = player.worldObj;
|
||||
TileEntity te = world.func_147438_o(x, y, z);
|
||||
|
||||
if (te instanceof ToolStationLogic)
|
||||
{
|
||||
((ToolStationLogic) te).setToolname(toolName);
|
||||
}
|
||||
if (te instanceof ToolForgeLogic)
|
||||
{
|
||||
((ToolForgeLogic) te).setToolname(toolName);
|
||||
}
|
||||
if (te instanceof ToolStationLogic) {
|
||||
((ToolStationLogic) te).setToolname(toolName);
|
||||
}
|
||||
if (te instanceof ToolForgeLogic) {
|
||||
((ToolForgeLogic) te).setToolname(toolName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user