diff options
Diffstat (limited to 'src/main/java/org/bukkit')
13 files changed, 83 insertions, 105 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index a35d4822..bf7dba69 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import net.minecraft.server.EntityPlayerMP; +import net.minecraft.server.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.server.PropertyManager; import net.minecraft.server.ServerConfigurationManager; @@ -70,7 +70,7 @@ public final class CraftServer implements Server { } public Player[] getOnlinePlayers() { - List<EntityPlayerMP> online = server.b; + List<EntityPlayer> online = server.b; Player[] players = new Player[online.size()]; for (int i = 0; i < players.length; i++) { @@ -109,7 +109,7 @@ public final class CraftServer implements Server { return players.length; } - public Player getPlayer(final EntityPlayerMP entity) { + public Player getPlayer(final EntityPlayer entity) { return entity.a.getPlayer(); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index cdeffc3a..d7d2093c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -37,7 +37,7 @@ public class CraftWorld implements World { CraftBlock block = blockCache.get(loc); if (block == null) { - block = new CraftBlock(this, x, y, z, world.a(x, y, z), (byte)world.b(x, y, z)); + block = new CraftBlock(this, x, y, z, world.getTypeId(x, y, z), (byte)world.getData(x, y, z)); blockCache.put(loc, block); } else { block.update(); @@ -47,7 +47,7 @@ public class CraftWorld implements World { } public int getBlockTypeIdAt(int x, int y, int z) { - return world.a(x, y, z); + return world.getTypeId(x, y, z); } public int getHighestBlockYAt(int x, int z) { @@ -55,7 +55,7 @@ public class CraftWorld implements World { } public Location getSpawnLocation() { - return new Location(this, world.m, world.e(world.m, world.o), world.o); + return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ); } public Chunk getChunkAt(int x, int z) { @@ -86,8 +86,8 @@ public class CraftWorld implements World { public Block updateBlock(int x, int y, int z) { BlockCoordinate loc = new BlockCoordinate(x, y, z); CraftBlock block = (CraftBlock)blockCache.get(loc); - final int type = world.a(x, y, z); - final byte data = (byte)world.b(x, y, z); + final int type = world.getTypeId(x, y, z); + final byte data = (byte)world.getData(x, y, z); if (block == null) { block = new CraftBlock(this, x, y, z, type, data); @@ -202,31 +202,8 @@ public class CraftWorld implements World { return treeGen.a(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); } - /**@deprecated*/ - public CraftEntity toCraftEntity(net.minecraft.server.Entity entity) { - if (entity instanceof CraftMappable) { - return ((CraftMappable)entity).getCraftEntity(); - } else if (entity instanceof EntityItem) { - return new CraftItemDrop(world.getServer(), (EntityItem)entity); - } else if (entity instanceof EntityArrow) { - return new CraftArrow(world.getServer(), (EntityArrow)entity); - } else if (entity instanceof EntityEgg) { - return new CraftEgg(world.getServer(), (EntityEgg)entity); - } else if (entity instanceof EntityPlayerMP) { - return new CraftPlayer(world.getServer(), (EntityPlayerMP)entity); - } else if (entity instanceof EntitySnowball) { - return new CraftSnowball(world.getServer(), (EntitySnowball)entity); - } else if (entity instanceof EntityPlayer) { - return new CraftHumanEntity(world.getServer(), (EntityPlayer)entity); - } else if (entity instanceof EntityLiving) { - return new CraftLivingEntity(world.getServer(), (EntityLiving)entity); - } else { - return null; - } - } - public TileEntity getTileEntityAt(final int x, final int y, final int z) { - return world.m(x, y, z); + return world.getTileEntity(x, y, z); } public String getName() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 4d19e34b..efe07ef0 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -5,7 +5,8 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.Location; -import net.minecraft.server.MobSpawnerBase; + +import net.minecraft.server.BiomeBase; import org.bukkit.*; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.CraftChunk; @@ -306,31 +307,31 @@ public class CraftBlock implements Block { public Biome getBiome() { // TODO: This may not be 100% accurate; investigate into getting per-block instead of per-chunk - MobSpawnerBase base = world.getHandle().a().a(chunk.getX(), chunk.getZ()); + BiomeBase base = world.getHandle().a().a(chunk.getX(), chunk.getZ()); - if (base == MobSpawnerBase.a) { + if (base == BiomeBase.RAINFOREST) { return Biome.RAINFOREST; - } else if (base == MobSpawnerBase.b) { + } else if (base == BiomeBase.SWAMPLAND) { return Biome.SWAMPLAND; - } else if (base == MobSpawnerBase.c) { + } else if (base == BiomeBase.SEASONAL_FOREST) { return Biome.SEASONAL_FOREST; - } else if (base == MobSpawnerBase.d) { + } else if (base == BiomeBase.FOREST) { return Biome.FOREST; - } else if (base == MobSpawnerBase.e) { + } else if (base == BiomeBase.SAVANNA) { return Biome.SAVANNA; - } else if (base == MobSpawnerBase.f) { + } else if (base == BiomeBase.SHRUBLAND) { return Biome.SHRUBLAND; - } else if (base == MobSpawnerBase.g) { + } else if (base == BiomeBase.TAIGA) { return Biome.TAIGA; - } else if (base == MobSpawnerBase.h) { + } else if (base == BiomeBase.DESERT) { return Biome.DESERT; - } else if (base == MobSpawnerBase.i) { + } else if (base == BiomeBase.PLAINS) { return Biome.PLAINS; - } else if (base == MobSpawnerBase.j) { + } else if (base == BiomeBase.ICE_DESERT) { return Biome.ICE_DESERT; - } else if (base == MobSpawnerBase.k) { + } else if (base == BiomeBase.TUNDRA) { return Biome.TUNDRA; - } else if (base == MobSpawnerBase.l) { + } else if (base == BiomeBase.HELL) { return Biome.HELL; } @@ -346,8 +347,8 @@ public class CraftBlock implements Block { } public void update() { - type = world.getHandle().a(x, y, z); - data = (byte)world.getHandle().b(x, y, z); + type = world.getHandle().getTypeId(x, y, z); + data = (byte)world.getHandle().getData(x, y, z); light = (byte)world.getHandle().j(x, y, z); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java index b04967f9..ed0b8b95 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java @@ -1,12 +1,12 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityAnimals; +import net.minecraft.server.EntityAnimal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Animals; public class CraftAnimals extends CraftCreature implements Animals{ - public CraftAnimals(CraftServer server, EntityAnimals entity) { + public CraftAnimals(CraftServer server, EntityAnimal entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 560ad6cc..47bc40e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -17,21 +17,21 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public Location getLocation() { - return new Location(getWorld(), entity.p, entity.q, entity.r, entity.v, entity.w); + return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch); } public Vector getVelocity() { - return new Vector(entity.s, entity.t, entity.u); + return new Vector(entity.motX, entity.motY, entity.motZ); } public void setVelocity(Vector vel) { - entity.s = vel.getX(); - entity.t = vel.getY(); - entity.u = vel.getZ(); + entity.motX = vel.getX(); + entity.motY = vel.getY(); + entity.motZ = vel.getZ(); } public World getWorld() { - return ((WorldServer)entity.l).getWorld(); + return ((WorldServer)entity.world).getWorld(); } public void teleportTo(Location location) { @@ -43,7 +43,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public int getEntityId() { - return entity.g; + return entity.id; } public Entity getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java index 9e47eb71..6cae93f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java @@ -1,13 +1,13 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityZombieSimple; +import net.minecraft.server.EntityGiantZombie; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Giant; public class CraftGiant extends CraftMonster implements Giant { - public CraftGiant(CraftServer server, EntityZombieSimple entity) { + public CraftGiant(CraftServer server, EntityGiantZombie entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index e0c669e2..d535c049 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -1,7 +1,7 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityPlayer; +import net.minecraft.server.EntityHuman; import org.bukkit.entity.HumanEntity; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -10,28 +10,28 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.CraftServer; public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - private EntityPlayer entity; + private EntityHuman entity; private CraftInventoryPlayer inventory; - public CraftHumanEntity(final CraftServer server, final EntityPlayer entity) { + public CraftHumanEntity(final CraftServer server, final EntityHuman entity) { super(server, entity); this.entity = entity; - this.inventory = new CraftInventoryPlayer( entity.an ); + this.inventory = new CraftInventoryPlayer( entity.inventory ); } public String getName() { - return entity.aw; + return entity.name; } @Override - public EntityPlayer getHandle() { + public EntityHuman getHandle() { return entity; } - public void setHandle(final EntityPlayer entity) { - super.setHandle((EntityPlayer)entity); + public void setHandle(final EntityHuman entity) { + super.setHandle((EntityHuman)entity); this.entity = entity; - this.inventory = new CraftInventoryPlayer( entity.an ); + this.inventory = new CraftInventoryPlayer( entity.inventory ); } public CraftInventoryPlayer getInventory() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 8ed7efd8..e947241c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -24,7 +24,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public int getHealth() { - return entity.aZ; + return entity.health; } public void setHealth(int health) { @@ -32,7 +32,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { throw new IllegalArgumentException("Health must be between 0 and 200"); } - entity.aZ = health; + entity.health = health; } @Override @@ -72,11 +72,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public boolean isInsideVehicle() { - return entity.k != null; + return entity.vehicle != null; } public boolean leaveVehicle() { - if (entity.k == null) { + if (entity.vehicle == null) { return false; } @@ -85,13 +85,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public Vehicle getVehicle() { - if (entity.k == null) { + if (entity.vehicle == null) { return null; } - org.bukkit.entity.Entity vehicle = (entity.k.getBukkitEntity()); + org.bukkit.entity.Entity vehicle = (entity.vehicle.getBukkitEntity()); if (vehicle instanceof Vehicle) { - return (Vehicle)vehicle; + return (Vehicle) vehicle; } return null; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java index 7973c018..2453bfe2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java @@ -1,13 +1,13 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityMobs; +import net.minecraft.server.EntityMonster; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Monster; public class CraftMonster extends CraftCreature implements Monster { - public CraftMonster(CraftServer server, EntityMobs entity) { + public CraftMonster(CraftServer server, EntityMonster entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 2c32a631..27bab58d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2,8 +2,8 @@ package org.bukkit.craftbukkit.entity; import java.net.InetSocketAddress; import java.net.SocketAddress; +import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityPlayer; -import net.minecraft.server.EntityPlayerMP; import net.minecraft.server.Packet; import net.minecraft.server.Packet3Chat; import net.minecraft.server.Packet6SpawnPosition; @@ -12,10 +12,10 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Player; public class CraftPlayer extends CraftHumanEntity implements Player { - private EntityPlayerMP entity; + private EntityPlayer entity; private String name; - public CraftPlayer(CraftServer server, EntityPlayerMP entity) { + public CraftPlayer(CraftServer server, EntityPlayer entity) { super(server, entity); this.name = getName(); this.entity = entity; @@ -31,8 +31,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public boolean isOnline() { for (Object obj: server.getHandle().b) { - EntityPlayerMP player = (EntityPlayerMP) obj; - if (player.aw.equalsIgnoreCase(getName())) { + EntityPlayer player = (EntityPlayer) obj; + if (player.name.equalsIgnoreCase(getName())) { return true; } } @@ -49,12 +49,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } @Override - public EntityPlayerMP getHandle() { + public EntityPlayer getHandle() { return entity; } - public void setHandle(final EntityPlayerMP entity) { - super.setHandle((EntityPlayer) entity); + public void setHandle(final EntityPlayer entity) { + super.setHandle((EntityHuman) entity); this.entity = entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java index e1cca613..3c3df038 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java @@ -15,7 +15,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle { } public Entity getPassenger() { - return isEmpty()?null:(getHandle().j.getBukkitEntity()); + return isEmpty() ? null : (getHandle().passenger.getBukkitEntity()); } public boolean setPassenger(Entity passenger) { @@ -28,15 +28,15 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle { } public boolean isEmpty() { - return getHandle().j == null; + return getHandle().passenger == null; } public boolean eject() { - if (getHandle().j == null) { + if (getHandle().passenger == null) { return false; } - getHandle().j.setPassengerOf(null); + getHandle().passenger.setPassengerOf(null); return true; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java index 6425fde4..0e23936e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java @@ -1,13 +1,13 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityWaterMob; +import net.minecraft.server.EntityWaterAnimal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.WaterMob; public class CraftWaterMob extends CraftCreature implements WaterMob { - public CraftWaterMob(CraftServer server, EntityWaterMob entity) { + public CraftWaterMob(CraftServer server, EntityWaterAnimal entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index b32f5566..f08391c1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -8,9 +8,9 @@ public class CraftItemStack extends ItemStack { public CraftItemStack(net.minecraft.server.ItemStack item) { super( - item != null ? item.c : 0, - item != null ? item.a : 0, - (byte)(item != null ? item.d : 0) + item != null ? item.id: 0, + item != null ? item.count : 0, + (byte)(item != null ? item.damage : 0) ); this.item = item; } @@ -55,14 +55,14 @@ public class CraftItemStack extends ItemStack { @Override public Material getType() { - super.setTypeId(item != null ? item.c : 0); // sync, needed? + super.setTypeId(item != null ? item.id : 0); // sync, needed? return super.getType(); } @Override public int getTypeId() { - super.setTypeId(item != null ? item.c : 0); // sync, needed? - return item != null ? item.c : 0; + super.setTypeId(item != null ? item.id : 0); // sync, needed? + return item != null ? item.id : 0; } @Override @@ -76,16 +76,16 @@ public class CraftItemStack extends ItemStack { item = new net.minecraft.server.ItemStack(type, 1, 0); super.setAmount(1); } else { - item.c = type; - super.setTypeId(item.c); + item.id = type; + super.setTypeId(item.id); } } } @Override public int getAmount() { - super.setAmount(item != null ? item.a : 0); // sync, needed? - return (item != null ? item.a : 0); + super.setAmount(item != null ? item.count : 0); // sync, needed? + return (item != null ? item.count : 0); } @Override @@ -96,7 +96,7 @@ public class CraftItemStack extends ItemStack { item = null; } else { super.setAmount(amount); - item.a = amount; + item.count = amount; } } @@ -105,15 +105,15 @@ public class CraftItemStack extends ItemStack { // Ignore damage if item is null if (item != null) { super.setDamage(damage); - item.d = damage; + item.damage = damage; } } @Override public byte getDamage() { if (item != null) { - super.setDamage((byte) item.d); // sync, needed? - return (byte) item.d; + super.setDamage((byte) item.damage); // sync, needed? + return (byte) item.damage; } else { return 0; } |