Merge branch 'v3.0' into v3.0
This commit is contained in:
commit
bf404ee626
42 changed files with 2125 additions and 179 deletions
|
|
@ -57,6 +57,7 @@ import org.dynmap.storage.filetree.FileTreeMapStorage;
|
|||
import org.dynmap.storage.mysql.MySQLMapStorage;
|
||||
import org.dynmap.storage.mariadb.MariaDBMapStorage;
|
||||
import org.dynmap.storage.sqllte.SQLiteMapStorage;
|
||||
import org.dynmap.storage.postgresql.PostgreSQLMapStorage;
|
||||
import org.dynmap.utils.BlockStep;
|
||||
import org.dynmap.utils.ImageIOManager;
|
||||
import org.dynmap.web.BanIPFilter;
|
||||
|
|
@ -388,6 +389,9 @@ public class DynmapCore implements DynmapCommonAPI {
|
|||
else if (storetype.equals("mariadb")) {
|
||||
defaultStorage = new MariaDBMapStorage();
|
||||
}
|
||||
else if (storetype.equals("postgres") || storetype.equals("postgresql")) {
|
||||
defaultStorage = new PostgreSQLMapStorage();
|
||||
}
|
||||
else {
|
||||
Log.severe("Invalid storage type for map data: " + storetype);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.dynmap.utils.DynmapBufferedImage;
|
|||
import org.dynmap.utils.ImageIOManager;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -96,6 +97,13 @@ public class PlayerFaces {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void copyLayersToTarget(BufferedImage srcimg, int layer1x, int layer1y, int layer2x, int layer2y, int w, int h, BufferedImage dest, int destoff, int destscansize)
|
||||
{
|
||||
int[] tmp = new int[w*h];
|
||||
copyLayersToTarget(srcimg,layer1x,layer1y,layer2x,layer2y,w,h,tmp,0,w);
|
||||
dest.setRGB(0,0,w,h,tmp,destoff,destscansize);
|
||||
}
|
||||
|
||||
private class LoadPlayerImages implements Runnable {
|
||||
public final String playername;
|
||||
|
|
@ -145,14 +153,24 @@ public class PlayerFaces {
|
|||
img.flush();
|
||||
return;
|
||||
}
|
||||
else if(img.getHeight() == 32) {
|
||||
else if( (img.getWidth() / img.getHeight()) == 2 ) { /* Is single layer skin? */
|
||||
is_64x32_skin = true;
|
||||
}
|
||||
|
||||
/* Get buffered image for face at original size */
|
||||
int scale = img.getWidth()/8 /8;
|
||||
BufferedImage faceOriginal = new BufferedImage(8*scale, 8*scale, BufferedImage.TYPE_INT_ARGB);
|
||||
// Copy face and overlay to icon
|
||||
copyLayersToTarget(img, 8*scale, 8*scale, 40*scale, 8*scale, 8*scale, 8*scale, faceOriginal, 0, 8*scale);
|
||||
|
||||
int[] faceaccessory = new int[64]; /* 8x8 of face accessory */
|
||||
/* Get buffered image for face at 8x8 */
|
||||
DynmapBufferedImage face8x8 = DynmapBufferedImage.allocateBufferedImage(8, 8);
|
||||
// Copy face and overlay to icon
|
||||
copyLayersToTarget(img, 8, 8, 40, 8, 8, 8, face8x8.argb_buf, 0, 8);
|
||||
Image face8x8_image = faceOriginal.getScaledInstance(8,8,BufferedImage.SCALE_SMOOTH);
|
||||
BufferedImage face8x8_buff = new BufferedImage(8, 8, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
face8x8_buff.getGraphics().drawImage(face8x8_image,0,0,null);
|
||||
face8x8_buff.getRGB(0,0,8,8,face8x8.argb_buf,0,8);
|
||||
/* Write 8x8 file */
|
||||
if(refreshskins || (!has_8x8)) {
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(face8x8.buf_img, ImageFormat.FORMAT_PNG);
|
||||
|
|
@ -164,36 +182,60 @@ public class PlayerFaces {
|
|||
if(refreshskins || (!has_16x16)) {
|
||||
/* Make 16x16 version */
|
||||
DynmapBufferedImage face16x16 = DynmapBufferedImage.allocateBufferedImage(16, 16);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
for(int j = 0; j < 16; j++) {
|
||||
face16x16.argb_buf[i*16+j] = face8x8.argb_buf[(i/2)*8 + (j/2)];
|
||||
}
|
||||
}
|
||||
Image face16x16_image = faceOriginal.getScaledInstance(16,16,BufferedImage.SCALE_SMOOTH);
|
||||
BufferedImage face16x16_buff = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
face16x16_buff.getGraphics().drawImage(face16x16_image,0,0,null);
|
||||
face16x16_buff.getRGB(0,0,16,16,face16x16.argb_buf,0,16);
|
||||
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(face16x16.buf_img, ImageFormat.FORMAT_PNG);
|
||||
if (bos != null) {
|
||||
storage.setPlayerFaceImage(playername, FaceType.FACE_16X16, bos);
|
||||
}
|
||||
DynmapBufferedImage.freeBufferedImage(face16x16);
|
||||
face16x16_buff.flush();
|
||||
}
|
||||
|
||||
/* Write 32x32 file */
|
||||
if(refreshskins || (!has_32x32)) {
|
||||
/* Make 32x32 version */
|
||||
DynmapBufferedImage face32x32 = DynmapBufferedImage.allocateBufferedImage(32, 32);
|
||||
for(int i = 0; i < 32; i++) {
|
||||
for(int j = 0; j < 32; j++) {
|
||||
face32x32.argb_buf[i*32+j] = face8x8.argb_buf[(i/4)*8 + (j/4)];
|
||||
}
|
||||
}
|
||||
Image face32x32_image = faceOriginal.getScaledInstance(32,32,BufferedImage.SCALE_SMOOTH);
|
||||
BufferedImage face32x32_buff = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
face32x32_buff.getGraphics().drawImage(face32x32_image,0,0,null);
|
||||
face32x32_buff.getRGB(0,0,32,32,face32x32.argb_buf,0,32);
|
||||
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(face32x32.buf_img, ImageFormat.FORMAT_PNG);
|
||||
if (bos != null) {
|
||||
storage.setPlayerFaceImage(playername, FaceType.FACE_32X32, bos);
|
||||
}
|
||||
DynmapBufferedImage.freeBufferedImage(face32x32);
|
||||
face32x32_buff.flush();
|
||||
}
|
||||
|
||||
/* Write body file */
|
||||
if(refreshskins || (!has_body)) {
|
||||
|
||||
Image skin_image = null;
|
||||
BufferedImage skin_buff = null;
|
||||
|
||||
if (is_64x32_skin){
|
||||
|
||||
skin_image = img.getScaledInstance(64,32,BufferedImage.SCALE_SMOOTH);
|
||||
skin_buff = new BufferedImage(64, 32, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
skin_buff.getGraphics().drawImage(skin_image,0,0,null);
|
||||
|
||||
} else {
|
||||
|
||||
skin_image = img.getScaledInstance(64,64,BufferedImage.SCALE_SMOOTH);
|
||||
skin_buff = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
skin_buff.getGraphics().drawImage(skin_image,0,0,null);
|
||||
|
||||
}
|
||||
|
||||
/* Make 32x32 version */
|
||||
DynmapBufferedImage body32x32 = DynmapBufferedImage.allocateBufferedImage(32, 32);
|
||||
/* Copy face at 12,0 to 20,8 (already handled accessory) */
|
||||
|
|
@ -203,34 +245,38 @@ public class PlayerFaces {
|
|||
}
|
||||
}
|
||||
/* Copy body at 20,20 and chest at 20,36 to 8,12 */
|
||||
copyLayersToTarget(img, 20, 20, 20, 36, 8, 12, body32x32.argb_buf, 8*32+12, 32);
|
||||
copyLayersToTarget(skin_buff, 20, 20, 20, 36, 8, 12, body32x32.argb_buf, 8*32+12, 32);
|
||||
/* Copy right leg at 4,20 and 4,36 to 20,12 */
|
||||
copyLayersToTarget(img, 4, 20, 4, 36, 4, 12, body32x32.argb_buf, 20*32+12, 32);
|
||||
copyLayersToTarget(skin_buff, 4, 20, 4, 36, 4, 12, body32x32.argb_buf, 20*32+12, 32);
|
||||
/* Copy left leg at 4,20 if old format or 20,52 and 4,53 to 20,16 */
|
||||
if(is_64x32_skin) {
|
||||
img.getRGB(4, 20, 4, 12, body32x32.argb_buf, 20*32+16, 32);
|
||||
skin_buff.getRGB(4, 20, 4, 12, body32x32.argb_buf, 20*32+16, 32);
|
||||
}
|
||||
else {
|
||||
copyLayersToTarget(img, 20, 52, 4, 52, 4, 12, body32x32.argb_buf, 20 * 32 + 16, 32);
|
||||
copyLayersToTarget(skin_buff, 20, 52, 4, 52, 4, 12, body32x32.argb_buf, 20 * 32 + 16, 32);
|
||||
}
|
||||
/* Copy right arm at 44,20 and 44,36 to 8,8 */
|
||||
copyLayersToTarget(img, 44, 20, 44, 36, 4, 12, body32x32.argb_buf, 8*32+8, 32);
|
||||
copyLayersToTarget(skin_buff, 44, 20, 44, 36, 4, 12, body32x32.argb_buf, 8*32+8, 32);
|
||||
/* Copy left arm at 44,20 if old format or 36,52 and 52,52 to 8,20 */
|
||||
if(is_64x32_skin) {
|
||||
img.getRGB(44, 20, 4, 12, body32x32.argb_buf, 8*32+20, 32);
|
||||
skin_buff.getRGB(44, 20, 4, 12, body32x32.argb_buf, 8*32+20, 32);
|
||||
}
|
||||
else {
|
||||
copyLayersToTarget(img, 36, 52, 52, 52, 4, 12, body32x32.argb_buf, 8 * 32 + 20, 32);
|
||||
copyLayersToTarget(skin_buff, 36, 52, 52, 52, 4, 12, body32x32.argb_buf, 8 * 32 + 20, 32);
|
||||
}
|
||||
|
||||
BufferOutputStream bos = ImageIOManager.imageIOEncode(body32x32.buf_img, ImageFormat.FORMAT_PNG);
|
||||
if (bos != null) {
|
||||
storage.setPlayerFaceImage(playername, FaceType.BODY_32X32, bos);
|
||||
}
|
||||
|
||||
DynmapBufferedImage.freeBufferedImage(body32x32);
|
||||
skin_buff.flush();
|
||||
}
|
||||
|
||||
DynmapBufferedImage.freeBufferedImage(face8x8);
|
||||
face8x8_buff.flush();
|
||||
faceOriginal.flush();
|
||||
img.flush();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,6 @@ public abstract class DynmapServerInterface {
|
|||
* @return block ID, or -1 if chunk at given coordinate isn't loaded
|
||||
*/
|
||||
public abstract int getBlockIDAt(String wname, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Checks if a sign is at a given coordinate in a given world (if chunk is loaded)
|
||||
* @param wname - world name
|
||||
|
|
@ -188,7 +187,6 @@ public abstract class DynmapServerInterface {
|
|||
* @return 1 if a sign is at the location, 0 if it's not, -1 if the chunk isn't loaded
|
||||
*/
|
||||
public abstract int isSignAt(String wname, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get current TPS for server (20.0 is nominal)
|
||||
* @return ticks per second
|
||||
|
|
|
|||
|
|
@ -343,8 +343,8 @@ public class CTMTexturePack {
|
|||
bs = DynmapBlockState.getBaseStateByName(token);
|
||||
addbase = true;
|
||||
}
|
||||
if (bs.isAir()) {
|
||||
Log.info("Unknown block ID in CTM: " + token);
|
||||
if (bs == DynmapBlockState.AIR) {
|
||||
Log.info("Unknown block ID in CTM: " + token);
|
||||
}
|
||||
else if (addbase) {
|
||||
addBaseBlockStateToIDSet(list, bs);
|
||||
|
|
@ -486,7 +486,7 @@ public class CTMTexturePack {
|
|||
this.matchTiles = null;
|
||||
}
|
||||
else {
|
||||
String[] tok = tokenize(v, " ");
|
||||
String[] tok = tokenize(v.toLowerCase(), " ");
|
||||
for (int i = 0; i < tok.length; i++) {
|
||||
String t = tok[i];
|
||||
if (t.endsWith(".png")) { /* Strip off PNG */
|
||||
|
|
@ -505,7 +505,7 @@ public class CTMTexturePack {
|
|||
return null;
|
||||
}
|
||||
else {
|
||||
v = v.trim();
|
||||
v = v.trim().toLowerCase();
|
||||
if (v.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class HDBlockStateTextureMap {
|
|||
if ((this.blockset != null) && (this.blockset.equals("core") == false)) {
|
||||
HDBlockModels.resetIfNotBlockSet(bs, this.blockset);
|
||||
}
|
||||
copyToStateIndex(bs, this);
|
||||
copyToStateIndex(bs, this, null);
|
||||
}
|
||||
}
|
||||
else { // Else, loop over all state IDs for given block
|
||||
|
|
@ -110,7 +110,7 @@ public class HDBlockStateTextureMap {
|
|||
if ((this.blockset != null) && (this.blockset.equals("core") == false)) {
|
||||
HDBlockModels.resetIfNotBlockSet(bs, this.blockset);
|
||||
}
|
||||
copyToStateIndex(bs, this);
|
||||
copyToStateIndex(bs, this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -144,9 +144,11 @@ public class HDBlockStateTextureMap {
|
|||
return m;
|
||||
}
|
||||
// Copy given block state to given state index
|
||||
public static void copyToStateIndex(DynmapBlockState blk, HDBlockStateTextureMap map) {
|
||||
public static void copyToStateIndex(DynmapBlockState blk, HDBlockStateTextureMap map, TexturePack.BlockTransparency trans) {
|
||||
resize(blk.globalStateIndex);
|
||||
TexturePack.BlockTransparency trans = map.trans;
|
||||
if (trans == null) {
|
||||
trans = map.trans;
|
||||
}
|
||||
// Force waterloogged blocks to use SEMITRANSPARENT (same as water)
|
||||
if ((trans == TexturePack.BlockTransparency.TRANSPARENT) && blk.isWaterlogged()) {
|
||||
trans = TexturePack.BlockTransparency.SEMITRANSPARENT;
|
||||
|
|
|
|||
|
|
@ -2222,13 +2222,13 @@ public class TexturePack {
|
|||
if (stateids == null) {
|
||||
for (int sid = 0; sid < dblk.getStateCount(); sid++) {
|
||||
DynmapBlockState dblk2 = dblk.getState(sid);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map, trans);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int stateid = stateids.nextSetBit(0); stateid >= 0; stateid = stateids.nextSetBit(stateid+1)) {
|
||||
DynmapBlockState dblk2 = dblk.getState(stateid);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map);
|
||||
HDBlockStateTextureMap.copyToStateIndex(dblk2, map, trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,223 @@
|
|||
package org.dynmap.hdmap.renderer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dynmap.renderer.CustomRenderer;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.renderer.MapDataContext;
|
||||
import org.dynmap.renderer.RenderPatch;
|
||||
import org.dynmap.renderer.RenderPatchFactory;
|
||||
|
||||
public class CopyStairBlockRenderer extends CustomRenderer {
|
||||
private static final int TEXTURE_X_PLUS = 0;
|
||||
private static final int TEXTURE_Y_PLUS = 1;
|
||||
private static final int TEXTURE_Z_PLUS = 2;
|
||||
private static final int TEXTURE_X_MINUS = 3;
|
||||
private static final int TEXTURE_Y_MINUS = 4;
|
||||
private static final int TEXTURE_Z_MINUS = 5;
|
||||
|
||||
private static BitSet stair_ids = new BitSet();
|
||||
|
||||
// Array of meshes for normal steps - index = (data value & 7)
|
||||
private RenderPatch[][] stepmeshes = new RenderPatch[8][];
|
||||
// Array of meshes for 3/4 steps - index = (data value & 7), with extra one clockwise from normal step
|
||||
private RenderPatch[][] step_3_4_meshes = new RenderPatch[8][];
|
||||
// Array of meshes for 1/4 steps - index = (data value & 7), with clockwise quarter clopped from normal step
|
||||
private RenderPatch[][] step_1_4_meshes = new RenderPatch[8][];
|
||||
|
||||
private void setID(String bname) {
|
||||
DynmapBlockState bbs = DynmapBlockState.getBaseStateByName(bname);
|
||||
if (bbs.isNotAir()) {
|
||||
for (int i = 0; i < bbs.getStateCount(); i++) {
|
||||
stair_ids.set(bbs.getState(i).globalStateIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean initializeRenderer(RenderPatchFactory rpf, String blkname, BitSet blockdatamask, Map<String,String> custparm) {
|
||||
if(!super.initializeRenderer(rpf, blkname, blockdatamask, custparm))
|
||||
return false;
|
||||
setID(blkname); /* Mark block as a stair */
|
||||
/* Build step meshes */
|
||||
for(int i = 0; i < 8; i++) {
|
||||
stepmeshes[i] = buildStepMeshes(rpf, i);
|
||||
step_1_4_meshes[i] = buildCornerStepMeshes(rpf, i);
|
||||
step_3_4_meshes[i] = buildIntCornerStepMeshes(rpf, i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumTextureCount() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTileEntityFieldsNeeded() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final int[] patchlist = { TEXTURE_Y_PLUS, TEXTURE_Y_MINUS, TEXTURE_Z_PLUS, TEXTURE_Z_MINUS, TEXTURE_X_PLUS, TEXTURE_X_MINUS };
|
||||
|
||||
private void addBox(RenderPatchFactory rpf, List<RenderPatch> list, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) {
|
||||
addBox(rpf, list, xmin, xmax, ymin, ymax, zmin, zmax, patchlist);
|
||||
}
|
||||
|
||||
private RenderPatch[] buildStepMeshes(RenderPatchFactory rpf, int dat) {
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
/* If inverted, add half top */
|
||||
if((dat & 0x4) != 0) {
|
||||
addBox(rpf, list, 0, 1, 0.5, 1, 0, 1);
|
||||
}
|
||||
else { // Else, add half bottom
|
||||
addBox(rpf, list, 0, 1, 0.0, 0.5, 0, 1);
|
||||
}
|
||||
switch(dat & 0x3) {
|
||||
case 0:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 1);
|
||||
break;
|
||||
case 1:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 1);
|
||||
break;
|
||||
case 2:
|
||||
addBox(rpf, list, 0, 1, 0, 1, 0.5, 1);
|
||||
break;
|
||||
case 3:
|
||||
addBox(rpf, list, 0, 1, 0, 1, 0, 0.5);
|
||||
break;
|
||||
}
|
||||
return list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
|
||||
private RenderPatch[] buildCornerStepMeshes(RenderPatchFactory rpf, int dat) {
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
/* If inverted, add half top */
|
||||
if((dat & 0x4) != 0) {
|
||||
addBox(rpf, list, 0, 1, 0.5, 1, 0, 1);
|
||||
}
|
||||
else { // Else, add half bottom
|
||||
addBox(rpf, list, 0, 1, 0.0, 0.5, 0, 1);
|
||||
}
|
||||
switch(dat & 0x3) {
|
||||
case 0:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 1:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 2:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0.5, 1);
|
||||
break;
|
||||
case 3:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0.5, 1);
|
||||
break;
|
||||
}
|
||||
return list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
|
||||
private RenderPatch[] buildIntCornerStepMeshes(RenderPatchFactory rpf, int dat) {
|
||||
ArrayList<RenderPatch> list = new ArrayList<RenderPatch>();
|
||||
/* If inverted, add half top */
|
||||
if((dat & 0x4) != 0) {
|
||||
addBox(rpf, list, 0, 1, 0.5, 1, 0, 1);
|
||||
}
|
||||
else { // Else, add half bottom
|
||||
addBox(rpf, list, 0, 1, 0.0, 0.5, 0, 1);
|
||||
}
|
||||
switch(dat & 0x3) {
|
||||
case 0:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 1:
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0.5, 1);
|
||||
break;
|
||||
case 2:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0, 0.5);
|
||||
break;
|
||||
case 3:
|
||||
addBox(rpf, list, 0, 0.5, 0, 1, 0, 1);
|
||||
addBox(rpf, list, 0.5, 1, 0, 1, 0.5, 1);
|
||||
break;
|
||||
}
|
||||
return list.toArray(new RenderPatch[list.size()]);
|
||||
}
|
||||
|
||||
// Steps
|
||||
// 0 = up to east
|
||||
// 1 = up to west
|
||||
// 2 = up to south
|
||||
// 3 = up to north
|
||||
// Corners
|
||||
// 0 = NE
|
||||
// 1 = NW
|
||||
// 2 = SW
|
||||
// 3 = SE
|
||||
// Interior Corners
|
||||
// 0 = open to SW
|
||||
// 1 = open to NW
|
||||
// 2 = open to SE
|
||||
// 3 = open to NE
|
||||
private static final int off_x[] = { 1, -1, 0, 0, 1, -1, 0, 0 };
|
||||
private static final int off_z[] = { 0, 0, 1, -1, 0, 0, 1, -1 };
|
||||
private static final int match1[] = { 2, 3, 0, 1, 6, 7, 4, 5 };
|
||||
private static final int corner1[] = { 3, 1, 3, 1, 7, 5, 7, 5 };
|
||||
private static final int icorner1[] = { 1, 2, 1, 2, 5, 6, 5, 6 };
|
||||
private static final int match2[] = { 3, 2, 1, 0, 7, 6, 5, 4 };
|
||||
private static final int corner2[] = { 0, 2, 2, 0, 4, 6, 6, 4 };
|
||||
private static final int icorner2[] = { 0, 3, 3, 0, 4, 7, 7, 4 };
|
||||
|
||||
@Override
|
||||
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
|
||||
return getBaseRenderPatchList(ctx);
|
||||
}
|
||||
|
||||
private RenderPatch[] getBaseRenderPatchList(MapDataContext ctx) {
|
||||
int data = ctx.getBlockType().stateIndex & 0x07; /* Get block data */
|
||||
/* Check block behind stair */
|
||||
DynmapBlockState corner = ctx.getBlockTypeAt(off_x[data], 0, off_z[data]);
|
||||
if (stair_ids.get(corner.globalStateIndex)) { /* If it is a stair */
|
||||
int cornerdat = corner.stateIndex & 0x07;
|
||||
if(cornerdat == match1[data]) { /* If right orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_1_4_meshes[corner1[data]];
|
||||
}
|
||||
}
|
||||
else if(cornerdat == match2[data]) { /* If other orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_1_4_meshes[corner2[data]];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Check block in front of stair */
|
||||
corner = ctx.getBlockTypeAt(-off_x[data], 0, -off_z[data]);
|
||||
if(stair_ids.get(corner.globalStateIndex)) { /* If it is a stair */
|
||||
int cornerdat = corner.stateIndex & 0x07;
|
||||
if(cornerdat == match1[data]) { /* If right orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_3_4_meshes[icorner1[data]];
|
||||
}
|
||||
}
|
||||
else if(cornerdat == match2[data]) { /* If other orientation */
|
||||
/* Make sure we don't have matching stair to side */
|
||||
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
|
||||
if((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
|
||||
return step_3_4_meshes[icorner2[data]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stepmeshes[data];
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ public class MarkerSignManager {
|
|||
private static MarkerSignManager mgr = null;
|
||||
private static DynmapCore plugin = null;
|
||||
private static String defSignSet = null;
|
||||
|
||||
|
||||
private static class SignRec {
|
||||
String wname;
|
||||
int x, y, z;
|
||||
|
|
@ -30,10 +30,12 @@ public class MarkerSignManager {
|
|||
@Override
|
||||
public void signChangeEvent(int blkid, String wname, int x, int y, int z, String[] lines, DynmapPlayer p) {
|
||||
if(mgr == null)
|
||||
return;
|
||||
return;
|
||||
|
||||
if(!lines[0].equalsIgnoreCase("[dynmap]")) { /* If not dynmap sign, quit */
|
||||
return;
|
||||
}
|
||||
|
||||
/* If allowed to do marker signs */
|
||||
if((p == null) || ((plugin != null) && (plugin.checkPlayerPermission(p, "marker.sign")))) {
|
||||
String id = getSignMarkerID(wname, x, y, z); /* Get marker ID */
|
||||
|
|
@ -146,10 +148,9 @@ public class MarkerSignManager {
|
|||
}
|
||||
else {
|
||||
if(plugin.getServer().isSignAt(r.wname, r.x, r.y, r.z) == 0) {
|
||||
System.out.println("Removing from cache sign " + r.m.getLabel());
|
||||
r.m.deleteMarker();
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getServer().scheduleServerTask(sl, 60*20);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class StairBlockModelImpl extends BlockModelImpl implements StairBlockMod
|
|||
public String getLine() {
|
||||
String ids = this.getIDsAndMeta();
|
||||
if (ids == null) return null;
|
||||
return String.format("customblock:%s,class=org.dynmap.hdmap.renderer.StairBlockRenderer", ids);
|
||||
return String.format("customblock:%s,class=org.dynmap.hdmap.renderer.CopyStairBlockRenderer", ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ public class MariaDBMapStorage extends MapStorage {
|
|||
connectionString = "jdbc:mariadb://" + hostname + ":" + port + "/" + database + "?allowReconnect=true";
|
||||
Log.info("Opening MariaDB database " + hostname + ":" + port + "/" + database + " as map store");
|
||||
try {
|
||||
Class.forName("com.mariadb.jdbc.Driver");
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
// Initialize/update tables, if needed
|
||||
if(!initializeTables()) {
|
||||
return false;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -375,6 +375,7 @@ DynMap.prototype = {
|
|||
componentstoload--;
|
||||
if (componentstoload == 0) {
|
||||
// Actually start updating once all components are loaded.
|
||||
me.update();
|
||||
setTimeout(function() { me.update(); }, me.options.updaterate);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue