mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 17:44:46 +00:00
fix interface terminal bug
This commit is contained in:
1 parent
d2c420d193
commit
c935e85a2f
12 files changed
+222
-31
No files matched your search
@@ -0,0 +1,63 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class CPacketRenamer implements IMessage {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int dim;
|
||||
private ForgeDirection side;
|
||||
|
||||
public CPacketRenamer() {}
|
||||
|
||||
public CPacketRenamer(int x, int y, int z, int dim, ForgeDirection side) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.dim = dim;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
this.dim = buf.readInt();
|
||||
this.side = ForgeDirection.getOrientation(buf.readInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(this.x);
|
||||
buf.writeInt(this.y);
|
||||
buf.writeInt(this.z);
|
||||
buf.writeInt(this.dim);
|
||||
buf.writeInt(side.ordinal());
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<CPacketRenamer, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(CPacketRenamer message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
TileEntity tile = DimensionManager.getWorld(message.dim).getTileEntity(message.x, message.y, message.z);
|
||||
if (tile != null) {
|
||||
Platform.openGUI(player, tile, message.side, GuiBridge.GUI_RENAMER);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user