Java 类org.bukkit.map.MapCanvas 实例源码
项目:Uranium
文件:CraftMapRenderer.java
@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);
}
}
项目:ThermosRebased
文件:CraftMapRenderer.java
@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);
}
}
项目:Breakpoint
文件:AdventMapRenderer.java
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);
}
}
}
}
项目:Breakpoint
文件:BPMapRenderer.java
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)]);
}
}
项目:Breakpoint
文件:BPMapRenderer.java
public void drawAvailableColors(MapCanvas canvas)
{
for (int y = 0; y < MAP_SIZE / 4; y++)
for (int x = 0; x < MAP_SIZE / 4; x++)
{
int id = y * (MAP_SIZE / 4) + x;
try
{
drawRectangle(canvas, x * 4, y * 4, 4, 4, BPMapPalette.matchColor(BPMapPalette.colors[id]));
}
catch (Exception e)
{
return;
}
}
}
项目:LagMonitor
文件:ThreadsGraph.java
@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;
}
项目:LagMonitor
文件:CombinedGraph.java
@Override
public int renderGraphTick(MapCanvas canvas, int nextPosX) {
for (int i = 0; i < graphRenderers.length; i++) {
GraphRenderer graphRenderer = graphRenderers[i];
int position = this.componentLastPos[i];
position++;
//index starts with 0 so in the end - 1
int maxComponentWidth = (i + 1) * componentWidth + i * SPACES - 1;
if (position > maxComponentWidth) {
//reset it to the start pos
position = i * componentWidth + i * SPACES;
}
graphRenderer.renderGraphTick(canvas, position);
this.componentLastPos[i] = position;
}
return 100;
}
项目:Skellett
文件:EffMapDrawCursor.java
@Override
protected void execute(Event e) {
SkellettMapRenderer render = SkellettMapRenderer.getRenderer(map.getSingle(e));
if (render != null) {
render.update(new MapRenderTask() {
@SuppressWarnings("deprecation")
@Override
public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
MapCursor cursor = new MapCursor((byte)x.getSingle(e).intValue(), (byte)y.getSingle(e).intValue(), (byte)direction.getSingle(e).intValue(), (byte) 2, true);
try {
MapCursor.Type type = MapCursor.Type.valueOf(cursorType.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
if (type != null) {
cursor.setType(type);
}
} catch (IllegalArgumentException error) {
Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cUnknown mapcursor type " + cursorType.getSingle(e)));
return;
}
mapCanvas.getCursors().addCursor(cursor);
}
});
}
}
项目:Skellett
文件:EffMapDrawImage.java
@Override
protected void execute(Event e) {
SkellettMapRenderer render = SkellettMapRenderer.getRenderer(map.getSingle(e));
if (render != null && image != null) {
Integer xget = 0;
Integer yget = 0;
if (x != null || y != null) {
xget = x.getSingle(e).intValue();
yget = y.getSingle(e).intValue();
}
final Integer xcoord = xget;
final Integer ycoord = yget;
render.update(new MapRenderTask() {
@Override
public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
mapCanvas.drawImage(xcoord, ycoord, image.getSingle(e));
}
});
}
}
项目:KCauldron
文件:CraftMapRenderer.java
@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);
}
}
项目:CauldronGit
文件:CraftMapRenderer.java
@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);
}
}
项目:Cauldron-Old
文件:CraftMapRenderer.java
@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);
}
}
项目:Cauldron-Reloaded
文件:CraftMapRenderer.java
@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);
}
}
项目:FFoKC
文件:CraftMapRenderer.java
@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);
}
}
项目:CraftBukkit
文件:CraftMapRenderer.java
@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);
}
}
项目:Breakpoint
文件:AdventMapRenderer.java
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);
}
}
}
}
项目:Breakpoint
文件:BPMapRenderer.java
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)]);
}
}
项目:Breakpoint
文件:BPMapRenderer.java
public void drawAvailableColors(MapCanvas canvas)
{
for (int y = 0; y < MAP_SIZE / 4; y++)
for (int x = 0; x < MAP_SIZE / 4; x++)
{
int id = y * (MAP_SIZE / 4) + x;
try
{
drawRectangle(canvas, x * 4, y * 4, 4, 4, BPMapPalette.matchColor(BPMapPalette.colors[id]));
}
catch (Exception e)
{
return;
}
}
}
项目:beaconz
文件:BeaconMap.java
@Override
@SuppressWarnings("deprecation")
public void render(MapView map, MapCanvas canvas, Player player) {
// Only render when on this world
if (!map.getWorld().equals(plugin.getBeaconzWorld())) {
return;
}
// Only render if the map is in a hand
ItemStack inMainHand = player.getInventory().getItemInMainHand();
ItemStack inOffHand = player.getInventory().getItemInOffHand();
if (inMainHand.getType().equals(Material.MAP) || inOffHand.getType().equals(Material.MAP)) {
//Bukkit.getLogger().info("DEBUG: render");
// here's where you do your drawing - see the Javadocs for the MapCanvas class for
// the methods you can use
canvas.drawText(10, 10, MinecraftFont.Font, Lang.beaconMapBeaconMap);
// Get the text
BeaconObj beacon = plugin.getRegister().getBeaconMap(map.getId());
if (beacon != null) {
canvas.drawText(10, 20, MinecraftFont.Font, Lang.generalLocation + ": " + beacon.getName());
canvas.setPixel(64, 64, (byte) 64);
} else {
canvas.drawText(10, 20, MinecraftFont.Font, Lang.beaconMapUnknownBeacon);
}
}
}
项目:LagMonitor
文件:ThreadsGraph.java
@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;
}
项目:LagMonitor
文件:CombinedGraph.java
@Override
public int renderGraphTick(MapCanvas canvas, int nextPosX) {
for (int i = 0; i < graphRenderers.length; i++) {
GraphRenderer graphRenderer = graphRenderers[i];
int position = this.componentLastPos[i];
position++;
//index starts with 0 so in the end - 1
int maxComponentWidth = (i + 1) * componentWidth + i * SPACES - 1;
if (position > maxComponentWidth) {
//reset it to the start pos
position = i * componentWidth + i * SPACES;
}
graphRenderer.renderGraphTick(canvas, position);
this.componentLastPos[i] = position;
}
return 100;
}
项目:Almura-Server
文件:CraftMapRenderer.java
@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);
}
}
项目:Tweakkit-Server
文件:CraftMapRenderer.java
@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);
}
}
项目:Cauldron
文件:CraftMapRenderer.java
@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);
}
}
项目:MCPainter
文件:ImgRenderer.java
/**
* 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++;
}
}
}
项目:ImgMap-BufferOverflow
文件:GifRenderer.java
@Override
public void render(MapView view, MapCanvas canvas, Player player){
if(cacher == null){
cacher = new CachingRunnable(view.getId(), file);
Thread thread = ThreadCallback.createThread(cacher, new Runnable() {
@Override
public void run() {
READY.compareAndSet(false, true);
}
});
thread.start();
} else if(READY.get()){
if(animation == null){
animation = new AnimationRunnable(cacher.getPackets(), cacher.getDelay());
animation.addPlayer(player);
animation.start();
} else {
animation.addPlayer(player);
}
}
}
项目:EndHQ-Libraries
文件:ImageRenderer.java
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
canvas.drawImage(0, 0, img);
if(m!=null) {
if(m.getParameterTypes().length==2) {
if(m.getParameterTypes()[0] == MapCanvas.class && m.getParameterTypes()[1] == Player.class) {
if(m.getReturnType().equals(Void.TYPE)) {
m.setAccessible(true);
try {
m.invoke(null, canvas, player);
} catch (Exception e) {
//e.printStackTrace();
BukkitPlugin.getInst().getLogger().info("Failed to write to map.");
}
}
}
}
}
}
项目:SpigotSource
文件:CraftMapRenderer.java
@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());
}
}
项目:Craft-city
文件:CraftMapRenderer.java
@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);
}
}
项目:MCPBukkit
文件:CraftMapRenderer.java
@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));
}
}
项目:SuperiorCraft
文件:GameManRenderer.java
@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...");
}
项目:Java-Snippets
文件:ImageRenderer.java
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
//the image is just for the player who requested a new key
if (image != null) {
canvas.drawImage(0, 0, image);
//release ressources in order to prevent memory leaks
image = null;
}
}
项目:SuperiorCraft
文件:GameManRenderer.java
@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...");
}
项目:SecureMyAccount
文件:ImageRenderer.java
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
//the image is just for the player who requested a new key
if (image != null && player.getUniqueId().equals(forPlayer)) {
canvas.drawImage(0, 0, image);
//release ressources in order to prevent memory leaks
image = null;
}
}
项目:MC2FA
文件:ImageRenderer.java
@SuppressWarnings("deprecation")
@Override
public void render(MapView view, MapCanvas canvas, Player player) {
if (this.hasRendered) {
return;
}
if (this.cacheImage.get() != null) {
canvas.drawImage(0, 0, this.cacheImage.get());
this.hasRendered = true;
} else {
player.sendMessage(ChatColor.RED + "Attempted to render the image, but the cached image was null!");
this.hasRendered = true;
}
}
项目:Breakpoint
文件:AdventMapRenderer.java
@Override
public void render(MapView view, MapCanvas canvas, Player player)
{
String playerName = player.getName();
boolean earned = advm.getGift().hasEarned(playerName);
drawRectangleFade(canvas, 0, 0, MAP_SIZE, MAP_SIZE, COLOR_BACKGROUND, 0);
drawIcons(canvas);
drawNumbers(canvas);
drawHeader(canvas);
drawDescription(canvas);
drawGlow(canvas, earned);
}
项目:Breakpoint
文件:AdventMapRenderer.java
public void drawHeader(MapCanvas canvas)
{
int width = getWidth(header) * 2;
int height = MinecraftFont.Font.getHeight() * 2;
int startX = (MAP_SIZE - width) / 2;
int startY = (iconStartY - 1 - height) / 3;
drawText(canvas, startX, startY + 1, 2, 2, MinecraftFont.Font, header, COLOR_HEADER_BACKGROUND);
drawText(canvas, startX, startY, 2, 2, MinecraftFont.Font, header, COLOR_HEADER);
}
项目:Breakpoint
文件:AdventMapRenderer.java
public void drawDescription(MapCanvas canvas)
{
int width = getWidth(description);
int height = MinecraftFont.Font.getHeight();
int startX = (MAP_SIZE - width) / 2;
int startY = ((iconStartY - 1 - height) / 4) * 3;
drawText(canvas, startX, startY + 1, 1, 1, MinecraftFont.Font, description, COLOR_DESCRIPTION_BACKGROUND);
drawText(canvas, startX, startY, 1, 1, MinecraftFont.Font, description, COLOR_DESCRIPTION);
}
项目:Breakpoint
文件:VoteRenderer.java
@Override
public void render(MapView view, MapCanvas canvas, Player player)
{
byte textFrontColor = BPMapPalette.getColor(BPMapPalette.WHITE, 2);
byte textBackColor = BPMapPalette.getColor(BPMapPalette.DARK_GRAY, 0);
int textWidth = 2;//MAP_SIZE / getWidth(name);
int textHeight = 2;
drawBytes(canvas, image);
drawText(canvas, 3, 3, textWidth, textHeight, MinecraftFont.Font, name, textBackColor);
drawText(canvas, 2, 2, textWidth, textHeight, MinecraftFont.Font, name, textFrontColor);
}
项目:Breakpoint
文件:SizeRenderer.java
public void drawSize(MapCanvas canvas)
{
String sSize = Integer.toString(size);
int totalWidth = getWidth(sSize);
int fontWidth = MAP_SIZE / totalWidth;
int startX = ((MAP_SIZE - (totalWidth * fontWidth)) / 2);
int startY = ((MAP_SIZE - (MinecraftFont.Font.getHeight() * fontHeight)) / 2);
drawRectangle(canvas, 0, 0, MAP_SIZE, MAP_SIZE, backgroundColor);
drawText(canvas, startX, startY, fontWidth, fontHeight, MinecraftFont.Font, sSize, foregroundColor);
}