Added chunk loading to rendering.
This commit is contained in:
parent
fde56275fe
commit
138aed8c33
8 changed files with 175 additions and 289 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package org.dynmap.kzedmap;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import org.dynmap.MapTile;
|
||||
|
||||
public class KzedZoomedMapTile extends MapTile {
|
||||
|
|
@ -9,8 +8,10 @@ public class KzedZoomedMapTile extends MapTile {
|
|||
public String getName() {
|
||||
return "z" + originalTile.renderer.getName() + "_" + getTileX() + "_" + getTileY();
|
||||
}
|
||||
|
||||
public BufferedImage unzoomedImage;
|
||||
public KzedMapTile originalTile;
|
||||
|
||||
public KzedZoomedMapTile(KzedMap map, BufferedImage unzoomedImage, KzedMapTile original) {
|
||||
super(map);
|
||||
this.unzoomedImage = unzoomedImage;
|
||||
|
|
@ -18,38 +19,37 @@ public class KzedZoomedMapTile extends MapTile {
|
|||
}
|
||||
|
||||
public int getTileX() {
|
||||
return ztilex(originalTile.px+KzedMap.tileWidth);
|
||||
return ztilex(originalTile.px + KzedMap.tileWidth);
|
||||
}
|
||||
|
||||
|
||||
public int getTileY() {
|
||||
return ztiley(originalTile.py);
|
||||
}
|
||||
|
||||
|
||||
private static int ztilex(int x) {
|
||||
if(x < 0)
|
||||
return x + (x % (KzedMap.tileWidth*2));
|
||||
if (x < 0)
|
||||
return x + (x % (KzedMap.tileWidth * 2));
|
||||
else
|
||||
return x - (x % (KzedMap.tileWidth*2));
|
||||
return x - (x % (KzedMap.tileWidth * 2));
|
||||
}
|
||||
|
||||
/* zoomed-out tile Y for tile position y */
|
||||
private static int ztiley(int y)
|
||||
{
|
||||
if(y < 0)
|
||||
return y + (y % (KzedMap.tileHeight*2));
|
||||
private static int ztiley(int y) {
|
||||
if (y < 0)
|
||||
return y + (y % (KzedMap.tileHeight * 2));
|
||||
else
|
||||
return y - (y % (KzedMap.tileHeight*2));
|
||||
return y - (y % (KzedMap.tileHeight * 2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getName().hashCode();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof KzedZoomedMapTile) {
|
||||
return ((KzedZoomedMapTile)obj).originalTile.equals(originalTile);
|
||||
return ((KzedZoomedMapTile) obj).originalTile.equals(originalTile);
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue