Updated CraftBukkit to 1.2

By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2012-03-01 10:49:23 +00:00
parent d61b0b611f
commit 5c717f8732
9 changed files with 41 additions and 23 deletions

View file

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.1-R6-SNAPSHOT</version>
<version>1.2.2-R0-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
@ -51,14 +51,14 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.1-R6</version>
<version>1.2.2-R0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.1_02</version>
<version>1.2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View file

@ -15,6 +15,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.ChunkSnapshot;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.WorldChunkManager;
import org.apache.commons.lang.NotImplementedException;
public class CraftChunk implements Chunk {
private WeakReference<net.minecraft.server.Chunk> weakChunk;
@ -135,9 +136,11 @@ public class CraftChunk implements Chunk {
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
net.minecraft.server.Chunk chunk = getHandle();
byte[] buf = new byte[32768 + 16384 + 16384 + 16384]; // Get big enough buffer for whole chunk
chunk.getData(buf, 0, 0, 0, 16, 128, 16, 0); // Get whole chunk
//chunk.getData(buf, 0, 0, 0, 16, 128, 16, 0); // Get whole chunk
byte[] hmap = null;
if (true) throw new NotImplementedException("Chunk snapshots do not yet work"); // TODO: Snapshots.
if (includeMaxblocky) {
hmap = new byte[256]; // Get copy of height map
System.arraycopy(chunk.heightMap, 0, hmap, 0, 256);

View file

@ -939,11 +939,11 @@ public class CraftWorld implements World {
}
public int getMaxHeight() {
return world.height;
return world.getHeight();
}
public int getSeaLevel() {
return world.seaLevel;
return 64;
}
public boolean getKeepSpawnInMemory() {

View file

@ -87,7 +87,7 @@ public class PortalTravelAgent implements TravelAgent {
for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) {
double d3 = (double) k1 + 0.5D - location.getZ();
for (int l1 = world.height - 1; l1 >= 0; --l1) {
for (int l1 = 127; l1 >= 0; --l1) {
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
--l1;
@ -194,7 +194,7 @@ public class PortalTravelAgent implements TravelAgent {
d2 = (double) j2 + 0.5D - location.getZ();
label271:
for (l2 = world.height - 1; l2 >= 0; --l2) {
for (l2 = 127; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@ -245,7 +245,7 @@ public class PortalTravelAgent implements TravelAgent {
d2 = (double) j2 + 0.5D - location.getZ();
label219:
for (l2 = world.height - 1; l2 >= 0; --l2) {
for (l2 = 127; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@ -306,8 +306,8 @@ public class PortalTravelAgent implements TravelAgent {
i1 = 70;
}
if (i1 > world.height - 10) {
i1 = world.height - 10;
if (i1 > 118) {
i1 = 118;
}
j5 = i1;
@ -353,8 +353,8 @@ public class PortalTravelAgent implements TravelAgent {
i1 = 70;
}
if (i1 > world.height - 10) {
i1 = world.height - 10;
if (i1 > 118) {
i1 = 118;
}
j5 = i1;

View file

@ -399,6 +399,8 @@ public class CraftBlock implements Block {
BIOME_MAPPING[BiomeBase.FOREST_HILLS.id] = Biome.FOREST_HILLS;
BIOME_MAPPING[BiomeBase.TAIGA_HILLS.id] = Biome.TAIGA_HILLS;
BIOME_MAPPING[BiomeBase.SMALL_MOUNTAINS.id] = Biome.SMALL_MOUNTAINS;
BIOME_MAPPING[BiomeBase.JUNGLE.id] = Biome.JUNGLE;
BIOME_MAPPING[BiomeBase.JUNGLE_HILLS.id] = Biome.JUNGLE_HILLS;
/* Sanity check - we should have a record for each record in the BiomeBase.a table */
/* Helps avoid missed biomes when we upgrade bukkit to new code with new biomes */
for (int i = 0; i < BIOME_MAPPING.length; i++) {

View file

@ -18,7 +18,7 @@ public class CraftCreature extends CraftLivingEntity implements Creature {
} else if (target instanceof CraftLivingEntity) {
EntityLiving victim = ((CraftLivingEntity) target).getHandle();
entity.target = victim;
entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F);
entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F, true, false, false, true);
}
}

View file

@ -31,6 +31,7 @@ import net.minecraft.server.Packet61WorldEvent;
import net.minecraft.server.Packet6SpawnPosition;
import net.minecraft.server.Packet70Bed;
import net.minecraft.server.WorldServer;
import org.apache.commons.lang.NotImplementedException;
import org.bukkit.Achievement;
import org.bukkit.Material;
import org.bukkit.Statistic;
@ -286,6 +287,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data) {
if (getHandle().netServerHandler == null) return false;
/*
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
@ -310,6 +312,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().netServerHandler.sendPacket(packet);
return true;
*/
throw new NotImplementedException("Chunk changes do not yet work"); // TODO: Chunk changes.
}
public void sendMap(MapView map) {
@ -798,4 +803,4 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void disconnect(String reason) {
conversationTracker.abandonAllConversations();
}
}
}

View file

@ -81,15 +81,9 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
}
public List<?> getMobsFor(EnumCreatureType type, int x, int y, int z) {
WorldChunkManager worldchunkmanager = world.getWorldChunkManager();
BiomeBase biomebase = world.getBiome(x, z);
if (worldchunkmanager == null) {
return null;
} else {
BiomeBase biomebase = worldchunkmanager.getBiome(new ChunkCoordIntPair(x >> 4, z >> 4));
return biomebase == null ? null : biomebase.getMobs(type);
}
return biomebase == null ? null : biomebase.getMobs(type);
}
public ChunkPosition findNearestMapFeature(World world, String type, int x, int y, int z) {

View file

@ -73,6 +73,20 @@ public class CraftInventoryCustom extends CraftInventory {
return result;
}
public ItemStack splitWithoutUpdate(int i) {
ItemStack stack = this.getItem(i);
ItemStack result;
if (stack == null) return null;
if (stack.count <= 1) {
this.setItem(i, null);
result = stack;
} else {
result = new ItemStack(stack.id, 1, stack.getData());
stack.count -= 1;
}
return result;
}
public void setItem(int i, ItemStack itemstack) {
items[i] = itemstack;
}