Search in sources :

Example 1 with PacketServerCommand

use of mcjty.lib.network.PacketServerCommand in project RFTools by McJty.

the class ScreenTileEntity method hitScreenClient.

public void hitScreenClient(double hitX, double hitY, double hitZ, EnumFacing side, EnumFacing horizontalFacing) {
    ModuleRaytraceResult result = getHitModule(hitX, hitY, hitZ, side, horizontalFacing);
    if (result == null) {
        return;
    }
    List<IClientScreenModule> modules = getClientScreenModules();
    int module = result.getModuleIndex();
    if (isActivated(module)) {
        // We are getting a hit twice. Module is already activated. Do nothing
        return;
    }
    modules.get(module).mouseClick(getWorld(), result.getX(), result.getY() - result.getCurrenty(), true);
    clickedModules.add(new ActivatedModule(module, 3, result.getX(), result.getY()));
    RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), CMD_CLICK, new Argument("x", result.getX()), new Argument("y", result.getY() - result.getCurrenty()), new Argument("module", module)));
}
Also used : Argument(mcjty.lib.network.Argument) PacketServerCommand(mcjty.lib.network.PacketServerCommand)

Example 2 with PacketServerCommand

use of mcjty.lib.network.PacketServerCommand in project RFTools by McJty.

the class ScreenTileEntity method focusModuleClient.

public void focusModuleClient(double hitX, double hitY, double hitZ, EnumFacing side, EnumFacing horizontalFacing) {
    ModuleRaytraceResult result = getHitModule(hitX, hitY, hitZ, side, horizontalFacing);
    if (result == null) {
        RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), CMD_HOVER, new Argument("x", -1), new Argument("y", -1), new Argument("module", -1)));
        return;
    }
    RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), CMD_HOVER, new Argument("x", result.getX()), new Argument("y", result.getY() - result.getCurrenty()), new Argument("module", result.getModuleIndex())));
}
Also used : Argument(mcjty.lib.network.Argument) PacketServerCommand(mcjty.lib.network.PacketServerCommand)

Example 3 with PacketServerCommand

use of mcjty.lib.network.PacketServerCommand in project RFTools by McJty.

the class MatterBeamerTileEntity method setDestination.

public void setDestination(BlockPos destination) {
    this.destination = destination;
    disableBlockGlow();
    markDirty();
    if (getWorld().isRemote) {
        // We're on the client. Send change to server.
        RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), MatterBeamerTileEntity.CMD_SETDESTINATION, new Argument("dest", destination)));
    } else {
        markDirtyClient();
    }
}
Also used : Argument(mcjty.lib.network.Argument) PacketServerCommand(mcjty.lib.network.PacketServerCommand)

Example 4 with PacketServerCommand

use of mcjty.lib.network.PacketServerCommand in project RFTools by McJty.

the class EndergenicTileEntity method setDestination.

public void setDestination(BlockPos destination) {
    markDirtyQuick();
    this.destination = destination;
    distance = calculateDistance(destination);
    if (getWorld().isRemote) {
        // We're on the client. Send change to server.
        RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), EndergenicTileEntity.CMD_SETDESTINATION, new Argument("dest", destination)));
    }
}
Also used : Argument(mcjty.lib.network.Argument) PacketServerCommand(mcjty.lib.network.PacketServerCommand)

Aggregations

Argument (mcjty.lib.network.Argument)4 PacketServerCommand (mcjty.lib.network.PacketServerCommand)4