本文整理匯總了Java中org.bukkit.DyeColor.getByDyeData方法的典型用法代碼示例。如果您正苦於以下問題:Java DyeColor.getByDyeData方法的具體用法?Java DyeColor.getByDyeData怎麽用?Java DyeColor.getByDyeData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.DyeColor
的用法示例。
在下文中一共展示了DyeColor.getByDyeData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: read
import org.bukkit.DyeColor; //導入方法依賴的package包/類
@Override
public void read(DataInputStream input) throws IOException {
DyeColor color = DyeColor.getByDyeData(input.readByte());
PatternType patternType = PatternType.getByIdentifier(input.readUTF());
setValue(new Pattern(color, patternType));
}
示例2: prep
import org.bukkit.DyeColor; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public boolean prep(Map<String, Tag> tileData) {
// Format for banner is:
// Patterns = List of patterns
// id = String "BannerBlock"
// Base = Int color
// Then the location
// z = Int
// y = Int
// x = Int
try {
// Do the base color
int baseColor = 15 - ((IntTag) tileData.get("Base")).getValue();
// //ASkyBlock.getPlugin().getLogger().info("Base value = " +
// baseColor);
// baseColor green = 10
bannerBaseColor = DyeColor.getByDyeData((byte) baseColor);
// Do the patterns (no idea if this will work or not)
bannerPattern = new ArrayList<>();
ListTag patterns = (ListTag) tileData.get("Patterns");
if (patterns != null) {
for (Tag pattern : patterns.getValue()) {
// ASkyBlock.getPlugin().getLogger().info("pattern = " +
// pattern);
// Translate pattern to PatternType
if (pattern instanceof CompoundTag) {
CompoundTag patternColor = (CompoundTag) pattern;
// The tag is made up of pattern (String) and color
// (int)
Map<String, Tag> patternValue = patternColor.getValue();
StringTag mark = (StringTag) patternValue.get("Pattern");
Integer markColor = 15 - ((IntTag) patternValue.get("Color")).getValue();
// ASkyBlock.getPlugin().getLogger().info("mark = " +
// mark.getValue());
// ASkyBlock.getPlugin().getLogger().info("color = " +
// markColor);
DyeColor dColor = DyeColor.getByDyeData(markColor.byteValue());
// ASkyBlock.getPlugin().getLogger().info(" dye color = "
// + dColor.toString());
if (patternKey.containsKey(mark.getValue())) {
Pattern newPattern = new Pattern(dColor, patternKey.get(mark.getValue()));
bannerPattern.add(newPattern);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}