Updated CraftBukkit to 1.2
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.1-R6-SNAPSHOT</version>
|
<version>1.2.2-R0-SNAPSHOT</version>
|
||||||
<name>CraftBukkit</name>
|
<name>CraftBukkit</name>
|
||||||
<url>http://www.bukkit.org</url>
|
<url>http://www.bukkit.org</url>
|
||||||
|
|
||||||
@@ -51,14 +51,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.1-R6</version>
|
<version>1.2.2-R0-SNAPSHOT</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>minecraft-server</artifactId>
|
<artifactId>minecraft-server</artifactId>
|
||||||
<version>1.1_02</version>
|
<version>1.2.2</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
import net.minecraft.server.BiomeBase;
|
import net.minecraft.server.BiomeBase;
|
||||||
import net.minecraft.server.WorldChunkManager;
|
import net.minecraft.server.WorldChunkManager;
|
||||||
|
import org.apache.commons.lang.NotImplementedException;
|
||||||
|
|
||||||
public class CraftChunk implements Chunk {
|
public class CraftChunk implements Chunk {
|
||||||
private WeakReference<net.minecraft.server.Chunk> weakChunk;
|
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) {
|
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||||
net.minecraft.server.Chunk chunk = getHandle();
|
net.minecraft.server.Chunk chunk = getHandle();
|
||||||
byte[] buf = new byte[32768 + 16384 + 16384 + 16384]; // Get big enough buffer for whole chunk
|
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;
|
byte[] hmap = null;
|
||||||
|
|
||||||
|
if (true) throw new NotImplementedException("Chunk snapshots do not yet work"); // TODO: Snapshots.
|
||||||
|
|
||||||
if (includeMaxblocky) {
|
if (includeMaxblocky) {
|
||||||
hmap = new byte[256]; // Get copy of height map
|
hmap = new byte[256]; // Get copy of height map
|
||||||
System.arraycopy(chunk.heightMap, 0, hmap, 0, 256);
|
System.arraycopy(chunk.heightMap, 0, hmap, 0, 256);
|
||||||
|
|||||||
@@ -939,11 +939,11 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxHeight() {
|
public int getMaxHeight() {
|
||||||
return world.height;
|
return world.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSeaLevel() {
|
public int getSeaLevel() {
|
||||||
return world.seaLevel;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getKeepSpawnInMemory() {
|
public boolean getKeepSpawnInMemory() {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||||||
for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) {
|
for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) {
|
||||||
double d3 = (double) k1 + 0.5D - location.getZ();
|
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) {
|
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
|
||||||
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
|
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
|
||||||
--l1;
|
--l1;
|
||||||
@@ -194,7 +194,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||||||
d2 = (double) j2 + 0.5D - location.getZ();
|
d2 = (double) j2 + 0.5D - location.getZ();
|
||||||
|
|
||||||
label271:
|
label271:
|
||||||
for (l2 = world.height - 1; l2 >= 0; --l2) {
|
for (l2 = 127; l2 >= 0; --l2) {
|
||||||
if (world.isEmpty(i2, l2, j2)) {
|
if (world.isEmpty(i2, l2, j2)) {
|
||||||
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
|
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
|
||||||
--l2;
|
--l2;
|
||||||
@@ -245,7 +245,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||||||
d2 = (double) j2 + 0.5D - location.getZ();
|
d2 = (double) j2 + 0.5D - location.getZ();
|
||||||
|
|
||||||
label219:
|
label219:
|
||||||
for (l2 = world.height - 1; l2 >= 0; --l2) {
|
for (l2 = 127; l2 >= 0; --l2) {
|
||||||
if (world.isEmpty(i2, l2, j2)) {
|
if (world.isEmpty(i2, l2, j2)) {
|
||||||
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
|
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
|
||||||
--l2;
|
--l2;
|
||||||
@@ -306,8 +306,8 @@ public class PortalTravelAgent implements TravelAgent {
|
|||||||
i1 = 70;
|
i1 = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i1 > world.height - 10) {
|
if (i1 > 118) {
|
||||||
i1 = world.height - 10;
|
i1 = 118;
|
||||||
}
|
}
|
||||||
|
|
||||||
j5 = i1;
|
j5 = i1;
|
||||||
@@ -353,8 +353,8 @@ public class PortalTravelAgent implements TravelAgent {
|
|||||||
i1 = 70;
|
i1 = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i1 > world.height - 10) {
|
if (i1 > 118) {
|
||||||
i1 = world.height - 10;
|
i1 = 118;
|
||||||
}
|
}
|
||||||
|
|
||||||
j5 = i1;
|
j5 = i1;
|
||||||
|
|||||||
@@ -399,6 +399,8 @@ public class CraftBlock implements Block {
|
|||||||
BIOME_MAPPING[BiomeBase.FOREST_HILLS.id] = Biome.FOREST_HILLS;
|
BIOME_MAPPING[BiomeBase.FOREST_HILLS.id] = Biome.FOREST_HILLS;
|
||||||
BIOME_MAPPING[BiomeBase.TAIGA_HILLS.id] = Biome.TAIGA_HILLS;
|
BIOME_MAPPING[BiomeBase.TAIGA_HILLS.id] = Biome.TAIGA_HILLS;
|
||||||
BIOME_MAPPING[BiomeBase.SMALL_MOUNTAINS.id] = Biome.SMALL_MOUNTAINS;
|
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 */
|
/* 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 */
|
/* Helps avoid missed biomes when we upgrade bukkit to new code with new biomes */
|
||||||
for (int i = 0; i < BIOME_MAPPING.length; i++) {
|
for (int i = 0; i < BIOME_MAPPING.length; i++) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class CraftCreature extends CraftLivingEntity implements Creature {
|
|||||||
} else if (target instanceof CraftLivingEntity) {
|
} else if (target instanceof CraftLivingEntity) {
|
||||||
EntityLiving victim = ((CraftLivingEntity) target).getHandle();
|
EntityLiving victim = ((CraftLivingEntity) target).getHandle();
|
||||||
entity.target = victim;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.minecraft.server.Packet61WorldEvent;
|
|||||||
import net.minecraft.server.Packet6SpawnPosition;
|
import net.minecraft.server.Packet6SpawnPosition;
|
||||||
import net.minecraft.server.Packet70Bed;
|
import net.minecraft.server.Packet70Bed;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
|
import org.apache.commons.lang.NotImplementedException;
|
||||||
import org.bukkit.Achievement;
|
import org.bukkit.Achievement;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Statistic;
|
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) {
|
public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data) {
|
||||||
if (getHandle().netServerHandler == null) return false;
|
if (getHandle().netServerHandler == null) return false;
|
||||||
|
|
||||||
|
/*
|
||||||
int x = loc.getBlockX();
|
int x = loc.getBlockX();
|
||||||
int y = loc.getBlockY();
|
int y = loc.getBlockY();
|
||||||
int z = loc.getBlockZ();
|
int z = loc.getBlockZ();
|
||||||
@@ -310,6 +312,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
getHandle().netServerHandler.sendPacket(packet);
|
getHandle().netServerHandler.sendPacket(packet);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
*/
|
||||||
|
|
||||||
|
throw new NotImplementedException("Chunk changes do not yet work"); // TODO: Chunk changes.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMap(MapView map) {
|
public void sendMap(MapView map) {
|
||||||
|
|||||||
@@ -81,16 +81,10 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<?> getMobsFor(EnumCreatureType type, int x, int y, int z) {
|
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) {
|
public ChunkPosition findNearestMapFeature(World world, String type, int x, int y, int z) {
|
||||||
return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, x, y, z) : null;
|
return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, x, y, z) : null;
|
||||||
|
|||||||
@@ -73,6 +73,20 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||||||
return result;
|
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) {
|
public void setItem(int i, ItemStack itemstack) {
|
||||||
items[i] = itemstack;
|
items[i] = itemstack;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user