Skip to content

Instantly share code, notes, and snippets.

@SpaceManiac
Created July 29, 2011 08:00
Show Gist options
  • Save SpaceManiac/1113415 to your computer and use it in GitHub Desktop.
Save SpaceManiac/1113415 to your computer and use it in GitHub Desktop.
public WorldMap a(ItemStack itemstack, World world) {
WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData());
if (worldmap == null) {
itemstack.b(world.b("map"));
String s = "map_" + itemstack.getData();
worldmap = new WorldMap(s);
worldmap.b = world.q().c();
worldmap.c = world.q().e();
worldmap.e = 3;
worldmap.map = (byte) world.worldProvider.dimension;
worldmap.a();
world.a(s, (WorldMapBase) worldmap);
// Insert event here
}
return worldmap;
}
// CraftBukkit start
for (i = 0; i < render.cursors.size(); ++i) {
MapCursor cursor = render.cursors.get(i);
if (!cursor.isVisible()) continue;
byte value = (byte) (((cursor.getType() == 0 || cursor.getDirection() < 8 ? cursor.getDirection() : cursor.getDirection() - 1) & 15) * 16);
abyte[i * 3 + 1] = (byte) (value | (value < 0 ? 16 - cursor.getType() : cursor.getType()));
abyte[i * 3 + 2] = (byte) cursor.getX();
abyte[i * 3 + 3] = (byte) cursor.getY();
}
// CraftBukkit end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment