This commit is contained in:
TomyLobo
2011-11-23 02:29:48 +01:00
parent 1a57f6e95d
commit 7e13b60a51
161 changed files with 1433 additions and 1412 deletions

View File

@ -74,7 +74,7 @@ public class BaseBlock {
* @return the data
*/
public int getData() {
return (int)data;
return (int) data;
}
/**
@ -130,6 +130,7 @@ public class BaseBlock {
data = (byte) BlockData.flip(type, data);
return this;
}
/**
* Flip this block.
* @param direction

View File

@ -61,7 +61,7 @@ public class BaseItemStack extends BaseItem {
super(id, damage);
this.amount = amount;
}
/**
* @return the amount
*/

View File

@ -721,7 +721,7 @@ public final class BlockData {
case ClothColor.ID.MAGENTA: return ClothColor.ID.PINK;
case ClothColor.ID.PINK: return ClothColor.ID.WHITE;
}
return ClothColor.ID.WHITE;
}
@ -750,7 +750,7 @@ public final class BlockData {
case ClothColor.ID.PINK: return ClothColor.ID.MAGENTA;
case ClothColor.ID.WHITE: return ClothColor.ID.PINK;
}
return ClothColor.ID.WHITE;
}
}

View File

@ -146,7 +146,7 @@ public enum BlockType {
FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"),
BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"),
STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"),
MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus" ,"mycel"),
MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus", "mycel"),
LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"),
NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"),
NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"),
@ -162,18 +162,18 @@ public enum BlockType {
/**
* Stores a map of the IDs for fast access.
*/
private static final Map<Integer,BlockType> ids = new HashMap<Integer,BlockType>();
private static final Map<Integer, BlockType> ids = new HashMap<Integer, BlockType>();
/**
* Stores a map of the names for fast access.
*/
private static final Map<String,BlockType> lookup = new HashMap<String,BlockType>();
private static final Map<String, BlockType> lookup = new HashMap<String, BlockType>();
private final int id;
private final String name;
private final String[] lookupKeys;
static {
for(BlockType type : EnumSet.allOf(BlockType.class)) {
for (BlockType type : EnumSet.allOf(BlockType.class)) {
ids.put(type.id, type);
for (String key : type.lookupKeys) {
lookup.put(key, type);
@ -200,7 +200,7 @@ public enum BlockType {
* @param id
* @param name
*/
BlockType(int id, String name, String ... lookupKeys) {
BlockType(int id, String name, String... lookupKeys) {
this.id = id;
this.name = name;
this.lookupKeys = lookupKeys;
@ -947,7 +947,7 @@ public enum BlockType {
addIdentity(BlockID.STONE_PRESSURE_PLATE); // rule 1
addIdentities(BlockID.IRON_DOOR, 8); // rule 2
addIdentity(BlockID.WOODEN_PRESSURE_PLATE); // rule 1
addIdentity(BlockID.REDSTONE_ORE); // rule 4
addIdentity(BlockID.REDSTONE_ORE); // rule 4
nonDataBlockBagItems.put(BlockID.GLOWING_REDSTONE_ORE, new BaseItem(BlockID.REDSTONE_ORE)); // rule 4
nonDataBlockBagItems.put(BlockID.REDSTONE_TORCH_OFF, new BaseItem(BlockID.REDSTONE_TORCH_ON)); // rule 3
addIdentity(BlockID.REDSTONE_TORCH_ON); // rule 1
@ -1029,7 +1029,7 @@ public enum BlockType {
private static void addIdentity(int type) {
nonDataBlockBagItems.put(type, new BaseItem(type));
}
private static void addIdentities(int type, int maxData) {
for (int data = 0; data < maxData; ++data) {
dataBlockBagItems.put(typeDataKey(type, data), new BaseItem(type, (short) data));

View File

@ -97,22 +97,22 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException {
List<Tag> itemsList = new ArrayList<Tag>();
for (int i = 0; i < items.length; ++i) {
BaseItemStack item = items[i];
if (item != null) {
Map<String,Tag> data = new HashMap<String,Tag>();
Map<String, Tag> data = new HashMap<String, Tag>();
CompoundTag itemTag = new CompoundTag("Items", data);
data.put("id", new ShortTag("id", (short)item.getType()));
data.put("id", new ShortTag("id", (short) item.getType()));
data.put("Damage", new ShortTag("Damage", item.getDamage()));
data.put("Count", new ByteTag("Count", (byte)item.getAmount()));
data.put("Slot", new ByteTag("Slot", (byte)i));
data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
data.put("Slot", new ByteTag("Slot", (byte) i));
itemsList.add(itemTag);
}
}
Map<String,Tag> values = new HashMap<String,Tag>();
Map<String, Tag> values = new HashMap<String, Tag>();
values.put("Items", new ListTag("Items", CompoundTag.class, itemsList));
return values;
}
@ -123,19 +123,18 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
throws DataException {
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException {
if (values == null) {
return;
}
Tag t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag)t).getValue().equals("Chest")) {
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Chest")) {
throw new DataException("'Chest' tile entity expected");
}
ListTag items = (ListTag)Chunk.getChildTag(values, "Items", ListTag.class);
ListTag items = (ListTag) Chunk.getChildTag(values, "Items", ListTag.class);
BaseItemStack[] newItems = new BaseItemStack[27];
for (Tag tag : items.getValue()) {
@ -143,16 +142,16 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
throw new DataException("CompoundTag expected as child tag of Chest's Items");
}
CompoundTag item = (CompoundTag)tag;
Map<String,Tag> itemValues = item.getValue();
CompoundTag item = (CompoundTag) tag;
Map<String, Tag> itemValues = item.getValue();
short id = (Short)((ShortTag)Chunk.getChildTag(itemValues, "id", ShortTag.class))
short id = (Short) ((ShortTag) Chunk.getChildTag(itemValues, "id", ShortTag.class))
.getValue();
short damage = (Short)((ShortTag)Chunk.getChildTag(itemValues, "Damage", ShortTag.class))
short damage = (Short) ((ShortTag) Chunk.getChildTag(itemValues, "Damage", ShortTag.class))
.getValue();
byte count = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Count", ByteTag.class))
byte count = (Byte) ((ByteTag) Chunk.getChildTag(itemValues, "Count", ByteTag.class))
.getValue();
byte slot = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
byte slot = (Byte) ((ByteTag) Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
.getValue();
if (slot >= 0 && slot <= 26) {

View File

@ -35,14 +35,14 @@ public enum ClothColor {
LIGHT_BLUE(ID.LIGHT_BLUE, "Light blue", "lightblue"),
YELLOW(ID.YELLOW, "Yellow", "yellow"),
LIGHT_GREEN(ID.LIGHT_GREEN, "Light green", "lightgreen"),
PINK(ID.PINK, "Pink", new String[] {"pink", "lightred"}),
GRAY(ID.GRAY, "Gray", new String[] {"grey", "gray"}),
LIGHT_GRAY(ID.LIGHT_GRAY, "Light gray", new String[] {"lightgrey", "lightgray"}),
CYAN(ID.CYAN, "Cyan", new String[] {"cyan", "turquoise"}),
PURPLE(ID.PURPLE, "Purple", new String[] {"purple", "violet"}),
PINK(ID.PINK, "Pink", new String[] { "pink", "lightred" }),
GRAY(ID.GRAY, "Gray", new String[] { "grey", "gray" }),
LIGHT_GRAY(ID.LIGHT_GRAY, "Light gray", new String[] { "lightgrey", "lightgray" }),
CYAN(ID.CYAN, "Cyan", new String[] { "cyan", "turquoise" }),
PURPLE(ID.PURPLE, "Purple", new String[] { "purple", "violet" }),
BLUE(ID.BLUE, "Blue", "blue"),
BROWN(ID.BROWN, "Brown", new String[] {"brown", "cocoa", "coffee"}),
DARK_GREEN(ID.DARK_GREEN, "Dark green", new String[] {"green", "darkgreen", "cactusgreen", "cactigreen"}),
BROWN(ID.BROWN, "Brown", new String[] { "brown", "cocoa", "coffee" }),
DARK_GREEN(ID.DARK_GREEN, "Dark green", new String[] { "green", "darkgreen", "cactusgreen", "cactigreen" }),
RED(ID.RED, "Red", "red"),
BLACK(ID.BLACK, "Black", "black");
@ -68,11 +68,11 @@ public enum ClothColor {
/**
* Stores a map of the IDs for fast access.
*/
private static final Map<Integer,ClothColor> ids = new HashMap<Integer,ClothColor>();
private static final Map<Integer, ClothColor> ids = new HashMap<Integer, ClothColor>();
/**
* Stores a map of the names for fast access.
*/
private static final Map<String,ClothColor> lookup = new HashMap<String,ClothColor>();
private static final Map<String, ClothColor> lookup = new HashMap<String, ClothColor>();
private final int id;
private final String name;
@ -97,7 +97,7 @@ public enum ClothColor {
ClothColor(int id, String name, String lookupKey) {
this.id = id;
this.name = name;
this.lookupKeys = new String[]{lookupKey};
this.lookupKeys = new String[] { lookupKey };
}
/**
@ -149,4 +149,4 @@ public enum ClothColor {
public String getName() {
return name;
}
}
}

View File

@ -97,22 +97,22 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException {
List<Tag> itemsList = new ArrayList<Tag>();
for (int i = 0; i < items.length; ++i) {
BaseItemStack item = items[i];
if (item != null) {
Map<String,Tag> data = new HashMap<String,Tag>();
Map<String, Tag> data = new HashMap<String, Tag>();
CompoundTag itemTag = new CompoundTag("Items", data);
data.put("id", new ShortTag("id", (short)item.getType()));
data.put("id", new ShortTag("id", (short) item.getType()));
data.put("Damage", new ShortTag("Damage", item.getDamage()));
data.put("Count", new ByteTag("Count", (byte)item.getAmount()));
data.put("Slot", new ByteTag("Slot", (byte)i));
data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
data.put("Slot", new ByteTag("Slot", (byte) i));
itemsList.add(itemTag);
}
}
Map<String,Tag> values = new HashMap<String,Tag>();
Map<String, Tag> values = new HashMap<String, Tag>();
values.put("Items", new ListTag("Items", CompoundTag.class, itemsList));
return values;
}
@ -123,19 +123,18 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
throws DataException {
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException {
if (values == null) {
return;
}
Tag t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag)t).getValue().equals("Trap")) {
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Trap")) {
throw new DataException("'Trap' tile entity expected");
}
ListTag items = (ListTag)Chunk.getChildTag(values, "Items", ListTag.class);
ListTag items = (ListTag) Chunk.getChildTag(values, "Items", ListTag.class);
BaseItemStack[] newItems = new BaseItemStack[27];
for (Tag tag : items.getValue()) {
@ -143,16 +142,16 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
throw new DataException("CompoundTag expected as child tag of Trap Items");
}
CompoundTag item = (CompoundTag)tag;
Map<String,Tag> itemValues = item.getValue();
CompoundTag item = (CompoundTag) tag;
Map<String, Tag> itemValues = item.getValue();
short id = (Short)((ShortTag)Chunk.getChildTag(itemValues, "id", ShortTag.class))
short id = (Short) ((ShortTag) Chunk.getChildTag(itemValues, "id", ShortTag.class))
.getValue();
short damage = (Short)((ShortTag)Chunk.getChildTag(itemValues, "Damage", ShortTag.class))
short damage = (Short) ((ShortTag) Chunk.getChildTag(itemValues, "Damage", ShortTag.class))
.getValue();
byte count = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Count", ByteTag.class))
byte count = (Byte) ((ByteTag) Chunk.getChildTag(itemValues, "Count", ByteTag.class))
.getValue();
byte slot = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
byte slot = (Byte) ((ByteTag) Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
.getValue();
if (slot >= 0 && slot <= 8) {

View File

@ -36,7 +36,7 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
* Store the list of items.
*/
private BaseItemStack[] items;
/**
* Fuel time.
*/
@ -95,7 +95,7 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
public void setItems(BaseItemStack[] items) {
this.items = items;
}
/**
* @return the burnTime
*/
@ -139,22 +139,22 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException {
List<Tag> itemsList = new ArrayList<Tag>();
for (int i = 0; i < items.length; ++i) {
BaseItemStack item = items[i];
if (item != null) {
Map<String,Tag> data = new HashMap<String,Tag>();
Map<String, Tag> data = new HashMap<String, Tag>();
CompoundTag itemTag = new CompoundTag("Items", data);
data.put("id", new ShortTag("id", (short)item.getType()));
data.put("id", new ShortTag("id", (short) item.getType()));
data.put("Damage", new ShortTag("Damage", item.getDamage()));
data.put("Count", new ByteTag("Count", (byte)item.getAmount()));
data.put("Slot", new ByteTag("Slot", (byte)i));
data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
data.put("Slot", new ByteTag("Slot", (byte) i));
itemsList.add(itemTag);
}
}
Map<String,Tag> values = new HashMap<String,Tag>();
Map<String, Tag> values = new HashMap<String, Tag>();
values.put("Items", new ListTag("Items", CompoundTag.class, itemsList));
values.put("BurnTime", new ShortTag("BurnTime", burnTime));
values.put("CookTime", new ShortTag("CookTime", cookTime));
@ -167,18 +167,18 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
throws DataException {
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException {
if (values == null) {
return;
}
Tag t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag)t).getValue().equals("Furnace")) {
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Furnace")) {
throw new DataException("'Furnace' tile entity expected");
}
ListTag items = (ListTag)Chunk.getChildTag(values, "Items", ListTag.class);
ListTag items = (ListTag) Chunk.getChildTag(values, "Items", ListTag.class);
BaseItemStack[] newItems = new BaseItemStack[27];
for (Tag tag : items.getValue()) {
@ -186,16 +186,16 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
throw new DataException("CompoundTag expected as child tag of Trap Items");
}
CompoundTag item = (CompoundTag)tag;
Map<String,Tag> itemValues = item.getValue();
CompoundTag item = (CompoundTag) tag;
Map<String, Tag> itemValues = item.getValue();
short id = (Short)((ShortTag)Chunk.getChildTag(itemValues, "id", ShortTag.class))
short id = (Short) ((ShortTag) Chunk.getChildTag(itemValues, "id", ShortTag.class))
.getValue();
short damage = (Short)((ShortTag)Chunk.getChildTag(itemValues, "Damage", ShortTag.class))
short damage = (Short) ((ShortTag) Chunk.getChildTag(itemValues, "Damage", ShortTag.class))
.getValue();
byte count = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Count", ByteTag.class))
byte count = (Byte) ((ByteTag) Chunk.getChildTag(itemValues, "Count", ByteTag.class))
.getValue();
byte slot = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
byte slot = (Byte) ((ByteTag) Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
.getValue();
if (slot >= 0 && slot <= 26) {
@ -207,12 +207,12 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
t = values.get("BurnTime");
if (t instanceof ShortTag) {
burnTime = ((ShortTag)t).getValue();
burnTime = ((ShortTag) t).getValue();
}
t = values.get("CookTime");
if (t instanceof ShortTag) {
cookTime = ((ShortTag)t).getValue();
cookTime = ((ShortTag) t).getValue();
}
}
}

View File

@ -163,6 +163,6 @@ public final class ItemID {
public static final int DISC_MELLOHI = 2262;
public static final int DISC_STAL = 2263;
public static final int DISC_STRAD = 2264;
public static final int DISC_WARD = 2265;
public static final int DISC_WARD = 2265;
public static final int DISC_11 = 2266;
}

View File

@ -146,7 +146,7 @@ public enum ItemType {
FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"),
BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"),
STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"),
MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus" ,"mycel"),
MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus", "mycel"),
LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"),
NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"),
NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"),
@ -306,11 +306,11 @@ public enum ItemType {
/**
* Stores a map of the IDs for fast access.
*/
private static final Map<Integer,ItemType> ids = new HashMap<Integer,ItemType>();
private static final Map<Integer, ItemType> ids = new HashMap<Integer, ItemType>();
/**
* Stores a map of the names for fast access.
*/
private static final Map<String,ItemType> lookup = new LinkedHashMap<String,ItemType>();
private static final Map<String, ItemType> lookup = new LinkedHashMap<String, ItemType>();
private final int id;
private final String name;
@ -335,7 +335,7 @@ public enum ItemType {
ItemType(int id, String name, String lookupKey) {
this.id = id;
this.name = name;
this.lookupKeys = new String[] {lookupKey};
this.lookupKeys = new String[] { lookupKey };
}
/**
@ -344,7 +344,7 @@ public enum ItemType {
* @param id
* @param name
*/
ItemType(int id, String name, String ... lookupKeys) {
ItemType(int id, String name, String... lookupKeys) {
this.id = id;
this.name = name;
this.lookupKeys = lookupKeys;
@ -412,32 +412,32 @@ public enum ItemType {
*/
public static ItemType lookup(String name, boolean fuzzy) {
String testName = name.replace(" ", "").toLowerCase();
ItemType type = lookup.get(testName);
if (type != null) {
return type;
}
if (!fuzzy) {
return null;
}
int minDist = -1;
for (Entry<String, ItemType> entry : lookup.entrySet()) {
if (entry.getKey().charAt(0) != testName.charAt(0)) {
continue;
}
int dist = StringUtil.getLevenshteinDistance(entry.getKey(), testName);
if ((dist < minDist || minDist == -1) && dist < 2) {
minDist = dist;
type = entry.getValue();
}
}
return type;
}

View File

@ -126,9 +126,9 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException {
Map<String,Tag> values = new HashMap<String,Tag>();
Map<String, Tag> values = new HashMap<String, Tag>();
values.put("EntityId", new StringTag("EntityId", mobType));
values.put("Delay", new ShortTag("Delay", delay));
return values;
@ -140,19 +140,19 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
throws DataException {
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException {
if (values == null) {
return;
}
Tag t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag)t).getValue().equals("MobSpawner")) {
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("MobSpawner")) {
throw new DataException("'MobSpawner' tile entity expected");
}
StringTag mobTypeTag = (StringTag)Chunk.getChildTag(values, "EntityId", StringTag.class);
ShortTag delayTag = (ShortTag)Chunk.getChildTag(values, "Delay", ShortTag.class);
StringTag mobTypeTag = (StringTag) Chunk.getChildTag(values, "EntityId", StringTag.class);
ShortTag delayTag = (ShortTag) Chunk.getChildTag(values, "Delay", ShortTag.class);
this.mobType = mobTypeTag.getValue();
this.delay = delayTag.getValue();

View File

@ -85,16 +85,16 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
public String getTileEntityID() {
return "Music";
}
/**
* Store additional tile entity data. Returns true if the data is used.
*
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException {
Map<String,Tag> values = new HashMap<String,Tag>();
Map<String, Tag> values = new HashMap<String, Tag>();
values.put("note", new ByteTag("note", note));
return values;
}
@ -105,22 +105,22 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
throws DataException {
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException {
if (values == null) {
return;
}
Tag t;
t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag)t).getValue().equals("Music")) {
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Music")) {
throw new DataException("'Music' tile entity expected");
}
t = values.get("note");
if (t instanceof ByteTag) {
note = ((ByteTag)t).getValue();
note = ((ByteTag) t).getValue();
}
}
}

View File

@ -42,7 +42,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
*/
public SignBlock(int type, int data) {
super(type, data);
this.text = new String[]{ "", "", "", "" };
this.text = new String[] { "", "", "", "" };
}
/**
@ -86,9 +86,9 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException {
Map<String,Tag> values = new HashMap<String,Tag>();
Map<String, Tag> values = new HashMap<String, Tag>();
values.put("Text1", new StringTag("Text1", text[0]));
values.put("Text2", new StringTag("Text2", text[1]));
values.put("Text3", new StringTag("Text3", text[2]));
@ -102,39 +102,39 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
throws DataException {
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException {
if (values == null) {
return;
}
Tag t;
text = new String[]{ "", "", "", "" };
text = new String[] { "", "", "", "" };
t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag)t).getValue().equals("Sign")) {
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Sign")) {
throw new DataException("'Sign' tile entity expected");
}
t = values.get("Text1");
if (t instanceof StringTag) {
text[0] = ((StringTag)t).getValue();
text[0] = ((StringTag) t).getValue();
}
t = values.get("Text2");
if (t instanceof StringTag) {
text[1] = ((StringTag)t).getValue();
text[1] = ((StringTag) t).getValue();
}
t = values.get("Text3");
if (t instanceof StringTag) {
text[2] = ((StringTag)t).getValue();
text[2] = ((StringTag) t).getValue();
}
t = values.get("Text4");
if (t instanceof StringTag) {
text[3] = ((StringTag)t).getValue();
text[3] = ((StringTag) t).getValue();
}
}
}

View File

@ -35,20 +35,22 @@ public interface TileEntityBlock {
* @return title entity ID
*/
public String getTileEntityID();
/**
* Store additional tile entity data.
*
* @return map of values
* @throws DataException
*/
public Map<String,Tag> toTileEntityNBT()
public Map<String, Tag> toTileEntityNBT()
throws DataException;
/**
* Get additional information from the title entity data.
*
* @param values
* @throws DataException
*/
public void fromTileEntityNBT(Map<String,Tag> values)
public void fromTileEntityNBT(Map<String, Tag> values)
throws DataException;
}