Search in sources :

Example 6 with CommandWriter

use of buildcraft.core.lib.network.command.CommandWriter 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 CommandWriter

use of buildcraft.core.lib.network.command.CommandWriter 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 CommandWriter

use of buildcraft.core.lib.network.command.CommandWriter 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 CommandWriter

use of buildcraft.core.lib.network.command.CommandWriter 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)

Example 10 with CommandWriter

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

the class EntityRobot method setItemInUse.

@Override
public void setItemInUse(ItemStack stack) {
    itemInUse = stack;
    BuildCraftCore.instance.sendToEntity(new PacketCommand(this, "clientSetItemInUse", new CommandWriter() {

        @Override
        public void write(ByteBuf data) {
            NetworkUtils.writeStack(data, itemInUse);
        }
    }), this);
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) CommandWriter(buildcraft.core.lib.network.command.CommandWriter) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

CommandWriter (buildcraft.core.lib.network.command.CommandWriter)25 PacketCommand (buildcraft.core.lib.network.command.PacketCommand)25 ByteBuf (io.netty.buffer.ByteBuf)25 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)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 ZonePlan (buildcraft.robotics.zone.ZonePlan)2 ItemStack (net.minecraft.item.ItemStack)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 RequirementItemStack (buildcraft.core.blueprints.RequirementItemStack)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