Search in sources :

Example 6 with PacketCommand

use of buildcraft.core.lib.network.command.PacketCommand in project BuildCraft by BuildCraft.

the class GuiZonePlan method uploadMap.

private void uploadMap() {
    BuildCraftCore.instance.sendToServer(new PacketCommand(getContainer(), "computeMap", new CommandWriter() {

        @Override
        public void write(ByteBuf data) {
            data.writeInt(cx);
            data.writeInt(cz);
            data.writeShort(getContainer().mapTexture.width);
            data.writeShort(getContainer().mapTexture.height);
            data.writeFloat(blocksPerPixel);
        }
    }));
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) CommandWriter(buildcraft.core.lib.network.command.CommandWriter) ByteBuf(io.netty.buffer.ByteBuf)

Example 7 with PacketCommand

use of buildcraft.core.lib.network.command.PacketCommand in project BuildCraft by BuildCraft.

the class GuiZonePlan method keyTyped.

@Override
protected void keyTyped(char carac, int val) throws IOException {
    if (!isFullscreen() && textField.isFocused()) {
        if (carac == 13 || carac == 27) {
            textField.setFocused(false);
        } else {
            textField.textboxKeyTyped(carac, val);
            final String text = textField.getText();
            BuildCraftCore.instance.sendToServer(new PacketCommand(getContainer(), "setName", new CommandWriter() {

                @Override
                public void write(ByteBuf data) {
                    NetworkUtils.writeUTF(data, text);
                }
            }));
        }
        return;
    } else if (val == Keyboard.KEY_F5) {
        uploadMap();
        refreshSelectedArea();
    } else if (carac == '+' && incBlocksPerPixel()) {
        uploadMap();
        refreshSelectedArea();
    } else if (carac == '-' && decBlocksPerPixel()) {
        uploadMap();
        refreshSelectedArea();
    } else if (carac == 'm' || (carac == 27 && isFullscreen())) {
        toWindowed();
    } else if (carac == 'M') {
        toFullscreen();
    } else {
        super.keyTyped(carac, val);
    }
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) CommandWriter(buildcraft.core.lib.network.command.CommandWriter) ByteBuf(io.netty.buffer.ByteBuf)

Example 8 with PacketCommand

use of buildcraft.core.lib.network.command.PacketCommand in project BuildCraft by BuildCraft.

the class TileArchitect method rpcSetConfiguration.

public void rpcSetConfiguration(BlueprintReadConfiguration conf) {
    readConfiguration = conf;
    BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setReadConfiguration", new CommandWriter() {

        @Override
        public void write(ByteBuf data) {
            readConfiguration.writeData(data);
        }
    }));
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) CommandWriter(buildcraft.core.lib.network.command.CommandWriter) ByteBuf(io.netty.buffer.ByteBuf)

Example 9 with PacketCommand

use of buildcraft.core.lib.network.command.PacketCommand in project BuildCraft by BuildCraft.

the class TileBuilder method decrStackSize.

@Override
public ItemStack decrStackSize(int i, int j) {
    ItemStack result = inv.decrStackSize(i, j);
    if (!worldObj.isRemote) {
        if (i == 0) {
            BuildCraftCore.instance.sendToWorld(new PacketCommand(this, "clearItemRequirements", null), worldObj);
            iterateBpt(false);
        }
    }
    return result;
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) RequirementItemStack(buildcraft.core.blueprints.RequirementItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 10 with PacketCommand

use of buildcraft.core.lib.network.command.PacketCommand in project BuildCraft by BuildCraft.

the class TileFiller method rpcSetParameter.

public void rpcSetParameter(int i, IStatementParameter patternParameter) {
    BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setParameters", new CommandWriter() {

        @Override
        public void write(ByteBuf data) {
            NBTTagCompound parameterData = new NBTTagCompound();
            writeParametersToNBT(parameterData);
            NetworkUtils.writeNBT(data, parameterData);
        }
    }));
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CommandWriter(buildcraft.core.lib.network.command.CommandWriter) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

PacketCommand (buildcraft.core.lib.network.command.PacketCommand)28 CommandWriter (buildcraft.core.lib.network.command.CommandWriter)25 ByteBuf (io.netty.buffer.ByteBuf)25 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 ItemStack (net.minecraft.item.ItemStack)3 LibraryTypeHandler (buildcraft.api.library.LibraryTypeHandler)2 LibraryTypeHandlerByteArray (buildcraft.api.library.LibraryTypeHandlerByteArray)2 LibraryTypeHandlerNBT (buildcraft.api.library.LibraryTypeHandlerNBT)2 LibraryId (buildcraft.core.blueprints.LibraryId)2 RequirementItemStack (buildcraft.core.blueprints.RequirementItemStack)2 ZonePlan (buildcraft.robotics.zone.ZonePlan)2 IZone (buildcraft.api.core.IZone)1 IMapLocation (buildcraft.api.items.IMapLocation)1 IStatement (buildcraft.api.statements.IStatement)1 IStatementParameter (buildcraft.api.statements.IStatementParameter)1 FillerPattern (buildcraft.core.builders.patterns.FillerPattern)1 Packet (buildcraft.core.lib.network.base.Packet)1 TileZonePlan (buildcraft.robotics.TileZonePlan)1 ContainerZonePlan (buildcraft.robotics.gui.ContainerZonePlan)1