PixelPilot.Structures
0.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PixelPilot.Structures --version 0.0.1
NuGet\Install-Package PixelPilot.Structures -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PixelPilot.Structures" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PixelPilot.Structures --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PixelPilot.Structures, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PixelPilot.Structures as a Cake Addin #addin nuget:?package=PixelPilot.Structures&version=0.0.1 // Install PixelPilot.Structures as a Cake Tool #tool nuget:?package=PixelPilot.Structures&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PixelPilot.Structures
Structures are used to load and save blocks. This is an optional package.
📄 Documentation
JSON Format
This is an example. This example has been shortened to fit here so it might not actually be a valid and working save file.
{
// Version of this save
"Version": 1,
// Width & Height of this structure
"Width": 1,
"Height": 1,
// Meta tags to be defined by the user
"Meta": {
"key": "value"
},
// If this structure has saved empty blocks
"ContainsEmpty": false,
"Blocks": {
// Mapping of blocks. ID's in blockdata are replaced by temporary IDs.
// BricksGrass: 0, Coin: 1
"Mapping": [
"BricksGrass",
"Coin"
],
// Blockdata as found in the world buffer in INIT.
"BlockData": [
"AQAAAAsAAAABAAAAAAAAAA==",
"AgAAAAgAAAABAAAAAQAAAA=="
]
}
}
Example bot:
using System.Drawing;
using System.Text.Json;
using Microsoft.Extensions.Configuration;
using PixelPilot.Common.Logging;
using PixelPilot.PixelGameClient;
using PixelPilot.PixelGameClient.Messages;
using PixelPilot.PixelGameClient.Messages.Received;
using PixelPilot.PixelGameClient.Messages.Send;
using PixelPilot.PixelGameClient.Players.Basic;
using PixelPilot.PixelGameClient.World;
using PixelPilot.Structures.Converters.PilotSimple;
using PixelPilot.Structures.Extensions;
using PixelPilotExample;
// Load the configuration. Don't store your account token in the code :)
var configuration = new ConfigurationBuilder()
.AddJsonFile("config.json")
.AddEnvironmentVariables()
.Build();
LogManager.Configure(configuration.GetSection("Logging"));
var config = configuration.Get<BasicConfig>();
if (config == null)
{
Console.WriteLine("The configuration file could not be loaded.");
return;
}
// Create a client.
var client = new PixelPilotClient(config.AccountToken, false);
// Player manager allows you to easily keep track of player stats.
// For advanced users, it can be extended to include relevant information for you.
var playerManager = new PlayerManager();
client.OnPacketReceived += playerManager.HandlePacket;
// Create a PixelWorld class and attach the client to it.
// Allow it to listen to client updates. Not required!
var world = new PixelWorld();
client.OnPacketReceived += world.HandlePacket;
world.OnBlockPlaced += (_, playerId, oldBlock, _) =>
{
};
// Executed when the client receives a packet!
var p1 = new Point(8, 8);
var p2 = new Point(16, 19);
client.OnPacketReceived += async (_, packet) =>
{
var playerPacket = packet as IPixelGamePlayerPacket;
if (playerPacket == null) return;
var player = playerManager.GetPlayer(playerPacket.PlayerId);
if (player == null) return;
// Make use of strongly typed packets!
switch (packet)
{
case PlayerChatPacket { Message: ".stop" }:
client.Disconnect();
Environment.Exit(0);
return;
case PlayerChatPacket { Message: ".test" }:
playerManager.Players
.Where(p => p.Deaths > 2)
.ToList()
.ForEach(p =>
{
Task.Run(async () =>
{
client.Send(new PlayerChatOutPacket($"/pm {p.Username} Man you should die less often!"));
await Task.Delay(1000);
client.Send(new PlayerChatOutPacket($"/reset {p.Username}"));
client.Send(new PlayerChatOutPacket($"/pm {p.Username} Or maybe..."));
await Task.Delay(1000);
client.Send(new PlayerChatOutPacket($"/kick {p.Username}"));
});
});
return;
case PlayerChatPacket { Message: ".p1" } chat:
{
p1 = new Point((int)(player.X / 16), (int)(player.Y / 16));
client.Send(new PlayerChatOutPacket(p1.ToString()));
break;
}
case PlayerChatPacket { Message: ".p2" } chat:
{
p2 = new Point((int)(player.X / 16), (int)(player.Y / 16));
client.Send(new PlayerChatOutPacket(p2.ToString()));
break;
}
case PlayerChatPacket { Message: ".save" } chat:
{
var structure = world.GetStructure(p1, p2, copyEmpty: false);
// Save
var json = PilotSaveSerializer.Serialize(structure);
File.WriteAllText("test-struct.json", json);
client.Send(new PlayerChatOutPacket("Struct saved!"));
break;
}
case PlayerChatPacket { Message: ".load" } chat:
{
string json = File.ReadAllText("test-struct.json");
var structure = PilotSaveSerializer.Deserialize(json);
client.Send(new PlayerChatOutPacket("Struct pasting..."));
world.GetDifference(structure, (int) player.X / 16, (int) player.Y / 16).PasteShuffled(client, new Point((int)(player.X / 16), (int)(player.Y / 16)), 5);
break;
}
case PlayerChatPacket { Message: ".diff" } chat:
{
string json = File.ReadAllText("test-struct.json");
var structure = PilotSaveSerializer.Deserialize(json);
if (structure == null) return;
client.Send(new PlayerChatOutPacket("Struct pasting..."));
world.GetDifference(structure, (int) player.X / 16, (int) player.Y / 16).ForEach(b => Console.WriteLine(JsonSerializer.Serialize(b)));
break;
}
case PlayerJoinPacket join:
client.Send(new PlayerChatOutPacket($"/giveedit {join.Username}"));
break;
}
};
// Executed once the client receives INIT
// Make a platform and do some silly loops.
client.OnClientConnected += (_) =>
{
client.Send(new PlayerChatOutPacket("Hello world using the PixelPilot API."));
};
// Connect to a room.
await client.Connect("mknckr7oqxq24xa");
// Don't terminate.
Thread.Sleep(-1);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- PixelPilot.Core (>= 0.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.11.3 | 100 | 1/3/2025 |
1.11.2 | 105 | 1/3/2025 |
1.11.1 | 105 | 1/3/2025 |
1.11.0 | 91 | 12/29/2024 |
1.10.5 | 89 | 12/20/2024 |
1.10.4 | 100 | 12/17/2024 |
1.10.3 | 111 | 12/6/2024 |
1.10.2 | 107 | 12/4/2024 |
1.10.1 | 98 | 12/1/2024 |
1.10.0 | 98 | 12/1/2024 |
1.10.0-alpha | 73 | 11/30/2024 |
1.9.15 | 95 | 11/26/2024 |
1.9.14 | 91 | 11/24/2024 |
1.9.13 | 92 | 11/18/2024 |
1.9.12 | 87 | 11/18/2024 |
1.9.11 | 78 | 11/18/2024 |
1.9.10 | 89 | 11/18/2024 |
1.9.9 | 83 | 11/18/2024 |
1.9.8 | 116 | 10/17/2024 |
1.9.7 | 84 | 10/16/2024 |
1.9.6 | 99 | 10/15/2024 |
1.9.5 | 106 | 10/10/2024 |
1.9.4 | 104 | 10/8/2024 |
1.9.3 | 108 | 9/21/2024 |
1.9.2 | 138 | 9/4/2024 |
1.9.1 | 119 | 9/3/2024 |
1.9.0 | 122 | 8/26/2024 |
1.8.3 | 132 | 8/22/2024 |
1.8.2 | 134 | 8/22/2024 |
1.8.1 | 138 | 8/17/2024 |
1.8.0 | 138 | 8/15/2024 |
1.7.9 | 65 | 7/31/2024 |
1.7.8 | 78 | 7/29/2024 |
1.7.7 | 93 | 7/29/2024 |
1.7.6 | 100 | 7/28/2024 |
1.7.5 | 107 | 7/26/2024 |
1.7.4 | 87 | 7/23/2024 |
1.7.3 | 129 | 7/21/2024 |
1.7.2 | 108 | 7/21/2024 |
1.7.1 | 106 | 7/21/2024 |
1.7.0 | 106 | 7/20/2024 |
1.6.5 | 137 | 7/5/2024 |
1.6.4 | 140 | 6/20/2024 |
1.6.3 | 119 | 6/15/2024 |
1.6.2 | 120 | 6/15/2024 |
1.6.1 | 102 | 6/14/2024 |
1.6.0 | 99 | 6/14/2024 |
1.5.2 | 104 | 6/11/2024 |
1.5.1 | 97 | 6/11/2024 |
1.5.0 | 111 | 6/6/2024 |
1.4.1 | 116 | 6/5/2024 |
1.4.0 | 105 | 6/3/2024 |
1.3.0 | 111 | 5/29/2024 |
0.0.1 | 111 | 5/29/2024 |