Skip to content

Instantly share code, notes, and snippets.

View jonnyli1125's full-sized avatar

Jonny Li jonnyli1125

View GitHub Profile
@jonnyli1125
jonnyli1125 / convert.txt
Created January 27, 2013 19:26
How to convert Minecraft player position and look packets to more readable values.
x = (player.x / 32)
y = (player.y / 32)
z = (player.z / 32)
pitch = round((double)(player.pitch * (360 / 256)))
yaw = round((double)((-(sbyte)(player.yaw)) * (360 / 256)))
@jonnyli1125
jonnyli1125 / OnGround.cs
Created December 25, 2012 05:10
MCDawn - Player.OnGround
public static bool OnGround(Player p) {
if (!Block.Walkthrough(p.level.GetTile((ushort)(p.pos[0] / 32), (ushort)((p.pos[1] / 32) - 2), (ushort)(p.pos[2] / 32)))) return true;
return false;
}
@jonnyli1125
jonnyli1125 / MerryHaxmas.txt
Created December 19, 2012 17:34
Merry Haxmas!
,
_/^\_
< hax >
/.-.\
* MERRY * `/&\`
,@.*;@,
/_o.I %_\
(`'--:o(_@;
/`;--.,__ `')
;@`o % O,*`'`&\
@jonnyli1125
jonnyli1125 / gist:4188092
Created December 2, 2012 10:29
Integer Square Root
public static int IntSqrt(int num) // Faster than Math.Sqrt, because that uses doubles.
{
if (num < 0) throw new Exception("Cannot get square root of negative number.");
if (0 == num) return 0; // Avoid zero divide
int n = (num / 2) + 1; // Initial estimate, never low
int n1 = (n + (num / n)) / 2;
while (n1 < n)
{
n = n1;
n1 = (n + (num / n)) / 2;
@jonnyli1125
jonnyli1125 / PluginFormat.cs
Created August 27, 2012 08:50
MCDawn Plugin Format
using System;
namespace MCDawn
{
public class PluginName : Plugin
{
public override string Name { get { return "pluginname"; } } // name, all in lowercase
public override string PluginVersion { get { return "1.0"; } } // version
public override string MCDawnVersion { get { return "1.0.1.2"; } } // compatible mcdawn version
public override void LoadPlugin()