summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/CraftingManager.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java10
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java130
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java8
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java2
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java7
-rw-r--r--src/main/java/net/minecraft/server/PlayerInstance.java5
-rw-r--r--src/main/java/net/minecraft/server/World.java42
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java2
11 files changed, 128 insertions, 96 deletions
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index 5280be20..9bbb1c8e 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -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});
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index acec874e..a85f74b9 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -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);
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 69865424..178c9270 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -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) {
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 171a0d1a..57727cab 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -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;
- }
+ 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;
+ }
+ }
- 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));
- }
+ // 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);
- 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();
- }
+ if (event.isCancelled()) {
+ return EnumBedError.OTHER_PROBLEM;
+ }
+ }
+ // CraftBukkit end
- return EnumBedError.OK;
- } else {
- return EnumBedError.TOO_FAR_AWAY;
+ 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 {
- return EnumBedError.OTHER_PROBLEM;
+ 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) {
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 81a06ebf..f55f7dd7 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -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;
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 396ae45a..8263af85 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -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);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 48eb00ba..c4a0d363 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -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\"");
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index ab59e044..f643f8d9 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -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;
diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java
index 5f898097..fe5f2fb0 100644
--- a/src/main/java/net/minecraft/server/PlayerInstance.java
+++ b/src/main/java/net/minecraft/server/PlayerInstance.java
@@ -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;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5e27de7d..9f698e23 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1482,33 +1482,33 @@ 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;
- }
+ if (this.b(k1, l1).g()) {
+ return;
+ }
- for (int k2 = 0; k2 < j2; ++k2) {
- MetadataChunkBlock metadatachunkblock = (MetadataChunkBlock) this.C.get(this.C.size() - k2 - 1);
+ int i2 = this.C.size();
+ int j2;
- if (metadatachunkblock.a == enumskyblock && metadatachunkblock.a(i, j, k, l, i1, j1)) {
- return;
- }
- }
+ if (flag) {
+ j2 = 5;
+ if (j2 > i2) {
+ j2 = i2;
}
- 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();
+ 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;
+ }
}
+ }
- 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;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9355786e..dd35d245 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -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);