本文整理汇总了Java中org.bukkit.map.MapCanvas.setPixel方法的典型用法代码示例。如果您正苦于以下问题:Java MapCanvas.setPixel方法的具体用法?Java MapCanvas.setPixel怎么用?Java MapCanvas.setPixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.map.MapCanvas
的用法示例。
在下文中一共展示了MapCanvas.setPixel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (UUID key : worldMap.playersVisibleOnMap.keySet()) { // Spigot string -> uuid
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayer(key); // Spigot
if (other != null && !player.canSee(other)) {
continue;
}
net.minecraft.world.storage.MapData.MapCoord decoration = (net.minecraft.world.storage.MapData.MapCoord) worldMap.playersVisibleOnMap.get(key);
cursors.addCursor(decoration.centerX, decoration.centerZ, (byte) (decoration.iconRotation & 15), decoration.iconSize);
}
}
示例2: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (Object key : worldMap.playersVisibleOnMap.keySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayerExact((String) key);
if (other != null && !player.canSee(other)) {
continue;
}
net.minecraft.world.storage.MapData.MapCoord decoration = (net.minecraft.world.storage.MapData.MapCoord) worldMap.playersVisibleOnMap.get(key);
cursors.addCursor(decoration.centerX, decoration.centerZ, (byte) (decoration.iconRotation & 15), decoration.iconSize);
}
}
示例3: drawNumbers
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
public void drawNumbers(MapCanvas canvas)
{
for(int i = 0; i < icons.length && i < dayOfMonth; i++)
if(icons[i] != null)
{
int numberX = iconStartX + (i % 6) * 18 + (16 - numbers[i].length) / 2;
for(int x = 0; x < numbers[i].length; x++)
{
int numberY = iconStartY + (i / 6) * 18 + (16 - numbers[i][x].length) / 2;
for(int y = 0; y < numbers[i][x].length; y++)
{
int xx = numberX + x;
int yy = numberY + y;
Byte color = numbers[i][x][y];
if(color != null)
canvas.setPixel(xx, yy, color);
}
}
}
}
示例4: drawRectangleFade
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
public static void drawRectangleFade(MapCanvas canvas, int startX, int startY, int width, int height, byte[] color, int fadeId)
{
int colorLength = color.length + color.length - 1;
double barHeight = height / colorLength;
for (double bar = 0; bar < colorLength; bar++)
{
int barStartY = (int) (barHeight * bar);
int reminder = (int) bar % 2;
boolean fade = reminder != 0;
if (fade)
for (int x = startX; x < startX + width; x++)
for (int y = startY; y < startY + height; y++)
{
int color1 = (int) (bar - reminder) / 2;
int color2 = (int) (bar - reminder) / 2 + 1;
int curColor = (x + y + barStartY) % 2 == fadeId ? color1 : color2;
canvas.setPixel(x, y + barStartY, color[curColor]);
}
else
for (int x = startX; x < startX + width; x++)
for (int y = startY; y < startY + height; y++)
canvas.setPixel(x, y + barStartY, color[(int) (bar / 2)]);
}
}
示例5: renderGraphTick
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public int renderGraphTick(MapCanvas canvas, int nextPosX) {
int threadCount = threadBean.getThreadCount();
int daemonCount = threadBean.getDaemonThreadCount();
//round up to the nearest multiple of 5
int roundedMax = (int) (5 * (Math.ceil((float) threadCount / 5)));
int threadHeight = getHeightScaled(roundedMax, threadCount);
int daemonHeight = getHeightScaled(roundedMax, daemonCount);
for (int yPos = MAX_HEIGHT - threadHeight; yPos < 128; yPos++) {
canvas.setPixel(nextPosX, yPos, MAX_COLOR);
}
for (int yPos = MAX_HEIGHT - daemonHeight; yPos < 128; yPos++) {
canvas.setPixel(nextPosX, yPos, USED_COLOR);
}
//these is the max number of all threads
return threadCount;
}
示例6: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (Map.Entry<UUID, MapData.MapCoord> key : worldMap.playersVisibleOnMap.entrySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayer(key.getKey());
if (other != null && !player.canSee(other)) {
continue;
}
MapData.MapCoord decoration = key.getValue();
cursors.addCursor(decoration.centerX, decoration.centerZ, (byte) (decoration.iconRotation & 15), decoration.iconSize);
}
}
示例7: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (Object key : worldMap.decorations.keySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayerExact((String) key);
if (other != null && !player.canSee(other)) {
continue;
}
WorldMapDecoration decoration = (WorldMapDecoration) worldMap.decorations.get(key);
cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), decoration.type);
}
}
示例8: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (Object key : worldMap.g.keySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayerExact((String) key);
if (other != null && !player.canSee(other)) {
continue;
}
WorldMapDecoration decoration = (WorldMapDecoration) worldMap.g.get(key);
cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), decoration.type);
}
}
示例9: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
/**
* Render image on the map
* @param mv Map item map view
* @param mc Map item map canvas
* @param player Player that the redraw is performed for
*/
@Override
public void render(final MapView mv, final MapCanvas mc, Player player) {
if (m_isRendered) {
return;
}
m_isRendered = true;
int idx = 0;
for (int y = 0; y < MAX_SIZE; y++) {
for (int x = 0; x < MAX_SIZE; x++) {
mc.setPixel(x, y, m_img[idx]);
idx++;
}
}
}
示例10: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (UUID key : worldMap.decorations.keySet()) { // Spigot string -> uuid.
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayer(key); // Spigot
if (other != null && !player.canSee(other)) {
continue;
}
MapIcon decoration = (MapIcon) worldMap.decorations.get(key);
cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRotation() & 15), decoration.getType());
}
}
示例11: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.field_76198_e[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (Object key : worldMap.field_76203_h.keySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayerExact((String) key);
if (other != null && !player.canSee(other)) {
continue;
}
net.minecraft.world.storage.MapCoord decoration = (net.minecraft.world.storage.MapCoord) worldMap.field_76203_h.get(key);
cursors.addCursor(decoration.field_76214_b, decoration.field_76215_c, (byte) (decoration.field_76212_d & 15), (byte) (decoration.field_76216_a));
}
}
示例12: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView view, MapCanvas canvas, Player player) {
for (int i = GameManRenderer.i; i < 100; i++) {
canvas.setPixel(10, 10, (byte) 10);
GameManRenderer.i += 30;
}
//player.sendMessage("You've unlocked one of our greatest secrets...");
}
示例13: render
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public void render(MapView view, MapCanvas canvas, Player player)
{
int surfaceX = getSurfaceX();
int surfaceY = getSurfaceY();
for(int x = 0; x < MAP_SIZE; x++)
for(int y = 0; y < MAP_SIZE; y++)
{
byte color = display.getColor(surfaceX + x, surfaceY + y);
canvas.setPixel(x, y, color);
}
}
示例14: drawText
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
public void drawText(MapCanvas canvas, int x, int y, int width, int height, MapFont font, String text, byte color)
{
int xStart = x;
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;
}
if(ch == COLOR_CHAR)
{
int j = text.indexOf(';', i);
if(j >= 0)
try
{
color = Byte.parseByte(text.substring(i + 1, j));
i = j;
continue;
}
catch(NumberFormatException ex) { }
}
org.bukkit.map.MapFont.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;
}
}
示例15: renderGraphTick
import org.bukkit.map.MapCanvas; //导入方法依赖的package包/类
@Override
public int renderGraphTick(MapCanvas canvas, int nextPosX) {
int loadedClasses = classBean.getLoadedClassCount();
//round up to the nearest multiple of 5
int roundedMax = (int) (5 * (Math.ceil((float) loadedClasses / 5)));
int loadedHeight = getHeightScaled(roundedMax, loadedClasses);
for (int yPos = MAX_HEIGHT - loadedHeight; yPos < 128; yPos++) {
canvas.setPixel(nextPosX, yPos, MAX_COLOR);
}
//these is the max number
return loadedClasses;
}