Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
CraftBukkit/Spigot
2011-04-20 19:05:14 +02:00
parent 91e69e54b4
commit 070c214267
28 changed files with 255 additions and 288 deletions

View File

@@ -88,14 +88,14 @@ public class CraftBlock implements Block {
* @param data New block specific metadata
*/
public void setData(final byte data) {
chunk.getHandle().d.c(x, y, z, data);
chunk.getHandle().world.setData(x, y, z, data);
}
public void setData(final byte data, boolean applyPhysics) {
if (applyPhysics) {
chunk.getHandle().d.c(x, y, z, data);
chunk.getHandle().world.setData(x, y, z, data);
} else {
chunk.getHandle().d.d(x, y, z, data);
chunk.getHandle().world.setRawData(x, y, z, data);
}
}
@@ -105,7 +105,7 @@ public class CraftBlock implements Block {
* @return block specific metadata
*/
public byte getData() {
return (byte) chunk.getHandle().b(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
return (byte) chunk.getHandle().getData(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
}
/**
@@ -124,24 +124,24 @@ public class CraftBlock implements Block {
* @return whether the block was changed
*/
public boolean setTypeId(final int type) {
return chunk.getHandle().d.e(x, y, z, type);
return chunk.getHandle().world.setRawTypeId(x, y, z, type);
}
public boolean setTypeId(final int type, final boolean applyPhysics) {
if (applyPhysics) {
return setTypeId(type);
} else {
return chunk.getHandle().d.setTypeId(x, y, z, type);
return chunk.getHandle().world.setRawTypeId(x, y, z, type);
}
}
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
if (applyPhysics) {
return chunk.getHandle().d.b(x, y, z, type, data);
return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data);
} else {
boolean success = chunk.getHandle().d.setTypeIdAndData(x, y, z, type, data);
if(success) {
chunk.getHandle().d.g(x, y, z);
boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data);
if (success) {
chunk.getHandle().world.notify(x, y, z);
}
return success;
}
@@ -162,7 +162,7 @@ public class CraftBlock implements Block {
* @return block type-id
*/
public int getTypeId() {
return chunk.getHandle().a(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
return chunk.getHandle().getTypeId(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
}
/**
@@ -171,7 +171,7 @@ public class CraftBlock implements Block {
* @return light level
*/
public byte getLightLevel() {
return (byte) chunk.getHandle().d.j(this.x, this.y, this.z);
return (byte) chunk.getHandle().world.getLightLevel(this.x, this.y, this.z);
}
/**
@@ -331,7 +331,7 @@ public class CraftBlock implements Block {
}
public Biome getBiome() {
BiomeBase base = chunk.getHandle().d.a().a(x, z);
BiomeBase base = chunk.getHandle().world.getWorldChunkManager().getBiome(x, z);
if (base == BiomeBase.RAINFOREST) {
return Biome.RAINFOREST;
@@ -363,11 +363,11 @@ public class CraftBlock implements Block {
}
public boolean isBlockPowered() {
return chunk.getHandle().d.o(x, y, z);
return chunk.getHandle().world.isBlockPowered(x, y, z);
}
public boolean isBlockIndirectlyPowered() {
return chunk.getHandle().d.p(x, y, z);
return chunk.getHandle().world.isBlockIndirectlyPowered(x, y, z);
}
@Override
@@ -376,26 +376,26 @@ public class CraftBlock implements Block {
}
public boolean isBlockFacePowered(BlockFace face) {
return chunk.getHandle().d.i(x, y, z, blockFaceToNotch(face));
return chunk.getHandle().world.isBlockFacePowered(x, y, z, blockFaceToNotch(face));
}
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
return chunk.getHandle().d.j(x, y, z, blockFaceToNotch(face));
return chunk.getHandle().world.isBlockFaceIndirectlyPowered(x, y, z, blockFaceToNotch(face));
}
public int getBlockPower(BlockFace face) {
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.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);
net.minecraft.server.World world = chunk.getHandle().world;
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(x, y - 1, z, 0)) power = wire.getPower(world, x, y - 1, z, power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z - 1, 2)) power = wire.getPower(world, x, y, z - 1, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z + 1, 3)) power = wire.getPower(world, x, y, z + 1, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(x - 1, y, z, 4)) power = wire.getPower(world, x - 1, y, z, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(x + 1, y, z, 5)) power = wire.getPower(world, x + 1, y, z, power);
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
public int getBlockPower() {
return getBlockPower(BlockFace.SELF);
}

View File

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

View File

@@ -18,15 +18,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
}
public CreatureType getCreatureType() {
return CreatureType.fromName(spawner.h);
return CreatureType.fromName(spawner.mobName);
}
public void setCreatureType(CreatureType creatureType) {
spawner.h = creatureType.getName();
spawner.mobName = creatureType.getName();
}
public String getCreatureTypeId() {
return spawner.h;
return spawner.mobName;
}
public void setCreatureTypeId(String creatureType) {
@@ -35,15 +35,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
if (type == null) {
return;
}
spawner.h = type.getName();
spawner.mobName = type.getName();
}
public int getDelay() {
return spawner.a;
return spawner.spawnDelay;
}
public void setDelay(int delay) {
spawner.a = delay;
spawner.spawnDelay = delay;
}
}

View File

@@ -36,7 +36,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
synchronized (block) {
if (block.getType() == Material.DISPENSER) {
BlockDispenser dispense = (BlockDispenser)net.minecraft.server.Block.DISPENSER;
dispense.b(world.getHandle(), getX(), getY(), getZ(), new Random());
dispense.dispense(world.getHandle(), getX(), getY(), getZ(), new Random());
return true;
} else {
return false;
@@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
boolean result = super.update(force);
if (result) {
dispenser.i();
dispenser.update();
}
return result;

View File

@@ -32,25 +32,25 @@ public class CraftFurnace extends CraftBlockState implements Furnace {
boolean result = super.update(force);
if (result) {
furnace.i();
furnace.update();
}
return result;
}
public short getBurnTime() {
return (short)furnace.a;
return (short)furnace.burnTime;
}
public void setBurnTime(short burnTime) {
furnace.a = burnTime;
furnace.burnTime = burnTime;
}
public short getCookTime() {
return (short)furnace.c;
return (short)furnace.cookTime;
}
public void setCookTime(short cookTime) {
furnace.c = cookTime;
furnace.cookTime = cookTime;
}
}

View File

@@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
}
public byte getNote() {
return note.a;
return note.note;
}
public void setNote(byte n) {
note.a = n;
note.note = n;
}
public boolean play() {
@@ -35,7 +35,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) {
note.a(world.getHandle(), getX(), getY(), getZ());
note.play(world.getHandle(), getX(), getY(), getZ());
return true;
} else {
return false;

View File

@@ -17,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign {
}
public String[] getLines() {
return sign.a;
return sign.lines;
}
public String getLine(int index) throws IndexOutOfBoundsException {
return sign.a[index];
return sign.lines[index];
}
public void setLine(int index, String line) throws IndexOutOfBoundsException {
sign.a[index] = line;
sign.lines[index] = line;
}
@Override
@@ -33,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign {
boolean result = super.update(force);
if (result) {
sign.i();
sign.update();
}
return result;