本文整理汇总了Java中org.bukkit.map.MapPalette.DARK_GRAY属性的典型用法代码示例。如果您正苦于以下问题:Java MapPalette.DARK_GRAY属性的具体用法?Java MapPalette.DARK_GRAY怎么用?Java MapPalette.DARK_GRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.map.MapPalette
的用法示例。
在下文中一共展示了MapPalette.DARK_GRAY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawText
public void drawText(int x, int y, MapFont font, String text) {
int xStart = x;
byte color = MapPalette.DARK_GRAY;
if (!font.isValid(text)) {
throw new IllegalArgumentException("text contains invalid characters");
}
for (int i = 0; i < text.length(); ++i) {
char ch = text.charAt(i);
if (ch == '\n') {
x = xStart;
y += font.getHeight() + 1;
continue;
} else if (ch == '\u00A7') {
int j = text.indexOf(';', i);
if (j >= 0) {
try {
color = Byte.parseByte(text.substring(i + 1, j));
i = j;
continue;
}
catch (NumberFormatException ex) {}
}
}
CharacterSprite sprite = font.getChar(text.charAt(i));
for (int r = 0; r < font.getHeight(); ++r) {
for (int c = 0; c < sprite.getWidth(); ++c) {
if (sprite.get(r, c)) {
setPixel(x + c, y + r, color);
}
}
}
x += sprite.getWidth() + 1;
}
}
示例2: drawText
@SuppressWarnings("deprecation")
public void drawText(int x, int y, MapFont font, String text) {
int xStart = x;
byte color = MapPalette.DARK_GRAY;
if (!font.isValid(text)) {
throw new IllegalArgumentException("text contains invalid characters");
}
for (int i = 0; i < text.length(); ++i) {
char ch = text.charAt(i);
if (ch == '\n') {
x = xStart;
y += font.getHeight() + 1;
continue;
} else if (ch == '\u00A7') {
int j = text.indexOf(';', i);
if (j >= 0) {
try {
color = Byte.parseByte(text.substring(i + 1, j));
i = j;
continue;
}
catch (NumberFormatException ex) {}
}
}
CharacterSprite sprite = font.getChar(text.charAt(i));
for (int r = 0; r < font.getHeight(); ++r) {
for (int c = 0; c < sprite.getWidth(); ++c) {
if (sprite.get(r, c)) {
setPixel(x + c, y + r, color);
}
}
}
x += sprite.getWidth() + 1;
}
}
示例3: render
/**
* Renders the given ChunkInfoRenderingRequest.
*
* @param request
* The request to render.
*/
private void render(ChunkInfoRenderingRequest request) {
byte[][] destImage = request.getData();
int minX = (request.getCenterX() >> 4) - 64;
int minZ = (request.getCenterZ() >> 4) - 64;
int maxX = minX + 128;
int maxZ = minZ + 128;
long started = System.currentTimeMillis();
ChunkInfo[] chunkInfos = plugin.getChunkInfosInRange(
request.getWorldName(), minX, minZ, maxX, maxZ);
for (ChunkInfo info : chunkInfos) {
final int localZ = info.getZ() - minZ;
final int localX = info.getX() - minX;
destImage[localZ][localX] = MapPalette.LIGHT_GRAY;
if (info.getBreakedBlocks().size() > 0)
destImage[localZ][localX] = MapPalette.DARK_GRAY;
if (info.getPlacedBlocks().size() > 0)
destImage[localZ][localX] = MapPalette.RED;
}
plugin.getLogger().info(
String.format("Rendered %d chunks in %dms", chunkInfos.length,
System.currentTimeMillis() - started));
request.setDone(true);
}
示例4: drawTextOld
public static void drawTextOld(MapCanvas canvas, int x, int y, int width, int height, MapFont font, String text)
{
int xStart = x;
byte color = MapPalette.DARK_GRAY;
/* String text = "";
for(char c : rawText.toCharArray())
if(MinecraftFont.Font.getChar(c) != null)
text += c;*/
if(!MinecraftFont.Font.isValid(text))
return;
for (int i = 0; i < text.length(); ++i)
{
char ch = text.charAt(i);
if (ch == '\n')
{
x = xStart;
y += font.getHeight() + 1;
continue;
}
else
if (ch == '§')
{
int j = text.indexOf(';', i);
if (j >= 0)
try
{
color = Byte.parseByte(text.substring(i + 1, j));
i = j;
continue;
}
catch (NumberFormatException ex)
{
}
}
CharacterSprite sprite = font.getChar(text.charAt(i));
for(int r = 0; r < font.getHeight(); ++r)
for(int c = 0; c < sprite.getWidth(); ++c)
for(int xx = 0; xx < width; xx++)
for(int yy = 0; yy < height; yy++)
if(sprite.get(r, c))
canvas.setPixel(x + xx + c * width, y + yy + r * height, color);
x += (sprite.getWidth() + 1) * width;
}
}