Skip to content

Instantly share code, notes, and snippets.

View NiclasOlofsson's full-sized avatar

Niclas Olofsson NiclasOlofsson

View GitHub Profile
@NiclasOlofsson
NiclasOlofsson / helpcommand.js
Created October 29, 2016 16:56
FULL COMMAND /help EXAMPLE WITH VANILLA
{
"commandName": "help",
"commandOverload": "byPage",
"unkown1": 0,
"unkown2": 0,
"unkown4": false,
"unkown5": -1,
"commandJson": "null\n",
"unkown6": "null\n",
"unkown7": 0,
@NiclasOlofsson
NiclasOlofsson / Wither trace
Created October 18, 2016 15:38
Trace of wither fight, more or less complete, but missing parts ..
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - > Receive: 14: McpeAddEntity (0x0e)
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - McpeAddEntity Entity ID: 566935683067
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - McpeAddEntity Runtime Entity ID: 5
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - Entity Type: 68404
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - X: 47.82257
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - Y: 9.062544
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - Z: 6.522105
2016-10-16 22:51:18,592 DEBUG MiNET.Client.MiNetClient - Yaw: 21.11277
@NiclasOlofsson
NiclasOlofsson / pokemon.json
Last active July 17, 2016 11:27
Pokemon GO protocol
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@NiclasOlofsson
NiclasOlofsson / Hologram.cs
Last active July 2, 2016 16:26
Hologram class based on invisible players.
public class Hologram : Mob
{
public UUID Uuid { get; private set; }
public string Name { get; private set; }
public bool Silent { get; set; }
public bool HideNameTag { get; set; }
public bool NoAi { get; set; }
public Hologram(Level level) : base(63, level)
{
@NiclasOlofsson
NiclasOlofsson / ecdh.cs
Last active April 20, 2016 15:37
ECDH key import
var clientKey = CreateEcDiffieHellmanPublicKey("MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDEKneqEvcqUqqFMM1HM1A4zWjJC+I8Y+aKzG5dl+6wNOHHQ4NmG2PEXRJYhujyodFH+wO0dEr4GM1WoaWog8xsYQ6mQJAC0eVpBM96spUB1eMN56+BwlJ4H3Qx4TAvAs");
private ECDiffieHellmanPublicKey CreateEcDiffieHellmanPublicKey(string clientPubKeyString)
{
byte[] clientPublicKeyBlob = Base64Url.Decode(clientPubKeyString);
clientPublicKeyBlob = FixPublicKey(clientPublicKeyBlob.Skip(23).ToArray());
ECDiffieHellmanPublicKey clientKey = ECDiffieHellmanCngPublicKey.FromByteArray(clientPublicKeyBlob, CngKeyBlobFormat.EccPublicBlob);
return clientKey;
}
@NiclasOlofsson
NiclasOlofsson / gist:f07edb6df8de8ebc3a90
Created March 9, 2015 18:21
MiNET login command in plugin.
[Plugin("CoreCommands", "The core commands for MiNET", "1.0", "MiNET Team")]
public class CoreCommands : Plugin
{
[Command]
public void Login(Player player, string password)
{
UserManager<User> userManager = player.Server.UserManager;
if (userManager != null)
{
if (player.Username == null) return;
public class TextEntity : Entity
{
public TextEntity(Level level, string text, Vector3 pos) : base(64, level)
{
NameTag = text;
KnownPosition = new PlayerLocation(pos);
HealthManager = new NoDamageHealthManager(this);
}
public override void OnTick()
@NiclasOlofsson
NiclasOlofsson / Plugin.cs
Last active December 26, 2015 19:08
MiNET configuration using JSON
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Xml.Serialization;
using log4net;
using MiNET.Plugins;
@NiclasOlofsson
NiclasOlofsson / server.conf
Created June 16, 2015 14:20
Example server.conf
#DO NOT REMOVE THIS LINE - MiNET Config
#WorldProvider=anvil
WorldProvider=flat
ViewDistance=250
#PCWorldFolder=D:\Downloads\KingsLanding1\KingsLanding1
#PCWaterOffset=30
#PCWorldFolder=D:\Development\Worlds\MiniGames\Capture the flag
#PCWorldFolder=D:\Development\Worlds\MiniGames\Castle Wars
#PCWorldFolder=D:\Development\Worlds\MiniGames\King of the hill
using System.Collections.Generic;
using System.Threading.Tasks;
using MiNET;
using MiNET.BlockEntities;
using MiNET.Blocks;
using MiNET.Utils;
using MiNET.Worlds;
namespace TestPlugin.MobHunt
{