Update CraftBukkit to Minecraft 1.5
By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.server.BiomeBase;
|
||||
import net.minecraft.server.BlockRedstoneWire;
|
||||
import net.minecraft.server.Direction;
|
||||
import net.minecraft.server.EnumSkyBlock;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.TileEntitySkull;
|
||||
@@ -84,14 +85,14 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public void setData(final byte data) {
|
||||
chunk.getHandle().world.setData(x, y, z, data);
|
||||
chunk.getHandle().world.setData(x, y, z, data, 3);
|
||||
}
|
||||
|
||||
public void setData(final byte data, boolean applyPhysics) {
|
||||
if (applyPhysics) {
|
||||
chunk.getHandle().world.setData(x, y, z, data);
|
||||
chunk.getHandle().world.setData(x, y, z, data, 3);
|
||||
} else {
|
||||
chunk.getHandle().world.setRawData(x, y, z, data);
|
||||
chunk.getHandle().world.setData(x, y, z, data, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,22 +105,22 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public boolean setTypeId(final int type) {
|
||||
return chunk.getHandle().world.setTypeId(x, y, z, type);
|
||||
return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, getData(), 3);
|
||||
}
|
||||
|
||||
public boolean setTypeId(final int type, final boolean applyPhysics) {
|
||||
if (applyPhysics) {
|
||||
return setTypeId(type);
|
||||
} else {
|
||||
return chunk.getHandle().world.setRawTypeId(x, y, z, type);
|
||||
return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, getData(), 4);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
|
||||
if (applyPhysics) {
|
||||
return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data);
|
||||
return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data, 3);
|
||||
} else {
|
||||
boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data);
|
||||
boolean success = chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data, 4);
|
||||
if (success) {
|
||||
chunk.getHandle().world.notify(x, y, z);
|
||||
}
|
||||
@@ -294,7 +295,7 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public boolean isBlockPowered() {
|
||||
return chunk.getHandle().world.isBlockPowered(x, y, z);
|
||||
return chunk.getHandle().world.getBlockPower(x, y, z) > 0;
|
||||
}
|
||||
|
||||
public boolean isBlockIndirectlyPowered() {
|
||||
@@ -320,7 +321,14 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
|
||||
return chunk.getHandle().world.isBlockFaceIndirectlyPowered(x, y, z, blockFaceToNotch(face));
|
||||
int power = chunk.getHandle().world.getBlockFacePower(x, y, z, blockFaceToNotch(face));
|
||||
|
||||
Block relative = getRelative(face);
|
||||
if (relative.getType() == Material.REDSTONE_WIRE) {
|
||||
return Math.max(power, relative.getData()) > 0;
|
||||
}
|
||||
|
||||
return power > 0;
|
||||
}
|
||||
|
||||
public int getBlockPower(BlockFace face) {
|
||||
|
||||
@@ -21,16 +21,16 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
|
||||
@Deprecated
|
||||
public CreatureType getCreatureType() {
|
||||
return CreatureType.fromName(spawner.mobName);
|
||||
return CreatureType.fromName(spawner.a().getMobName());
|
||||
}
|
||||
|
||||
public EntityType getSpawnedType() {
|
||||
return EntityType.fromName(spawner.mobName);
|
||||
return EntityType.fromName(spawner.a().getMobName());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setCreatureType(CreatureType creatureType) {
|
||||
spawner.mobName = creatureType.getName();
|
||||
spawner.a().a(creatureType.getName());
|
||||
}
|
||||
|
||||
public void setSpawnedType(EntityType entityType) {
|
||||
@@ -38,12 +38,12 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!");
|
||||
}
|
||||
|
||||
spawner.mobName = entityType.getName();
|
||||
spawner.a().a(entityType.getName());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getCreatureTypeId() {
|
||||
return spawner.mobName;
|
||||
return spawner.a().getMobName();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -52,7 +52,7 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
}
|
||||
|
||||
public String getCreatureTypeName() {
|
||||
return spawner.mobName;
|
||||
return spawner.a().getMobName();
|
||||
}
|
||||
|
||||
public void setCreatureTypeByName(String creatureType) {
|
||||
@@ -65,11 +65,11 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return spawner.spawnDelay;
|
||||
return spawner.a().spawnDelay;
|
||||
}
|
||||
|
||||
public void setDelay(int delay) {
|
||||
spawner.spawnDelay = delay;
|
||||
spawner.a().spawnDelay = delay;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
|
||||
}
|
||||
|
||||
public Material getPlaying() {
|
||||
ItemStack record = jukebox.record;
|
||||
ItemStack record = jukebox.getRecord();
|
||||
if (record == null) {
|
||||
return Material.AIR;
|
||||
}
|
||||
@@ -33,15 +33,15 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
|
||||
public void setPlaying(Material record) {
|
||||
if (record == null || Item.byId[record.getId()] == null) {
|
||||
record = Material.AIR;
|
||||
jukebox.record = null;
|
||||
jukebox.setRecord(null);
|
||||
} else {
|
||||
jukebox.record = new ItemStack(Item.byId[record.getId()], 1);
|
||||
jukebox.setRecord(new ItemStack(Item.byId[record.getId()], 1));
|
||||
}
|
||||
jukebox.update();
|
||||
if (record == Material.AIR) {
|
||||
world.getHandle().setData(getX(), getY(), getZ(), 0);
|
||||
world.getHandle().setData(getX(), getY(), getZ(), 0, 3);
|
||||
} else {
|
||||
world.getHandle().setData(getX(), getY(), getZ(), 1);
|
||||
world.getHandle().setData(getX(), getY(), getZ(), 1, 3);
|
||||
}
|
||||
world.playEffect(getLocation(), Effect.RECORD_PLAY, record.getId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user