Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PixelDrawer implements PixelShader{
- @Override
- public List<MapPixel> getPixels(Player player, int centerX, int centerY, MapView.Scale scale) {
- Location center = null;
- Color regionColor = Color.BLACK;
- int width = 16;
- int height = 16;
- List< MapPixel > pixels = new ArrayList<>();
- //noinspection ConstantConditions
- center.setY( player.getLocation().getY() );
- if ( center.getWorld() != player.getWorld() ) {
- return pixels;
- }
- MapCursorLocation location = MapUtil.findRelCursorPosition( center, centerX, centerY, scale );
- int pixelX = ( location.getX() + 128 ) / 2;
- int pixelY = ( location.getY() + 128 ) / 2;
- for ( int x = 0; x < width / MapUtil.getScaleSize( scale ); x++ ) {
- for ( int y = 0; y < height / MapUtil.getScaleSize( scale ); y++ ) {
- int px = pixelX + x;
- int py = pixelY + y;
- SimpleChunkLocation sc = new SimpleChunkLocation(center.getChunk());
- Land land = GameManagement.getLandManager().getOrLoadLand(sc);
- if(land.getOwner()==null)continue;
- else{
- Kingdom k = GameManagement.getKingdomManager().getOrLoadKingdom(land.getOwner());
- KingdomPlayer kp = GameManagement.getPlayerManager().getSession(player);
- if(k.isMember(kp))regionColor=Color.CYAN;
- if(k.isAllyMember(kp))regionColor=Color.GREEN;
- if(k.isTruceWith(kp.getKingdom()))regionColor=Color.GRAY;
- }
- if ( px < 128 && py < 128 && px > -1 && py > -1 ) {
- pixels.add( new MapPixel( pixelX + x, pixelY + y, regionColor ) );
- }
- }
- }
- return pixels;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement