Updated to Minecraft version 1.4

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2011-03-31 21:40:00 +01:00
parent 3669bb0d8b
commit adcc9c9ddf
14 changed files with 35 additions and 30 deletions

View file

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

View file

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import jline.ConsoleReader;
@ -36,7 +37,7 @@ import org.bukkit.craftbukkit.scheduler.CraftScheduler;
public final class CraftServer implements Server {
private final String serverName = "Craftbukkit";
private final String serverVersion;
private final String protocolVersion = "1.3";
private final String protocolVersion = "1.4";
private final PluginManager pluginManager = new SimplePluginManager(this);
private final BukkitScheduler scheduler = new CraftScheduler(this);
private final CommandMap commandMap = new SimpleCommandMap(this);
@ -269,6 +270,10 @@ public final class CraftServer implements Server {
}
public World createWorld(String name, World.Environment environment) {
return createWorld(name, environment, (new Random()).nextLong());
}
public World createWorld(String name, World.Environment environment, long seed) {
File folder = new File(name);
World world = getWorld(name);
@ -286,7 +291,7 @@ public final class CraftServer implements Server {
converter.a(name, new ConvertProgressUpdater(console));
}
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0);
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0, seed);
internal.a(new WorldManager(console, internal));
internal.j = 1;
@ -312,10 +317,10 @@ public final class CraftServer implements Server {
i = l;
}
ChunkCoordinates chunkcoordinates = internal.l();
ChunkCoordinates chunkcoordinates = internal.m();
internal.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
while (internal.e()) {
while (internal.f()) {
;
}
}

View file

@ -66,7 +66,7 @@ public class CraftWorld implements World {
}
public Location getSpawnLocation() {
ChunkCoordinates spawn = world.l();
ChunkCoordinates spawn = world.m();
return new Location(this, spawn.a, spawn.b, spawn.c);
}
@ -80,7 +80,7 @@ public class CraftWorld implements World {
}
public Chunk getChunkAt(int x, int z) {
return this.provider.d(x,z).bukkitChunk;
return this.provider.c(x, z).bukkitChunk;
}
public Chunk getChunkAt(Block block) {
@ -124,7 +124,7 @@ public class CraftWorld implements World {
return false;
}
provider.c(x, z);
provider.d(x, z);
return true;
}
@ -214,7 +214,7 @@ public class CraftWorld implements World {
public boolean loadChunk(int x, int z, boolean generate) {
if (generate) {
// Use the default variant of loadChunk when generate == true.
return provider.d(x, z) != null;
return provider.c(x, z) != null;
}
provider.a.remove(x, z);
@ -524,7 +524,7 @@ public class CraftWorld implements World {
public void save() {
// Writes level.dat
world.r();
world.t();
// Saves all chunks/regions
world.o.a(true, null);

View file

@ -387,12 +387,12 @@ public class CraftBlock implements Block {
int power = 0;
BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE;
net.minecraft.server.World world = chunk.getHandle().d;
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.i(x, y - 1, z, 0)) power = wire.g(world, x, y - 1, z, power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.g(world, x, y + 1, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.i(x, y, z - 1, 2)) power = wire.g(world, x, y, z - 1, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.g(world, x, y, z + 1, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.i(x - 1, y, z, 4)) power = wire.g(world, x - 1, y, z, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.g(world, x + 1, y, z, power);
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.i(x, y - 1, z, 0)) power = wire.f(world, x, y - 1, z, power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.f(world, x, y + 1, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.i(x, y, z - 1, 2)) power = wire.f(world, x, y, z - 1, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.f(world, x, y, z + 1, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.i(x - 1, y, z, 4)) power = wire.f(world, x - 1, y, z, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.f(world, x + 1, y, z, power);
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}

View file

@ -32,7 +32,7 @@ public class CraftChest extends CraftBlockState implements Chest {
boolean result = super.update(force);
if (result) {
chest.h();
chest.i();
}
return result;

View file

@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
boolean result = super.update(force);
if (result) {
dispenser.h();
dispenser.i();
}
return result;

View file

@ -32,7 +32,7 @@ public class CraftFurnace extends CraftBlockState implements Furnace {
boolean result = super.update(force);
if (result) {
furnace.h();
furnace.i();
}
return result;

View file

@ -33,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign {
boolean result = super.update(force);
if (result) {
sign.h();
sign.i();
}
return result;

View file

@ -158,7 +158,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
newEntity.health = entity.health;
newEntity.fireTicks = entity.fireTicks;
newEntity.inventory = entity.inventory;
newEntity.inventory.e = newEntity;
newEntity.inventory.d = newEntity;
newEntity.activeContainer = entity.activeContainer;
newEntity.defaultContainer = entity.defaultContainer;
newEntity.locX = location.getX();
@ -194,14 +194,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setSneaking(boolean sneak) {
getHandle().b(sneak);
getHandle().e(sneak);
}
public boolean isSneaking() {
return getHandle().U();
return getHandle().Z();
}
public void updateInventory() {
getHandle().l();
getHandle().m();
}
}

View file

@ -22,7 +22,7 @@ public class CraftSheep extends CraftAnimals implements Sheep {
}
public DyeColor getColor() {
return DyeColor.getByData((byte) getHandle().n());
return DyeColor.getByData((byte) getHandle().o());
}
public void setColor(DyeColor color) {

View file

@ -21,7 +21,7 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
}
public int getSize() {
return getHandle().c;
return getHandle().m();
}
public void setSize(int size) {

View file

@ -50,7 +50,7 @@ public class CraftEventFactory {
if (spawnSize <= 0) return true;
if (player.isOp()) return true;
ChunkCoordinates chunkcoordinates = worldServer.l();
ChunkCoordinates chunkcoordinates = worldServer.m();
int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.a), Math.abs(z - chunkcoordinates.c));
return distanceFromSpawn > spawnSize;

View file

@ -19,7 +19,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
public int getSize() {
return getInventory().m_();
return getInventory().q_();
}
public String getName() {
@ -290,7 +290,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
private int getMaxItemStack() {
return getInventory().n_();
return getInventory().r_();
}
public void remove(int materialId) {

View file

@ -20,6 +20,6 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
}
public ItemStack getItem() {
return new CraftItemStack( slot.b() );
return new CraftItemStack( slot.a() );
}
}