Cleanup comments, formatting, etc
By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
@@ -340,7 +340,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
public int getBlockPower(BlockFace face) {
|
||||
int power = 0;
|
||||
BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE;
|
||||
BlockRedstoneWire wire = net.minecraft.server.Block.REDSTONE_WIRE;
|
||||
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);
|
||||
|
||||
@@ -115,19 +115,17 @@ public class CraftBlockState implements BlockState {
|
||||
public boolean update(boolean force) {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() != this.getType()) {
|
||||
if (force) {
|
||||
block.setTypeId(this.getTypeId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (block.getType() != this.getType()) {
|
||||
if (force) {
|
||||
block.setTypeId(this.getTypeId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
block.setData(getRawData());
|
||||
world.getHandle().notify(x, y, z);
|
||||
}
|
||||
|
||||
block.setData(getRawData());
|
||||
world.getHandle().notify(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
|
||||
public class CraftBrewingStand extends CraftBlockState implements BrewingStand {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityBrewingStand brewingStand;
|
||||
|
||||
public CraftBrewingStand(Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
brewingStand = (TileEntityBrewingStand) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
brewingStand = (TileEntityBrewingStand) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public BrewerInventory getInventory() {
|
||||
|
||||
@@ -9,14 +9,12 @@ import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityMobSpawner spawner;
|
||||
|
||||
public CraftCreatureSpawner(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
spawner = (TileEntityMobSpawner) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
spawner = (TileEntityMobSpawner) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -28,15 +28,13 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
|
||||
public boolean dispense() {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.DISPENSER) {
|
||||
BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER;
|
||||
if (block.getType() == Material.DISPENSER) {
|
||||
BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER;
|
||||
|
||||
dispense.dispense(world.getHandle(), getX(), getY(), getZ());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
dispense.dispense(world.getHandle(), getX(), getY(), getZ());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,10 @@ public class CraftDropper extends CraftBlockState implements Dropper {
|
||||
public void drop() {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.DROPPER) {
|
||||
BlockDropper drop = (BlockDropper) net.minecraft.server.Block.DROPPER;
|
||||
if (block.getType() == Material.DROPPER) {
|
||||
BlockDropper drop = (BlockDropper) net.minecraft.server.Block.DROPPER;
|
||||
|
||||
drop.dispense(world.getHandle(), getX(), getY(), getZ());
|
||||
}
|
||||
drop.dispense(world.getHandle(), getX(), getY(), getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
|
||||
public class CraftFurnace extends CraftBlockState implements Furnace {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityFurnace furnace;
|
||||
|
||||
public CraftFurnace(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
furnace = (TileEntityFurnace) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
furnace = (TileEntityFurnace) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public FurnaceInventory getInventory() {
|
||||
|
||||
@@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class CraftHopper extends CraftBlockState implements Hopper {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityHopper hopper;
|
||||
|
||||
public CraftHopper(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
hopper = (TileEntityHopper) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
hopper = (TileEntityHopper) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
|
||||
@@ -39,39 +39,33 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
public boolean play() {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
note.play(world.getHandle(), getX(), getY(), getZ());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
note.play(world.getHandle(), getX(), getY(), getZ());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean play(byte instrument, byte note) {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean play(Instrument instrument, Note note) {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user