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> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.6.5</version> <version>1.6.6</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </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.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.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.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.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.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.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, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
this.a(new ItemStack(Block.STEP, 3, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE}); 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) { if (i > 0) {
Block.byId[i].a(this.world, this.d, this.e, this.f); 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; this.i = true;
} }
} }
@ -138,8 +140,8 @@ public class EntityArrow extends Entity {
if (entity1.n_() && (entity1 != this.shooter || this.k >= 5)) { if (entity1.n_() && (entity1 != this.shooter || this.k >= 5)) {
f1 = 0.3F; f1 = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.a(movingobjectposition1.f); double d1 = vec3d.a(movingobjectposition1.f);

View File

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

View File

@ -78,10 +78,12 @@ public abstract class EntityHuman extends EntityLiving {
this.sleepTicks = 100; this.sleepTicks = 100;
} }
if (!this.o()) { if (!this.world.isStatic) {
this.a(true, true, false); if (!this.o()) {
} else if (!this.world.isStatic && this.world.d()) { this.a(true, true, false);
this.a(false, true, true); } else if (this.world.d()) {
this.a(false, true, true);
}
} }
} else if (this.sleepTicks > 0) { } else if (this.sleepTicks > 0) {
++this.sleepTicks; ++this.sleepTicks;
@ -375,7 +377,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.health <= 0) { if (this.health <= 0) {
return false; return false;
} else { } else {
if (this.isSleeping()) { if (this.isSleeping() && !this.world.isStatic) {
this.a(true, true, false); this.a(true, true, false);
} }
@ -568,72 +570,78 @@ public abstract class EntityHuman extends EntityLiving {
} }
public EnumBedError a(int i, int j, int k) { 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) { if (this.world.worldProvider.c) {
return EnumBedError.NOT_POSSIBLE_HERE; return EnumBedError.NOT_POSSIBLE_HERE;
} else if (this.world.d()) { }
if (this.world.d()) {
return EnumBedError.NOT_POSSIBLE_NOW; 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()) { 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.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 {
return EnumBedError.TOO_FAR_AWAY; 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) { private void e(int i) {

View File

@ -298,9 +298,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (enumbederror == EnumBedError.OK) { if (enumbederror == EnumBedError.OK) {
EntityTracker entitytracker = this.b.b(this.dimension); 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.a(this, packet17);
entitytracker.b(this, new Packet17(this, 0, i, j, k)); this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.netServerHandler.sendPacket(packet17);
} }
return enumbederror; return enumbederror;

View File

@ -179,6 +179,14 @@ public class EntityTrackerEntry {
entityplayer.netServerHandler.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, aitemstack[i])); 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)) { } else if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(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)); System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end // 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) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("**** NOT ENOUGH RAM!"); log.warning("**** NOT ENOUGH RAM!");
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); 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; 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; d0 = this.player.locY;
this.x = this.player.locX; this.x = this.player.locX;
this.y = this.player.locY; this.y = this.player.locY;

View File

@ -47,10 +47,7 @@ class PlayerInstance {
} }
public void b(EntityPlayer entityplayer) { public void b(EntityPlayer entityplayer) {
if (!this.b.contains(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 {
this.b.remove(entityplayer); this.b.remove(entityplayer);
if (this.b.size() == 0) { if (this.b.size() == 0) {
long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32; long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32;

View File

@ -1482,34 +1482,34 @@ public class World implements IBlockAccess {
return; return;
} }
if (!this.b(k1, l1).g()) { 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();
}
return; 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 { } finally {
--A; --A;
} }

View File

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