Update for 1.6.6

This commit is contained in:
Erik Broes 2011-05-31 15:55:45 +02:00
parent 6dbd710bbf
commit 62b5da4e3a
12 changed files with 137 additions and 105 deletions

View File

@ -39,7 +39,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.6.5</version>
<version>1.6.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View File

@ -31,8 +31,8 @@ public class CraftingManager {
this.a(new ItemStack(Block.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.SNOW_BALL});
this.a(new ItemStack(Block.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BALL});
this.a(new ItemStack(Block.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BRICK});
this.a(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "###", "###", "###", Character.valueOf('#'), Item.GLOWSTONE_DUST});
this.a(new ItemStack(Block.WOOL, 1), new Object[] { "###", "###", "###", Character.valueOf('#'), Item.STRING});
this.a(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
this.a(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
this.a(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
this.a(new ItemStack(Block.STEP, 3, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
this.a(new ItemStack(Block.STEP, 3, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});

View File

@ -89,7 +89,9 @@ public class EntityArrow extends Entity {
if (i > 0) {
Block.byId[i].a(this.world, this.d, this.e, this.f);
if (Block.byId[i].d(this.world, this.d, this.e, this.f) != null && Block.byId[i].d(this.world, this.d, this.e, this.f).a(Vec3D.create(this.locX, this.locY, this.locZ))) {
AxisAlignedBB axisalignedbb = Block.byId[i].d(this.world, this.d, this.e, this.f);
if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) {
this.i = true;
}
}
@ -138,8 +140,8 @@ public class EntityArrow extends Entity {
if (entity1.n_() && (entity1 != this.shooter || this.k >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
if (movingobjectposition1 != null) {
double d1 = vec3d.a(movingobjectposition1.f);

View File

@ -129,6 +129,10 @@ public class EntityBoat extends Entity {
}
// CraftBukkit end
if (this.passenger != null) {
this.passenger.mount(this);
}
int j;
for (j = 0; j < 3; ++j) {
@ -230,7 +234,11 @@ public class EntityBoat extends Entity {
d3 = d0 * 2.0D - 1.0D;
this.motY += 0.03999999910593033D * d3;
} else {
this.motY += 0.0010000000474974513D;
if (this.motY < 0.0D) {
this.motY /= 2.0D;
}
this.motY += 0.007000000216066837D;
}
if (this.passenger != null) {

View File

@ -78,10 +78,12 @@ public abstract class EntityHuman extends EntityLiving {
this.sleepTicks = 100;
}
if (!this.o()) {
this.a(true, true, false);
} else if (!this.world.isStatic && this.world.d()) {
this.a(false, true, true);
if (!this.world.isStatic) {
if (!this.o()) {
this.a(true, true, false);
} else if (this.world.d()) {
this.a(false, true, true);
}
}
} else if (this.sleepTicks > 0) {
++this.sleepTicks;
@ -375,7 +377,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.health <= 0) {
return false;
} else {
if (this.isSleeping()) {
if (this.isSleeping() && !this.world.isStatic) {
this.a(true, true, false);
}
@ -568,72 +570,78 @@ public abstract class EntityHuman extends EntityLiving {
}
public EnumBedError a(int i, int j, int k) {
if (!this.isSleeping() && this.S()) {
if (!this.world.isStatic) {
if (this.isSleeping() || !this.S()) {
return EnumBedError.OTHER_PROBLEM;
}
if (this.world.worldProvider.c) {
return EnumBedError.NOT_POSSIBLE_HERE;
} else if (this.world.d()) {
}
if (this.world.d()) {
return EnumBedError.NOT_POSSIBLE_NOW;
} else if (Math.abs(this.locX - (double) i) <= 3.0D && Math.abs(this.locY - (double) j) <= 2.0D && Math.abs(this.locZ - (double) k) <= 3.0D) {
// CraftBukkit start
if (this.getBukkitEntity() instanceof Player) {
Player player = (Player) this.getBukkitEntity();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
server.getPluginManager().callEvent(event);
}
if (event.isCancelled()) {
return EnumBedError.OTHER_PROBLEM;
}
}
// CraftBukkit end
this.b(0.2F, 0.2F);
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
int i1 = BlockBed.c(l);
float f = 0.5F;
float f1 = 0.5F;
switch (i1) {
case 0:
f1 = 0.9F;
break;
case 1:
f = 0.1F;
break;
case 2:
f1 = 0.1F;
break;
case 3:
f = 0.9F;
}
this.e(i1);
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
} else {
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
}
this.sleeping = true;
this.sleepTicks = 0;
this.A = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
}
return EnumBedError.OK;
} else {
if (Math.abs(this.locX - (double) i) > 3.0D || Math.abs(this.locY - (double) j) > 2.0D || Math.abs(this.locZ - (double) k) > 3.0D) {
return EnumBedError.TOO_FAR_AWAY;
}
} else {
return EnumBedError.OTHER_PROBLEM;
}
// CraftBukkit start
if (this.getBukkitEntity() instanceof Player) {
Player player = (Player) this.getBukkitEntity();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return EnumBedError.OTHER_PROBLEM;
}
}
// CraftBukkit end
this.b(0.2F, 0.2F);
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
int i1 = BlockBed.c(l);
float f = 0.5F;
float f1 = 0.5F;
switch (i1) {
case 0:
f1 = 0.9F;
break;
case 1:
f = 0.1F;
break;
case 2:
f1 = 0.1F;
break;
case 3:
f = 0.9F;
}
this.e(i1);
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
} else {
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
}
this.sleeping = true;
this.sleepTicks = 0;
this.A = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
}
return EnumBedError.OK;
}
private void e(int i) {

View File

@ -298,9 +298,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (enumbederror == EnumBedError.OK) {
EntityTracker entitytracker = this.b.b(this.dimension);
Packet17 packet17 = new Packet17(this, 0, i, j, k);
// CraftBukkit - this is not the original method called
entitytracker.b(this, new Packet17(this, 0, i, j, k));
entitytracker.a(this, packet17);
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.netServerHandler.sendPacket(packet17);
}
return enumbederror;

View File

@ -179,6 +179,14 @@ public class EntityTrackerEntry {
entityplayer.netServerHandler.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, aitemstack[i]));
}
}
if (this.tracker instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) this.tracker;
if (entityhuman.isSleeping()) {
entityplayer.netServerHandler.sendPacket(new Packet17(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
}
}
}
} else if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer);

View File

@ -86,7 +86,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end
log.info("Starting minecraft server version Beta 1.6.5");
log.info("Starting minecraft server version Beta 1.6.6");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("**** NOT ENOUGH RAM!");
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");

View File

@ -240,6 +240,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
if (this.player.isSleeping()) {
this.player.a(true);
this.player.setLocation(this.x, this.y, this.z, this.player.yaw, this.player.pitch);
worldserver.playerJoinedWorld(this.player);
return;
}
d0 = this.player.locY;
this.x = this.player.locX;
this.y = this.player.locY;

View File

@ -47,10 +47,7 @@ class PlayerInstance {
}
public void b(EntityPlayer entityplayer) {
if (!this.b.contains(entityplayer)) {
// CraftBukkit - reduce console spam under certain conditions
// (new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.bF + ", " + this.bH)).printStackTrace();
} else {
if (this.b.contains(entityplayer)) {
this.b.remove(entityplayer);
if (this.b.size() == 0) {
long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32;

View File

@ -1482,34 +1482,34 @@ public class World implements IBlockAccess {
return;
}
if (!this.b(k1, l1).g()) {
int i2 = this.C.size();
int j2;
if (flag) {
j2 = 5;
if (j2 > i2) {
j2 = i2;
}
for (int k2 = 0; k2 < j2; ++k2) {
MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.C.get(this.C.size() - k2 - 1);
if (metadatachunkblock.a == enumskyblock && metadatachunkblock.a(i, j, k, l, i1, j1)) {
return;
}
}
}
this.C.add(new MetadataChunkBlock(enumskyblock, i, j, k, l, i1, j1));
j2 = 1000000;
if (this.C.size() > 1000000) {
System.out.println("More than " + j2 + " updates, aborting lighting updates");
this.C.clear();
}
if (this.b(k1, l1).g()) {
return;
}
int i2 = this.C.size();
int j2;
if (flag) {
j2 = 5;
if (j2 > i2) {
j2 = i2;
}
for (int k2 = 0; k2 < j2; ++k2) {
MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.C.get(this.C.size() - k2 - 1);
if (metadatachunkblock.a == enumskyblock && metadatachunkblock.a(i, j, k, l, i1, j1)) {
return;
}
}
}
this.C.add(new MetadataChunkBlock(enumskyblock, i, j, k, l, i1, j1));
j2 = 1000000;
if (this.C.size() > 1000000) {
System.out.println("More than " + j2 + " updates, aborting lighting updates");
this.C.clear();
}
} finally {
--A;
}

View File

@ -59,7 +59,7 @@ import org.bukkit.util.config.Configuration;
public final class CraftServer implements Server {
private final String serverName = "Craftbukkit";
private final String serverVersion;
private final String protocolVersion = "1.6.5";
private final String protocolVersion = "1.6.6";
private final PluginManager pluginManager = new SimplePluginManager(this);
private final ServicesManager servicesManager = new SimpleServicesManager();
private final BukkitScheduler scheduler = new CraftScheduler(this);