summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-10-24 22:53:23 -0500
committerEvilSeph <evilseph@gmail.com>2012-10-27 22:19:03 -0400
commit60819c6693daf19dde68b04af38a4fee8c7da988 (patch)
treee7bd96a07f0e9d9f1f6b2721ddd1bb5dd71eaf48 /src/main/java/org/bukkit
parentb9a72531b6e2ccc84bd021bca421255a957d96f7 (diff)
downloadcraftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar
craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.gz
craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.lz
craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.xz
craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.zip
Update CraftBukkit to Minecraft 1.4(.2).
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java14
-rw-r--r--src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java3
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java83
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java11
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java58
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java4
27 files changed, 362 insertions, 92 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 853c240b..24b20f12 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -731,10 +731,6 @@ public final class CraftServer implements Server {
ChunkCoordinates chunkcoordinates = internal.getSpawn();
internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4);
-
- while (internal.updateLights()) {
- ;
- }
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a8c8a609..46027e84 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -429,16 +429,20 @@ public class CraftWorld implements World {
CraftPlayer cp = (CraftPlayer) p;
if (cp.getHandle().netServerHandler == null) continue;
- cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime()));
+ cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime(), cp.getHandle().world.F()));
}
}
public boolean createExplosion(double x, double y, double z, float power) {
- return createExplosion(x, y, z, power, false);
+ return createExplosion(x, y, z, power, false, true);
}
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
- return !world.createExplosion(null, x, y, z, power, setFire).wasCanceled;
+ return createExplosion(x, y, z, power, setFire, true);
+ }
+
+ public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) {
+ return !world.createExplosion(null, x, y, z, power, setFire, breakBlocks).wasCanceled;
}
public boolean createExplosion(Location loc, float power) {
@@ -755,7 +759,7 @@ public class CraftWorld implements World {
Validate.notNull(effect, "Effect cannot be null");
Validate.notNull(location.getWorld(), "World cannot be null");
int packetData = effect.getId();
- Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
+ Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false);
int distance;
radius *= radius;
@@ -834,7 +838,7 @@ public class CraftWorld implements World {
if (SmallFireball.class.isAssignableFrom(clazz)) {
entity = new EntitySmallFireball(world);
} else {
- entity = new EntityFireball(world);
+ entity = new EntityLargeFireball(world);
}
((EntityFireball) entity).setPositionRotation(x, y, z, yaw, pitch);
Vector direction = location.getDirection().multiply(10);
diff --git a/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java b/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java
index 47a3c787..e01e7366 100644
--- a/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java
+++ b/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java
@@ -93,7 +93,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.L() - 1; l1 >= 0; --l1) {
+ for (int l1 = world.O() - 1; l1 >= 0; --l1) {
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
--l1;
@@ -200,7 +200,7 @@ public class PortalTravelAgent implements TravelAgent {
d2 = (double) j2 + 0.5D - location.getZ();
label271:
- for (l2 = world.L() - 1; l2 >= 0; --l2) {
+ for (l2 = world.O() - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@@ -251,7 +251,7 @@ public class PortalTravelAgent implements TravelAgent {
d2 = (double) j2 + 0.5D - location.getZ();
label219:
- for (l2 = world.L() - 1; l2 >= 0; --l2) {
+ for (l2 = world.O() - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@@ -312,8 +312,8 @@ public class PortalTravelAgent implements TravelAgent {
i1 = 70;
}
- if (i1 > world.L() - 10) {
- i1 = world.L() - 10;
+ if (i1 > world.O() - 10) {
+ i1 = world.O() - 10;
}
j5 = i1;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 368cea99..c5c11fdd 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -372,7 +372,7 @@ public class CraftBlock implements Block {
for (int i = 0; i < count; ++i) {
int item = block.getDropType(data, chunk.getHandle().world.random, 0);
if (item > 0) {
- drops.add(new ItemStack(item, 1, (short) net.minecraft.server.Block.getDropData(block, data)));
+ drops.add(new ItemStack(item, 1, (short) block.getDropData(data)));
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
index dac99f3c..c94b43d1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
@@ -32,7 +32,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
if (block.getType() == Material.DISPENSER) {
BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER;
- dispense.dispense(world.getHandle(), getX(), getY(), getZ(), new Random());
+ dispense.dispense(world.getHandle(), getX(), getY(), getZ());
return true;
} else {
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java
index c42d9687..47c059c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.command;
import java.lang.reflect.Method;
+import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.ICommandListener;
import net.minecraft.server.LocaleLanguage;
@@ -39,7 +40,11 @@ public class ServerCommandListener implements ICommandListener {
return LocaleLanguage.a().a(s, aobject);
}
- public boolean b(String s) {
+ public boolean a(int i, String s) {
return true;
}
-} \ No newline at end of file
+
+ public ChunkCoordinates b() {
+ return new ChunkCoordinates(0, 0, 0);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java
new file mode 100644
index 00000000..086980e7
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityAmbient;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Ambient;
+import org.bukkit.entity.EntityType;
+
+public class CraftAmbient extends CraftLivingEntity implements Ambient {
+ public CraftAmbient(CraftServer server, EntityAmbient entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityAmbient getHandle() {
+ return (EntityAmbient) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftAmbient";
+ }
+
+ public EntityType getType() {
+ return EntityType.UNKNOWN;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
new file mode 100644
index 00000000..1e413cbe
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityBat;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Bat;
+import org.bukkit.entity.EntityType;
+
+public class CraftBat extends CraftAmbient implements Bat {
+ public CraftBat(CraftServer server, EntityBat entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityBat getHandle() {
+ return (EntityBat) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftBat";
+ }
+
+ public EntityType getType() {
+ return EntityType.BAT;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java
index 046f5755..cc115cc3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java
@@ -1,17 +1,17 @@
package org.bukkit.craftbukkit.entity;
-import net.minecraft.server.EntityComplex;
+import net.minecraft.server.EntityLiving;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ComplexLivingEntity;
public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity {
- public CraftComplexLivingEntity(CraftServer server, EntityComplex entity) {
+ public CraftComplexLivingEntity(CraftServer server, EntityLiving entity) {
super(server, entity);
}
@Override
- public EntityComplex getHandle() {
- return (EntityComplex) entity;
+ public EntityLiving getHandle() {
+ return (EntityLiving) entity;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java
index 3357b606..eb1ce797 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityComplexPart;
+import net.minecraft.server.EntityEnderDragon;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.ComplexLivingEntity;
@@ -13,7 +14,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
}
public ComplexLivingEntity getParent() {
- return (ComplexLivingEntity) getHandle().owner.getBukkitEntity();
+ return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().owner).getBukkitEntity();
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 67304366..e68edf10 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -65,6 +65,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityGiantZombie) { return new CraftGiant(server, (EntityGiantZombie) entity); }
else if (entity instanceof EntitySkeleton) { return new CraftSkeleton(server, (EntitySkeleton) entity); }
else if (entity instanceof EntityBlaze) { return new CraftBlaze(server, (EntityBlaze) entity); }
+ else if (entity instanceof EntityWitch) { return new CraftWitch(server, (EntityWitch) entity); }
+ else if (entity instanceof EntityWither) { return new CraftWither(server, (EntityWither) entity); }
else if (entity instanceof EntitySpider) {
if (entity instanceof EntityCaveSpider) { return new CraftCaveSpider(server, (EntityCaveSpider) entity); }
else { return new CraftSpider(server, (EntitySpider) entity); }
@@ -94,8 +96,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (entity instanceof EntityGhast) { return new CraftGhast(server, (EntityGhast) entity); }
else { return new CraftFlying(server, (EntityFlying) entity); }
}
- else if (entity instanceof EntityComplex) {
- if (entity instanceof EntityEnderDragon) { return new CraftEnderDragon(server, (EntityEnderDragon) entity); }
+ else if (entity instanceof EntityEnderDragon) {
+ return new CraftEnderDragon(server, (EntityEnderDragon) entity);
+ }
+ // Ambient
+ else if (entity instanceof EntityAmbient) {
+ if (entity instanceof EntityBat) { return new CraftBat(server, (EntityBat) entity); }
+ else { return new CraftAmbient(server, (EntityAmbient) entity); }
}
else { return new CraftLivingEntity(server, (EntityLiving) entity); }
}
@@ -117,6 +124,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityFallingBlock) { return new CraftFallingSand(server, (EntityFallingBlock) entity); }
else if (entity instanceof EntityFireball) {
if (entity instanceof EntitySmallFireball) { return new CraftSmallFireball(server, (EntitySmallFireball) entity); }
+ else if (entity instanceof EntityLargeFireball) { return new CraftLargeFireball(server, (EntityLargeFireball) entity); }
+ else if (entity instanceof EntityWitherSkull) { return new CraftWitherSkull(server, (EntityWitherSkull) entity); }
else { return new CraftFireball(server, (EntityFireball) entity); }
}
else if (entity instanceof EntityEnderSignal) { return new CraftEnderSignal(server, (EntityEnderSignal) entity); }
@@ -133,7 +142,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) { return new CraftPoweredMinecart(server, mc); }
else { return new CraftMinecart(server, mc); }
}
- else if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); }
+ else if (entity instanceof EntityHanging) {
+ if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); }
+ else if (entity instanceof EntityItemFrame) { return new CraftItemFrame(server, (EntityItemFrame) entity); }
+ else { return new CraftHanging(server, (EntityHanging) entity); }
+ }
else if (entity instanceof EntityTNTPrimed) { return new CraftTNTPrimed(server, (EntityTNTPrimed) entity); }
throw new IllegalArgumentException("Unknown entity");
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index 83e63153..b2df4f5b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -63,6 +63,6 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
}
public EntityType getType() {
- return EntityType.FIREBALL;
+ return EntityType.UNKNOWN;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
new file mode 100644
index 00000000..e2279e20
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
@@ -0,0 +1,83 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityHanging;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Hanging;
+
+public class CraftHanging extends CraftEntity implements Hanging {
+ public CraftHanging(CraftServer server, EntityHanging entity) {
+ super(server, entity);
+ }
+
+ public BlockFace getAttachedFace() {
+ return getFacing().getOppositeFace();
+ }
+
+ public void setFacingDirection(BlockFace face) {
+ setFacingDirection(face, false);
+ }
+
+ public boolean setFacingDirection(BlockFace face, boolean force) {
+ Block block = getLocation().getBlock().getRelative(getAttachedFace()).getRelative(face.getOppositeFace()).getRelative(getFacing());
+ EntityHanging hanging = getHandle();
+ int x = hanging.x, y = hanging.y, z = hanging.z, dir = hanging.direction;
+ hanging.x = block.getX();
+ hanging.y = block.getY();
+ hanging.z = block.getZ();
+ switch (face) {
+ case EAST:
+ default:
+ getHandle().setDirection(0);
+ break;
+ case NORTH:
+ getHandle().setDirection(1);
+ break;
+ case WEST:
+ getHandle().setDirection(2);
+ break;
+ case SOUTH:
+ getHandle().setDirection(3);
+ break;
+ }
+ if (!force && !hanging.survives()) {
+ // Revert since it doesn't fit
+ hanging.x = x;
+ hanging.y = y;
+ hanging.z = z;
+ hanging.setDirection(dir);
+ return false;
+ }
+ return true;
+ }
+
+ public BlockFace getFacing() {
+ switch (this.getHandle().direction) {
+ case 0:
+ default:
+ return BlockFace.EAST;
+ case 1:
+ return BlockFace.NORTH;
+ case 2:
+ return BlockFace.WEST;
+ case 3:
+ return BlockFace.SOUTH;
+ }
+ }
+
+ @Override
+ public EntityHanging getHandle() {
+ return (EntityHanging) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftHanging";
+ }
+
+ public EntityType getType() {
+ return EntityType.UNKNOWN;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 6f8bec6d..05f0abb9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -308,7 +308,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
public boolean isBlocking() {
- return getHandle().aY();
+ return getHandle().be();
}
public boolean setWindowProperty(InventoryView.Property prop, int value) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
index 684a38a9..08655eba 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
@@ -21,7 +21,7 @@ public class CraftIronGolem extends CraftGolem implements IronGolem {
}
public boolean isPlayerCreated() {
- return getHandle().q();
+ return getHandle().p();
}
public void setPlayerCreated(boolean playerCreated) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
new file mode 100644
index 00000000..b03bb679
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityItemFrame;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.ItemFrame;
+
+public class CraftItemFrame extends CraftHanging implements ItemFrame {
+ public CraftItemFrame(CraftServer server, EntityItemFrame entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityItemFrame getHandle() {
+ return (EntityItemFrame) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftItemFrame";
+ }
+
+ public EntityType getType() {
+ return EntityType.ITEM_FRAME;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java
new file mode 100644
index 00000000..770f2954
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityLargeFireball;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LargeFireball;
+
+public class CraftLargeFireball extends CraftFireball implements LargeFireball {
+ public CraftLargeFireball(CraftServer server, EntityLargeFireball entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityLargeFireball getHandle() {
+ return (EntityLargeFireball) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftLargeFireball";
+ }
+
+ public EntityType getType() {
+ return EntityType.LARGE_FIREBALL;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 8f9b565c..cff54eeb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -8,10 +8,11 @@ import java.util.List;
import net.minecraft.server.DamageSource;
import net.minecraft.server.EntityArrow;
-import net.minecraft.server.EntityComplex;
import net.minecraft.server.EntityEgg;
+import net.minecraft.server.EntityEnderDragon;
import net.minecraft.server.EntityEnderPearl;
import net.minecraft.server.EntityFireball;
+import net.minecraft.server.EntityLargeFireball;
import net.minecraft.server.EntityLiving;
import net.minecraft.server.EntitySmallFireball;
import net.minecraft.server.EntitySnowball;
@@ -160,8 +161,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
reason = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
}
- if (entity instanceof EntityComplex) {
- ((EntityComplex) entity).dealDamage(reason, amount);
+ if (entity instanceof EntityEnderDragon) {
+ ((EntityEnderDragon) entity).dealDamage(reason, amount);
} else {
entity.damageEntity(reason, amount);
}
@@ -279,7 +280,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new EntitySmallFireball(world);
} else {
- launch = new EntityFireball(world);
+ launch = new EntityLargeFireball(world);
}
Location location = getEyeLocation();
@@ -300,6 +301,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
public boolean hasLineOfSight(Entity other) {
- return getHandle().at().canSee(((CraftEntity) other).getHandle()); // am should be getEntitySenses
+ return getHandle().az().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
index 81390773..925a15f0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
@@ -5,7 +5,6 @@ import net.minecraft.server.EnumArt;
import net.minecraft.server.WorldServer;
import org.bukkit.Art;
-import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftArt;
import org.bukkit.craftbukkit.CraftServer;
@@ -13,7 +12,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Painting;
-public class CraftPainting extends CraftEntity implements Painting {
+public class CraftPainting extends CraftHanging implements Painting {
public CraftPainting(CraftServer server, EntityPainting entity) {
super(server, entity);
@@ -43,60 +42,13 @@ public class CraftPainting extends CraftEntity implements Painting {
return true;
}
- public BlockFace getAttachedFace() {
- return getFacing().getOppositeFace();
- }
-
- public void setFacingDirection(BlockFace face) {
- setFacingDirection(face, false);
- }
-
public boolean setFacingDirection(BlockFace face, boolean force) {
- Block block = getLocation().getBlock().getRelative(getAttachedFace()).getRelative(face.getOppositeFace()).getRelative(getFacing());
- EntityPainting painting = getHandle();
- int x = painting.x, y = painting.y, z = painting.z, dir = painting.direction;
- painting.x = block.getX();
- painting.y = block.getY();
- painting.z = block.getZ();
- switch (face) {
- case EAST:
- default:
- getHandle().setDirection(0);
- break;
- case NORTH:
- getHandle().setDirection(1);
- break;
- case WEST:
- getHandle().setDirection(2);
- break;
- case SOUTH:
- getHandle().setDirection(3);
- break;
- }
- if (!force && !painting.survives()) {
- // Revert painting since it doesn't fit
- painting.x = x;
- painting.y = y;
- painting.z = z;
- painting.setDirection(dir);
- return false;
+ if (super.setFacingDirection(face, force)) {
+ update();
+ return true;
}
- this.update();
- return true;
- }
- public BlockFace getFacing() {
- switch (this.getHandle().direction) {
- case 0:
- default:
- return BlockFace.EAST;
- case 1:
- return BlockFace.NORTH;
- case 2:
- return BlockFace.WEST;
- case 3:
- return BlockFace.SOUTH;
- }
+ return false;
}
private void update() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4e6dfb5c..34494460 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -266,7 +266,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().netServerHandler == null) return;
int packetData = effect.getId();
- Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data);
+ Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false);
getHandle().netServerHandler.sendPacket(packet);
}
@@ -598,7 +598,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setBedSpawnLocation(Location location) {
- getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
+ setBedSpawnLocation(location, false);
+ }
+
+ public void setBedSpawnLocation(Location location, boolean override) {
+ getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override);
getHandle().spawnWorld = location.getWorld().getName();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
new file mode 100644
index 00000000..c08833cb
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityWitch;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Witch;
+import org.bukkit.entity.EntityType;
+
+public class CraftWitch extends CraftMonster implements Witch {
+ public CraftWitch(CraftServer server, EntityWitch entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityWitch getHandle() {
+ return (EntityWitch) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftWitch";
+ }
+
+ public EntityType getType() {
+ return EntityType.WITCH;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
new file mode 100644
index 00000000..fad3db8a
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityWither;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Wither;
+import org.bukkit.entity.EntityType;
+
+public class CraftWither extends CraftMonster implements Wither {
+ public CraftWither(CraftServer server, EntityWither entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityWither getHandle() {
+ return (EntityWither) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftWither";
+ }
+
+ public EntityType getType() {
+ return EntityType.WITHER;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java
new file mode 100644
index 00000000..ce25a127
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java
@@ -0,0 +1,26 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityWitherSkull;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.WitherSkull;
+
+public class CraftWitherSkull extends CraftFireball implements WitherSkull {
+ public CraftWitherSkull(CraftServer server, EntityWitherSkull entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityWitherSkull getHandle() {
+ return (EntityWitherSkull) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftWitherSkull";
+ }
+
+ public EntityType getType() {
+ return EntityType.WITHER_SKULL;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java
index bafad545..b3e7c4b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java
@@ -4,5 +4,5 @@ import net.minecraft.server.IChunkProvider;
import org.bukkit.generator.ChunkGenerator;
public abstract class InternalChunkGenerator extends ChunkGenerator implements IChunkProvider {
-
+ public void recreateStructures(int i, int j) {}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
new file mode 100644
index 00000000..57f54be9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
@@ -0,0 +1,10 @@
+package org.bukkit.craftbukkit.inventory;
+
+import net.minecraft.server.IInventory;
+import org.bukkit.inventory.AnvilInventory;
+
+public class CraftInventoryAnvil extends CraftInventory implements AnvilInventory {
+ public CraftInventoryAnvil(IInventory anvil) {
+ super(anvil);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java
new file mode 100644
index 00000000..43c4107c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.inventory;
+
+import net.minecraft.server.TileEntityBeacon;
+import org.bukkit.inventory.BeaconInventory;
+import org.bukkit.inventory.ItemStack;
+
+public class CraftInventoryBeacon extends CraftInventory implements BeaconInventory {
+ public CraftInventoryBeacon(TileEntityBeacon beacon) {
+ super(beacon);
+ }
+
+ public void setItem(ItemStack item) {
+ setItem(0, item);
+ }
+
+ public ItemStack getItem() {
+ return getItem(0);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
index b294af20..0272462d 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
@@ -32,8 +32,8 @@ public class CraftMapRenderer extends MapRenderer {
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
- for (int i = 0; i < worldMap.decorations.size(); ++i) {
- WorldMapDecoration decoration = (WorldMapDecoration) worldMap.decorations.get(i);
+ for (Object object : worldMap.g.values()) {
+ WorldMapDecoration decoration = (WorldMapDecoration) object;
cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), (byte) (decoration.type));
}
}