@@ -175,21 +175,21 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public static int blockFaceToNotch(BlockFace face) {
|
||||
switch(face) {
|
||||
case DOWN:
|
||||
return 0;
|
||||
case UP:
|
||||
return 1;
|
||||
case EAST:
|
||||
return 2;
|
||||
case WEST:
|
||||
return 3;
|
||||
case NORTH:
|
||||
return 4;
|
||||
case SOUTH:
|
||||
return 5;
|
||||
default:
|
||||
return 7; // Good as anything here, but technically invalid
|
||||
switch (face) {
|
||||
case DOWN:
|
||||
return 0;
|
||||
case UP:
|
||||
return 1;
|
||||
case EAST:
|
||||
return 2;
|
||||
case WEST:
|
||||
return 3;
|
||||
case NORTH:
|
||||
return 4;
|
||||
case SOUTH:
|
||||
return 5;
|
||||
default:
|
||||
return 7; // Good as anything here, but technically invalid
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,25 +197,25 @@ public class CraftBlock implements Block {
|
||||
Material material = getType();
|
||||
|
||||
switch (material) {
|
||||
case SIGN:
|
||||
case SIGN_POST:
|
||||
case WALL_SIGN:
|
||||
return new CraftSign(this);
|
||||
case CHEST:
|
||||
return new CraftChest(this);
|
||||
case BURNING_FURNACE:
|
||||
case FURNACE:
|
||||
return new CraftFurnace(this);
|
||||
case DISPENSER:
|
||||
return new CraftDispenser(this);
|
||||
case MOB_SPAWNER:
|
||||
return new CraftCreatureSpawner(this);
|
||||
case NOTE_BLOCK:
|
||||
return new CraftNoteBlock(this);
|
||||
case JUKEBOX:
|
||||
return new CraftJukebox(this);
|
||||
default:
|
||||
return new CraftBlockState(this);
|
||||
case SIGN:
|
||||
case SIGN_POST:
|
||||
case WALL_SIGN:
|
||||
return new CraftSign(this);
|
||||
case CHEST:
|
||||
return new CraftChest(this);
|
||||
case BURNING_FURNACE:
|
||||
case FURNACE:
|
||||
return new CraftFurnace(this);
|
||||
case DISPENSER:
|
||||
return new CraftDispenser(this);
|
||||
case MOB_SPAWNER:
|
||||
return new CraftCreatureSpawner(this);
|
||||
case NOTE_BLOCK:
|
||||
return new CraftNoteBlock(this);
|
||||
case JUKEBOX:
|
||||
return new CraftJukebox(this);
|
||||
default:
|
||||
return new CraftBlockState(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,27 +245,27 @@ public class CraftBlock implements Block {
|
||||
} else if (base == BiomeBase.OCEAN) {
|
||||
return Biome.OCEAN;
|
||||
} else if (base == BiomeBase.FROZEN_OCEAN) {
|
||||
return Biome.FROZEN_OCEAN;
|
||||
return Biome.FROZEN_OCEAN;
|
||||
} else if (base == BiomeBase.FROZEN_RIVER) {
|
||||
return Biome.FROZEN_RIVER;
|
||||
return Biome.FROZEN_RIVER;
|
||||
} else if (base == BiomeBase.ICE_PLAINS) {
|
||||
return Biome.ICE_PLAINS;
|
||||
return Biome.ICE_PLAINS;
|
||||
} else if (base == BiomeBase.ICE_MOUNTAINS) {
|
||||
return Biome.ICE_MOUNTAINS;
|
||||
return Biome.ICE_MOUNTAINS;
|
||||
} else if (base == BiomeBase.MUSHROOM_ISLAND) {
|
||||
return Biome.MUSHROOM_ISLAND;
|
||||
return Biome.MUSHROOM_ISLAND;
|
||||
} else if (base == BiomeBase.MUSHROOM_SHORE) {
|
||||
return Biome.MUSHROOM_SHORE;
|
||||
return Biome.MUSHROOM_SHORE;
|
||||
} else if (base == BiomeBase.BEACH) {
|
||||
return Biome.BEACH;
|
||||
return Biome.BEACH;
|
||||
} else if (base == BiomeBase.DESERT_HILLS) {
|
||||
return Biome.DESERT_HILLS;
|
||||
return Biome.DESERT_HILLS;
|
||||
} else if (base == BiomeBase.FOREST_HILLS) {
|
||||
return Biome.FOREST_HILLS;
|
||||
return Biome.FOREST_HILLS;
|
||||
} else if (base == BiomeBase.TAIGA_HILLS) {
|
||||
return Biome.TAIGA_HILLS;
|
||||
return Biome.TAIGA_HILLS;
|
||||
} else if (base == BiomeBase.SMALL_MOUNTAINS) {
|
||||
return Biome.SMALL_MOUNTAINS;
|
||||
return Biome.SMALL_MOUNTAINS;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -36,56 +36,26 @@ public class CraftBlockState implements BlockState {
|
||||
return new CraftBlockState(world.getWorld().getBlockAt(x, y, z));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the world which contains this Block
|
||||
*
|
||||
* @return World containing this block
|
||||
*/
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the x-coordinate of this block
|
||||
*
|
||||
* @return x-coordinate
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the y-coordinate of this block
|
||||
*
|
||||
* @return y-coordinate
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the z-coordinate of this block
|
||||
*
|
||||
* @return z-coordinate
|
||||
*/
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the chunk which contains this block
|
||||
*
|
||||
* @return Containing Chunk
|
||||
*/
|
||||
public Chunk getChunk() {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the metadata for this block
|
||||
*
|
||||
* @param data New block specific metadata
|
||||
*/
|
||||
public void setData(final MaterialData data) {
|
||||
Material mat = getType();
|
||||
|
||||
@@ -101,29 +71,14 @@ public class CraftBlockState implements BlockState {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata for this block
|
||||
*
|
||||
* @return block specific metadata
|
||||
*/
|
||||
public MaterialData getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this block
|
||||
*
|
||||
* @param type Material to change this block to
|
||||
*/
|
||||
public void setType(final Material type) {
|
||||
setTypeId(type.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type-id of this block
|
||||
*
|
||||
* @param type Type-Id to change this block to
|
||||
*/
|
||||
public boolean setTypeId(final int type) {
|
||||
this.type = type;
|
||||
|
||||
@@ -131,29 +86,14 @@ public class CraftBlockState implements BlockState {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of this block
|
||||
*
|
||||
* @return block type
|
||||
*/
|
||||
public Material getType() {
|
||||
return Material.getMaterial(getTypeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type-id of this block
|
||||
*
|
||||
* @return block type-id
|
||||
*/
|
||||
public int getTypeId() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the light level between 0-15
|
||||
*
|
||||
* @return light level
|
||||
*/
|
||||
public byte getLightLevel() {
|
||||
return light;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
|
||||
|
||||
public boolean eject() {
|
||||
boolean result = isPlaying();
|
||||
((BlockJukeBox)net.minecraft.server.Block.JUKEBOX).dropRecord(world.getHandle(), getX(), getY(), getZ());
|
||||
((BlockJukeBox) net.minecraft.server.Block.JUKEBOX).dropRecord(world.getHandle(), getX(), getY(), getZ());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user