本文整理汇总了Java中com.protolambda.blocktopograph.map.Block类的典型用法代码示例。如果您正苦于以下问题:Java Block类的具体用法?Java Block怎么用?Java Block使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Block类属于com.protolambda.blocktopograph.map包,在下文中一共展示了Block类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseTag
import com.protolambda.blocktopograph.map.Block; //导入依赖的package包/类
@Override
public String parseTag(Tag tag) {
if (tag instanceof CompoundTag) {
int damage = 0, id = 0, count = 0;
for (Tag child : ((CompoundTag) tag).getValue()) {
switch (child.getName()) {
case "Count":
count = (byte) child.getValue();
break;
case "Damage":
damage = (short) child.getValue();
break;
case "id":
id = (short) child.getValue();
break;
}
}
if (id == 0) {
return "Empty";
}
Block block = Block.getBlock(id, damage);
if (block == null || block.subName == null) {
block = Block.getBlock(id, 0);
if (block == null) {
return String.format(format, "unknown", damage);
}
return String.format(format, block.name, damage);
}
return String.format(format, block.subName + " " + block.name, count);
}
return "";
}
示例2: parseTag
import com.protolambda.blocktopograph.map.Block; //导入依赖的package包/类
@Override
public String parseTag(Tag tag) {
if (tag instanceof ShortTag) {
short id = ((ShortTag) tag).getValue();
Block block = Block.getBlock(id, 0);
if (block == null) {
return String.format(format, "Unknown");
}
return String.format(format, block.name);
}
return "";
}
示例3: parseTag
import com.protolambda.blocktopograph.map.Block; //导入依赖的package包/类
@Override
public String parseTag(Tag tag) {
if (tag instanceof CompoundTag) {
int slot = 0, id = 0, count = 0, damage = 0;
for (Tag child : ((CompoundTag) tag).getValue()) {
switch (child.getName()) {
case "Count":
count = (byte) child.getValue();
break;
case "Damage":
damage = (short) child.getValue();
break;
case "Slot":
slot = (byte) child.getValue();
break;
case "id":
id = (short) child.getValue();
break;
}
}
String blockString = "";
if (showSlot && count <= 0) {
blockString = "Empty";
} else {
Block block = Block.getBlock(id, damage);
if (block == null || block.subName == null) {
block = Block.getBlock(id, 0);
if (block == null) {
blockString = "unknown";
} else {
blockString = block.name;
}
} else {
blockString = block.subName + " " + block.name;
}
}
if (showSlot) {
return String.format(format, slot, blockString, count);
} else {
return String.format(format, blockString, count);
}
}
return "";
}