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);
}
}));
}
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);
}
}
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);
}
}));
}
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;
}
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);
}
}));
}
Aggregations