mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-23 18:55:14 +01:00
Updated bukkit/spigot build for minecraft 1.16.4
This commit is contained in:
parent
87b57d5639
commit
8ad0cff1b5
4
bukkit-helper-116-4/.gitignore
vendored
Normal file
4
bukkit-helper-116-4/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/target/
|
||||
/build/
|
||||
/bin/
|
||||
/.classpath
|
10
bukkit-helper-116-4/build.gradle
Normal file
10
bukkit-helper-116-4/build.gradle
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
description = 'bukkit-helper-1.16.4'
|
||||
|
||||
dependencies {
|
||||
compile project(':bukkit-helper')
|
||||
compile project(':dynmap-api')
|
||||
compile project(path: ':DynmapCore', configuration: 'shadow')
|
||||
compile group: 'org.spigotmc', name: 'spigot-api', version:'1.16.4-R0.1-SNAPSHOT'
|
||||
compile group: 'org.spigotmc', name: 'spigot', version:'1.16.4-R0.1-SNAPSHOT'
|
||||
}
|
@ -0,0 +1,256 @@
|
||||
package org.dynmap.bukkit.helper.v116_4;
|
||||
|
||||
import net.minecraft.server.v1_16_R3.Material;
|
||||
import net.minecraft.server.v1_16_R3.*;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldBorder;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.bukkit.helper.BukkitMaterial;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperGeneric;
|
||||
import org.dynmap.bukkit.helper.BukkitWorld;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.Polygon;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot116_4 extends BukkitVersionHelperGeneric {
|
||||
private Field watercolorfield;
|
||||
|
||||
public BukkitVersionHelperSpigot116_4() {
|
||||
Class biomefog = getNMSClass("net.minecraft.server.BiomeFog");
|
||||
watercolorfield = getPrivateField(biomefog, new String[] { "c" }, int.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block short name list
|
||||
*/
|
||||
@Override
|
||||
public String[] getBlockNames() {
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
String[] names = new String[cnt];
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
names[i] = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
Log.info(i + ": blk=" + names[i] + ", bd=" + bd.toString());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
private IRegistry<BiomeBase> reg = null;
|
||||
|
||||
private IRegistry<BiomeBase> getBiomeReg() {
|
||||
if (reg == null) {
|
||||
reg = MinecraftServer.getServer().getCustomRegistry().b(IRegistry.ay);
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
|
||||
private Object[] biomelist;
|
||||
/**
|
||||
* Get list of defined biomebase objects
|
||||
*/
|
||||
@Override
|
||||
public Object[] getBiomeBaseList() {
|
||||
if (biomelist == null) {
|
||||
biomelist = new Object[1024];
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
biomelist[i] = getBiomeReg().fromId(i);
|
||||
}
|
||||
}
|
||||
return biomelist;
|
||||
}
|
||||
|
||||
/** Get ID from biomebase */
|
||||
@Override
|
||||
public int getBiomeBaseID(Object bb) {
|
||||
return getBiomeReg().a((BiomeBase)bb);
|
||||
}
|
||||
|
||||
public static IdentityHashMap<IBlockData, DynmapBlockState> dataToState;
|
||||
|
||||
/**
|
||||
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
|
||||
*/
|
||||
@Override
|
||||
public void initializeBlockStates() {
|
||||
dataToState = new IdentityHashMap<IBlockData, DynmapBlockState>();
|
||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
// Loop through block data states
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
String bname = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
if (lastbs != null) { // Yes
|
||||
idx = lastbs.getStateCount(); // Get number of states so far, since this is next
|
||||
}
|
||||
// Build state name
|
||||
String sb = "";
|
||||
String fname = bd.toString();
|
||||
int off1 = fname.indexOf('[');
|
||||
if (off1 >= 0) {
|
||||
int off2 = fname.indexOf(']');
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
if ((!bd.getFluid().isEmpty()) && ((bd.getBlock() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||
bs.setWaterlogged();
|
||||
}
|
||||
if (mat == Material.AIR) {
|
||||
bs.setAir();
|
||||
}
|
||||
if (mat == Material.LEAVES) {
|
||||
bs.setLeaves();
|
||||
}
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.WOOD)) {
|
||||
bs.setLog();
|
||||
}
|
||||
if (mat.isSolid()) {
|
||||
bs.setSolid();
|
||||
}
|
||||
dataToState.put(bd, bs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? bs : lastbs);
|
||||
Log.verboseinfo(i + ": blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + bs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create chunk cache for given chunks of given world
|
||||
* @param dw - world
|
||||
* @param chunks - chunk list
|
||||
* @return cache
|
||||
*/
|
||||
@Override
|
||||
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
|
||||
MapChunkCache116_4 c = new MapChunkCache116_4();
|
||||
c.setChunks(dw, chunks);
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get biome base water multiplier
|
||||
*/
|
||||
@Override
|
||||
public int getBiomeBaseWaterMult(Object bb) {
|
||||
try {
|
||||
return (int) watercolorfield.get(((BiomeBase)bb).l());
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
/** Get temperature from biomebase */
|
||||
@Override
|
||||
public float getBiomeBaseTemperature(Object bb) {
|
||||
return ((BiomeBase)bb).k();
|
||||
}
|
||||
|
||||
/** Get humidity from biomebase */
|
||||
@Override
|
||||
public float getBiomeBaseHumidity(Object bb) {
|
||||
return ((BiomeBase)bb).getHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Polygon getWorldBorder(World world) {
|
||||
Polygon p = null;
|
||||
WorldBorder wb = world.getWorldBorder();
|
||||
if (wb != null) {
|
||||
Location c = wb.getCenter();
|
||||
double size = wb.getSize();
|
||||
if ((size > 1) && (size < 1E7)) {
|
||||
size = size / 2;
|
||||
p = new Polygon();
|
||||
p.addVertex(c.getX()-size, c.getZ()-size);
|
||||
p.addVertex(c.getX()+size, c.getZ()-size);
|
||||
p.addVertex(c.getX()+size, c.getZ()+size);
|
||||
p.addVertex(c.getX()-size, c.getZ()+size);
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
// Send title/subtitle to user
|
||||
public void sendTitleText(Player p, String title, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTIcks) {
|
||||
if (p != null) {
|
||||
p.sendTitle(title, subtitle, fadeInTicks, stayTicks, fadeOutTIcks);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get material map by block ID
|
||||
*/
|
||||
@Override
|
||||
public BukkitMaterial[] getMaterialList() {
|
||||
return new BukkitMaterial[4096]; // Not used
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadNMS() {
|
||||
// Not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNMSPackage() {
|
||||
Server srv = Bukkit.getServer();
|
||||
/* Get getHandle() method */
|
||||
try {
|
||||
Method m = srv.getClass().getMethod("getHandle");
|
||||
Object scm = m.invoke(srv); /* And use it to get SCM (nms object) */
|
||||
return scm.getClass().getPackage().getName();
|
||||
} catch (Exception x) {
|
||||
Log.severe("Error finding net.minecraft.server packages");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadChunkNoSave(World w, org.bukkit.Chunk c, int cx, int cz) {
|
||||
Log.severe("unloadChunkNoSave not implemented");
|
||||
}
|
||||
|
||||
private String[] biomenames;
|
||||
@Override
|
||||
public String[] getBiomeNames() {
|
||||
if (biomenames == null) {
|
||||
biomenames = new String[1024];
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
BiomeBase bb = getBiomeReg().fromId(i);
|
||||
if (bb != null) {
|
||||
biomenames[i] = bb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return biomenames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStateStringByCombinedId(int blkid, int meta) {
|
||||
Log.severe("getStateStringByCombinedId not implemented");
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
/** Get ID string from biomebase */
|
||||
public String getBiomeBaseIDString(Object bb) {
|
||||
String s = ((BiomeBase)bb).toString();
|
||||
if (s != null) {
|
||||
String[] ss = s.split("\\.");
|
||||
return ss[ss.length-1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,484 @@
|
||||
package org.dynmap.bukkit.helper.v116_4;
|
||||
|
||||
import net.minecraft.server.v1_16_R3.*;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||
import org.dynmap.bukkit.helper.SnapshotCache;
|
||||
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.DynIntHashMap;
|
||||
import org.dynmap.utils.VisibilityLimit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
|
||||
*/
|
||||
public class MapChunkCache116_4 extends AbstractMapChunkCache {
|
||||
|
||||
public static class NBTSnapshot implements Snapshot {
|
||||
private static interface Section {
|
||||
public DynmapBlockState getBlockType(int x, int y, int z);
|
||||
public int getBlockSkyLight(int x, int y, int z);
|
||||
public int getBlockEmittedLight(int x, int y, int z);
|
||||
public boolean isEmpty();
|
||||
}
|
||||
private final int x, z;
|
||||
private final Section[] section;
|
||||
private final int[] hmap; // Height map
|
||||
private final int[] biome;
|
||||
private final Object[] biomebase;
|
||||
private final long captureFulltime;
|
||||
private final int sectionCnt;
|
||||
private final long inhabitedTicks;
|
||||
|
||||
private static final int BLOCKS_PER_SECTION = 16 * 16 * 16;
|
||||
private static final int COLUMNS_PER_CHUNK = 16 * 16;
|
||||
private static final int V1_15_BIOME_PER_CHUNK = 4 * 4 * 64;
|
||||
private static final byte[] emptyData = new byte[BLOCKS_PER_SECTION / 2];
|
||||
private static final byte[] fullData = new byte[BLOCKS_PER_SECTION / 2];
|
||||
|
||||
static
|
||||
{
|
||||
Arrays.fill(fullData, (byte)0xFF);
|
||||
}
|
||||
|
||||
private static byte[] dataCopy(byte[] v) {
|
||||
if (Arrays.equals(v, emptyData))
|
||||
return emptyData;
|
||||
else if (Arrays.equals(v, fullData))
|
||||
return fullData;
|
||||
else
|
||||
return v.clone();
|
||||
}
|
||||
|
||||
private static class EmptySection implements Section {
|
||||
@Override
|
||||
public DynmapBlockState getBlockType(int x, int y, int z) {
|
||||
return DynmapBlockState.AIR;
|
||||
}
|
||||
@Override
|
||||
public int getBlockSkyLight(int x, int y, int z) {
|
||||
return 15;
|
||||
}
|
||||
@Override
|
||||
public int getBlockEmittedLight(int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static final EmptySection empty_section = new EmptySection();
|
||||
|
||||
private static class StdSection implements Section {
|
||||
DynmapBlockState[] states;
|
||||
byte[] skylight;
|
||||
byte[] emitlight;
|
||||
|
||||
public StdSection() {
|
||||
states = new DynmapBlockState[BLOCKS_PER_SECTION];
|
||||
Arrays.fill(states, DynmapBlockState.AIR);
|
||||
skylight = emptyData;
|
||||
emitlight = emptyData;
|
||||
}
|
||||
@Override
|
||||
public DynmapBlockState getBlockType(int x, int y, int z) {
|
||||
return states[((y & 0xF) << 8) | (z << 4) | x];
|
||||
}
|
||||
@Override
|
||||
public int getBlockSkyLight(int x, int y, int z) {
|
||||
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
|
||||
return (skylight[off] >> (4 * (x & 1))) & 0xF;
|
||||
}
|
||||
@Override
|
||||
public int getBlockEmittedLight(int x, int y, int z)
|
||||
{
|
||||
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
|
||||
return (emitlight[off] >> (4 * (x & 1))) & 0xF;
|
||||
}
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Construct empty chunk snapshot
|
||||
*
|
||||
* @param x
|
||||
* @param z
|
||||
*/
|
||||
public NBTSnapshot(int worldheight, int x, int z, long captime, long inhabitedTime)
|
||||
{
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.captureFulltime = captime;
|
||||
this.biome = new int[COLUMNS_PER_CHUNK];
|
||||
this.biomebase = new Object[COLUMNS_PER_CHUNK];
|
||||
this.sectionCnt = worldheight / 16;
|
||||
/* Allocate arrays indexed by section */
|
||||
this.section = new Section[this.sectionCnt];
|
||||
|
||||
/* Fill with empty data */
|
||||
for (int i = 0; i < this.sectionCnt; i++) {
|
||||
this.section[i] = empty_section;
|
||||
}
|
||||
|
||||
/* Create empty height map */
|
||||
this.hmap = new int[16 * 16];
|
||||
|
||||
this.inhabitedTicks = inhabitedTime;
|
||||
}
|
||||
|
||||
public NBTSnapshot(NBTTagCompound nbt, int worldheight) {
|
||||
this.x = nbt.getInt("xPos");
|
||||
this.z = nbt.getInt("zPos");
|
||||
this.captureFulltime = 0;
|
||||
this.hmap = nbt.getIntArray("HeightMap");
|
||||
this.sectionCnt = worldheight / 16;
|
||||
if (nbt.hasKey("InhabitedTime")) {
|
||||
this.inhabitedTicks = nbt.getLong("InhabitedTime");
|
||||
}
|
||||
else {
|
||||
this.inhabitedTicks = 0;
|
||||
}
|
||||
/* Allocate arrays indexed by section */
|
||||
this.section = new Section[this.sectionCnt];
|
||||
/* Fill with empty data */
|
||||
for (int i = 0; i < this.sectionCnt; i++) {
|
||||
this.section[i] = empty_section;
|
||||
}
|
||||
/* Get sections */
|
||||
NBTTagList sect = nbt.getList("Sections", 10);
|
||||
for (int i = 0; i < sect.size(); i++) {
|
||||
NBTTagCompound sec = sect.getCompound(i);
|
||||
int secnum = sec.getByte("Y");
|
||||
if (secnum >= this.sectionCnt) {
|
||||
//Log.info("Section " + (int) secnum + " above world height " + worldheight);
|
||||
continue;
|
||||
}
|
||||
if (secnum < 0)
|
||||
continue;
|
||||
//System.out.println("section(" + secnum + ")=" + sec.asString());
|
||||
// Create normal section to initialize
|
||||
StdSection cursect = new StdSection();
|
||||
this.section[secnum] = cursect;
|
||||
DynmapBlockState[] states = cursect.states;
|
||||
DynmapBlockState[] palette = null;
|
||||
// If we've got palette and block states list, process non-empty section
|
||||
if (sec.hasKeyOfType("Palette", 9) && sec.hasKeyOfType("BlockStates", 12)) {
|
||||
NBTTagList plist = sec.getList("Palette", 10);
|
||||
long[] statelist = sec.getLongArray("BlockStates");
|
||||
palette = new DynmapBlockState[plist.size()];
|
||||
for (int pi = 0; pi < plist.size(); pi++) {
|
||||
NBTTagCompound tc = plist.getCompound(pi);
|
||||
String pname = tc.getString("Name");
|
||||
if (tc.hasKey("Properties")) {
|
||||
StringBuilder statestr = new StringBuilder();
|
||||
NBTTagCompound prop = tc.getCompound("Properties");
|
||||
for (String pid : prop.getKeys()) {
|
||||
if (statestr.length() > 0) statestr.append(',');
|
||||
statestr.append(pid).append('=').append(prop.get(pid).asString());
|
||||
}
|
||||
palette[pi] = DynmapBlockState.getStateByNameAndState(pname, statestr.toString());
|
||||
}
|
||||
if (palette[pi] == null) {
|
||||
palette[pi] = DynmapBlockState.getBaseStateByName(pname);
|
||||
}
|
||||
if (palette[pi] == null) {
|
||||
palette[pi] = DynmapBlockState.AIR;
|
||||
}
|
||||
}
|
||||
int recsperblock = (4096 + statelist.length - 1) / statelist.length;
|
||||
int bitsperblock = 64 / recsperblock;
|
||||
DataBits db = null;
|
||||
DataBitsPacked dbp = null;
|
||||
try {
|
||||
db = new DataBits(bitsperblock, 4096, statelist);
|
||||
} catch (Exception x) { // Handle legacy encoded
|
||||
bitsperblock = (statelist.length * 64) / 4096;
|
||||
dbp = new DataBitsPacked(bitsperblock, 4096, statelist);
|
||||
}
|
||||
if (bitsperblock > 8) { // Not palette
|
||||
for (int j = 0; j < 4096; j++) {
|
||||
int v = (db != null) ? db.a(j) : dbp.a(j);
|
||||
states[j] = DynmapBlockState.getStateByGlobalIndex(v);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int j = 0; j < 4096; j++) {
|
||||
int v = (db != null) ? db.a(j) : dbp.a(j);
|
||||
states[j] = (v < palette.length) ? palette[v] : DynmapBlockState.AIR;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sec.hasKey("BlockLight")) {
|
||||
cursect.emitlight = dataCopy(sec.getByteArray("BlockLight"));
|
||||
}
|
||||
if (sec.hasKey("SkyLight")) {
|
||||
cursect.skylight = dataCopy(sec.getByteArray("SkyLight"));
|
||||
}
|
||||
}
|
||||
/* Get biome data */
|
||||
this.biome = new int[COLUMNS_PER_CHUNK];
|
||||
this.biomebase = new Object[COLUMNS_PER_CHUNK];
|
||||
Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
|
||||
if (nbt.hasKey("Biomes")) {
|
||||
int[] bb = nbt.getIntArray("Biomes");
|
||||
if (bb != null) {
|
||||
// If v1.15+ format
|
||||
if (bb.length > COLUMNS_PER_CHUNK) {
|
||||
// For now, just pad the grid with the first 16
|
||||
for (int i = 0; i < COLUMNS_PER_CHUNK; i++) {
|
||||
int off = ((i >> 4) & 0xC) + ((i >> 2) & 0x3);
|
||||
int bv = bb[off + 64]; // Offset to y=64
|
||||
if (bv < 0) bv = 0;
|
||||
this.biome[i] = bv;
|
||||
this.biomebase[i] = bbl[bv];
|
||||
}
|
||||
}
|
||||
else { // Else, older chunks
|
||||
for (int i = 0; i < bb.length; i++) {
|
||||
int bv = bb[i];
|
||||
if (bv < 0) bv = 0;
|
||||
this.biome[i] = bv;
|
||||
this.biomebase[i] = bbl[bv];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getZ()
|
||||
{
|
||||
return z;
|
||||
}
|
||||
|
||||
public DynmapBlockState getBlockType(int x, int y, int z)
|
||||
{
|
||||
return section[y >> 4].getBlockType(x, y, z);
|
||||
}
|
||||
|
||||
public int getBlockSkyLight(int x, int y, int z)
|
||||
{
|
||||
return section[y >> 4].getBlockSkyLight(x, y, z);
|
||||
}
|
||||
|
||||
public int getBlockEmittedLight(int x, int y, int z)
|
||||
{
|
||||
return section[y >> 4].getBlockEmittedLight(x, y, z);
|
||||
}
|
||||
|
||||
public int getHighestBlockYAt(int x, int z)
|
||||
{
|
||||
return hmap[z << 4 | x];
|
||||
}
|
||||
|
||||
public final long getCaptureFullTime()
|
||||
{
|
||||
return captureFulltime;
|
||||
}
|
||||
|
||||
public boolean isSectionEmpty(int sy)
|
||||
{
|
||||
return section[sy].isEmpty();
|
||||
}
|
||||
|
||||
public long getInhabitedTicks() {
|
||||
return inhabitedTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int x, int z) {
|
||||
return AbstractMapChunkCache.getBiomeByID(biome[z << 4 | x]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getBiomeBaseFromSnapshot() {
|
||||
return this.biomebase;
|
||||
}
|
||||
}
|
||||
|
||||
private NBTTagCompound fetchLoadedChunkNBT(World w, int x, int z) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
if (cw.isChunkLoaded(x, z)) {
|
||||
Chunk c = cw.getHandle().getChunkAt(x, z);
|
||||
if ((c != null) && c.loaded) {
|
||||
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
|
||||
}
|
||||
}
|
||||
if (nbt != null) {
|
||||
nbt = nbt.getCompound("Level");
|
||||
if (nbt != null) {
|
||||
String stat = nbt.getString("Status");
|
||||
ChunkStatus cs = ChunkStatus.a(stat);
|
||||
if ((stat == null) || (!cs.b(ChunkStatus.LIGHT))) {
|
||||
nbt = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
private NBTTagCompound loadChunkNBT(World w, int x, int z) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
ChunkCoordIntPair cc = new ChunkCoordIntPair(x, z);
|
||||
try {
|
||||
nbt = cw.getHandle().getChunkProvider().playerChunkMap.read(cc);
|
||||
} catch (IOException iox) {
|
||||
}
|
||||
if (nbt != null) {
|
||||
nbt = nbt.getCompound("Level");
|
||||
if (nbt != null) {
|
||||
String stat = nbt.getString("Status");
|
||||
if ((stat == null) || (stat.equals("full") == false)) {
|
||||
nbt = null;
|
||||
if ((stat == null) || stat.equals("") && DynmapCore.migrateChunks()) {
|
||||
Chunk c = cw.getHandle().getChunkAt(x, z);
|
||||
if (c != null) {
|
||||
nbt = fetchLoadedChunkNBT(w, x, z);
|
||||
cw.getHandle().unloadChunk(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snapshot wrapChunkSnapshot(ChunkSnapshot css) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
// Load chunk snapshots
|
||||
@Override
|
||||
public int loadChunks(int max_to_load) {
|
||||
if(dw.isLoaded() == false)
|
||||
return 0;
|
||||
int cnt = 0;
|
||||
if(iterator == null)
|
||||
iterator = chunks.listIterator();
|
||||
|
||||
DynmapCore.setIgnoreChunkLoads(true);
|
||||
// Load the required chunks.
|
||||
while((cnt < max_to_load) && iterator.hasNext()) {
|
||||
long startTime = System.nanoTime();
|
||||
DynmapChunk chunk = iterator.next();
|
||||
boolean vis = true;
|
||||
if(visible_limits != null) {
|
||||
vis = false;
|
||||
for(VisibilityLimit limit : visible_limits) {
|
||||
if (limit.doIntersectChunk(chunk.x, chunk.z)) {
|
||||
vis = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(vis && (hidden_limits != null)) {
|
||||
for(VisibilityLimit limit : hidden_limits) {
|
||||
if (limit.doIntersectChunk(chunk.x, chunk.z)) {
|
||||
vis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Check if cached chunk snapshot found */
|
||||
Snapshot ss = null;
|
||||
long inhabited_ticks = 0;
|
||||
DynIntHashMap tileData = null;
|
||||
int idx = (chunk.x-x_min) + (chunk.z - z_min)*x_dim;
|
||||
SnapshotRec ssr = SnapshotCache.sscache.getSnapshot(dw.getName(), chunk.x, chunk.z, blockdata, biome, biomeraw, highesty);
|
||||
if(ssr != null) {
|
||||
inhabited_ticks = ssr.inhabitedTicks;
|
||||
if(!vis) {
|
||||
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
|
||||
ss = STONE;
|
||||
else if(hidestyle == HiddenChunkStyle.FILL_OCEAN)
|
||||
ss = OCEAN;
|
||||
else
|
||||
ss = EMPTY;
|
||||
}
|
||||
else {
|
||||
ss = ssr.ss;
|
||||
}
|
||||
snaparray[idx] = ss;
|
||||
snaptile[idx] = ssr.tileData;
|
||||
inhabitedTicks[idx] = inhabited_ticks;
|
||||
|
||||
endChunkLoad(startTime, ChunkStats.CACHED_SNAPSHOT_HIT);
|
||||
continue;
|
||||
}
|
||||
// Fetch NTB for chunk if loaded
|
||||
NBTTagCompound nbt = fetchLoadedChunkNBT(w, chunk.x, chunk.z);
|
||||
boolean did_load = false;
|
||||
if (nbt == null) {
|
||||
// Load NTB for chunk, if it exists
|
||||
nbt = loadChunkNBT(w, chunk.x, chunk.z);
|
||||
did_load = true;
|
||||
}
|
||||
if (nbt != null) {
|
||||
NBTSnapshot nss = new NBTSnapshot(nbt, w.getMaxHeight());
|
||||
ss = nss;
|
||||
inhabited_ticks = nss.getInhabitedTicks();
|
||||
if(!vis) {
|
||||
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
|
||||
ss = STONE;
|
||||
else if(hidestyle == HiddenChunkStyle.FILL_OCEAN)
|
||||
ss = OCEAN;
|
||||
else
|
||||
ss = EMPTY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ss = EMPTY;
|
||||
}
|
||||
ssr = new SnapshotRec();
|
||||
ssr.ss = ss;
|
||||
ssr.inhabitedTicks = inhabited_ticks;
|
||||
ssr.tileData = tileData;
|
||||
SnapshotCache.sscache.putSnapshot(dw.getName(), chunk.x, chunk.z, ssr, blockdata, biome, biomeraw, highesty);
|
||||
snaparray[idx] = ss;
|
||||
snaptile[idx] = ssr.tileData;
|
||||
inhabitedTicks[idx] = inhabited_ticks;
|
||||
if (nbt == null)
|
||||
endChunkLoad(startTime, ChunkStats.UNGENERATED_CHUNKS);
|
||||
else if (did_load)
|
||||
endChunkLoad(startTime, ChunkStats.UNLOADED_CHUNKS);
|
||||
else
|
||||
endChunkLoad(startTime, ChunkStats.LOADED_CHUNKS);
|
||||
cnt++;
|
||||
}
|
||||
DynmapCore.setIgnoreChunkLoads(false);
|
||||
|
||||
if(iterator.hasNext() == false) { /* If we're done */
|
||||
isempty = true;
|
||||
/* Fill missing chunks with empty dummy chunk */
|
||||
for(int i = 0; i < snaparray.length; i++) {
|
||||
if(snaparray[i] == null)
|
||||
snaparray[i] = EMPTY;
|
||||
else if(snaparray[i] != EMPTY)
|
||||
isempty = false;
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ include ':bukkit-helper-115'
|
||||
include ':bukkit-helper-116'
|
||||
include ':bukkit-helper-116-2'
|
||||
include ':bukkit-helper-116-3'
|
||||
include ':bukkit-helper-116-4'
|
||||
include ':bukkit-helper'
|
||||
include ':dynmap-api'
|
||||
include ':DynmapCore'
|
||||
@ -28,6 +29,7 @@ project(':bukkit-helper-115').projectDir = "$rootDir/bukkit-helper-115" as File
|
||||
project(':bukkit-helper-116').projectDir = "$rootDir/bukkit-helper-116" as File
|
||||
project(':bukkit-helper-116-2').projectDir = "$rootDir/bukkit-helper-116-2" as File
|
||||
project(':bukkit-helper-116-3').projectDir = "$rootDir/bukkit-helper-116-3" as File
|
||||
project(':bukkit-helper-116-4').projectDir = "$rootDir/bukkit-helper-116-4" as File
|
||||
project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
||||
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
||||
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
description = 'dynmap'
|
||||
|
||||
repositories {
|
||||
@ -11,7 +10,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT'
|
||||
compile group: 'org.bukkit', name: 'bukkit', version: '1.7.10-R0.1-SNAPSHOT'
|
||||
compile 'com.nijikokun.bukkit:Permissions:3.1.6'
|
||||
compile 'me.lucko.luckperms:luckperms-api:4.3'
|
||||
compile 'net.luckperms:api:5.0'
|
||||
@ -19,38 +18,41 @@ dependencies {
|
||||
compileOnly 'com:skinsrestorer:13.7.5-20191221.213031-7@jar'
|
||||
compile project(":dynmap-api")
|
||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||
compile group: 'ru.tehkode', name: 'PermissionsEx', version:'1.19.1'
|
||||
compile group: 'de.bananaco', name: 'bPermissions', version:'2.9.1'
|
||||
compile group: 'com.platymuus.bukkit.permissions', name: 'PermissionsBukkit', version:'1.6'
|
||||
compile group: 'org.anjocaido', name: 'EssentialsGroupManager', version:'2.10.1'
|
||||
compile group: 'org.bstats', name: 'bstats-bukkit', version:'1.5'
|
||||
compile group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1.1'
|
||||
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.2'
|
||||
compile group: 'ru.tehkode', name: 'PermissionsEx', version: '1.19.1'
|
||||
compile group: 'de.bananaco', name: 'bPermissions', version: '2.9.1'
|
||||
compile group: 'com.platymuus.bukkit.permissions', name: 'PermissionsBukkit', version: '1.6'
|
||||
compile group: 'org.anjocaido', name: 'EssentialsGroupManager', version: '2.10.1'
|
||||
compile group: 'org.bstats', name: 'bstats-bukkit', version: '1.5'
|
||||
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
|
||||
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
|
||||
compile project(':bukkit-helper')
|
||||
implementation(project(':bukkit-helper-113-2')) {
|
||||
implementation(project(':bukkit-helper-113-2')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-114-1')) {
|
||||
implementation(project(':bukkit-helper-114-1')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-115')) {
|
||||
implementation(project(':bukkit-helper-115')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-116')) {
|
||||
implementation(project(':bukkit-helper-116')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-116-2')) {
|
||||
implementation(project(':bukkit-helper-116-2')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-116-3')) {
|
||||
implementation(project(':bukkit-helper-116-3')) {
|
||||
transitive = false
|
||||
}
|
||||
implementation(project(':bukkit-helper-116-4')) {
|
||||
transitive = false
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from('src/main/resources') {
|
||||
include "plugin.yml"
|
||||
from('src/main/resources') {
|
||||
include "plugin.yml"
|
||||
// replace version and mcversion
|
||||
expand(
|
||||
buildnumber: project.parent.ext.globals.buildNumber,
|
||||
@ -60,14 +62,14 @@ processResources {
|
||||
}
|
||||
|
||||
jar {
|
||||
classifier = 'unshaded'
|
||||
classifier = 'unshaded'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include(dependency('org.bstats::'))
|
||||
include(dependency(':dynmap-api'))
|
||||
include(dependency(":DynmapCore"))
|
||||
include(dependency(':dynmap-api'))
|
||||
include(dependency(":DynmapCore"))
|
||||
include(dependency(':bukkit-helper'))
|
||||
include(dependency(':bukkit-helper-113-2'))
|
||||
include(dependency(':bukkit-helper-114-1'))
|
||||
@ -75,8 +77,9 @@ shadowJar {
|
||||
include(dependency(':bukkit-helper-116'))
|
||||
include(dependency(':bukkit-helper-116-2'))
|
||||
include(dependency(':bukkit-helper-116-3'))
|
||||
}
|
||||
relocate('org.bstats', 'org.dynmap.bstats')
|
||||
include(dependency(':bukkit-helper-116-4'))
|
||||
}
|
||||
relocate('org.bstats', 'org.dynmap.bstats')
|
||||
destinationDir = file '../target'
|
||||
archiveName = "Dynmap-${parent.version}-spigot.jar"
|
||||
classifier = ''
|
||||
|
@ -5,12 +5,7 @@ import org.dynmap.Log;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
|
||||
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
|
||||
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
|
||||
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
|
||||
import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115;
|
||||
import org.dynmap.bukkit.helper.v116.BukkitVersionHelperSpigot116;
|
||||
import org.dynmap.bukkit.helper.v116_2.BukkitVersionHelperSpigot116_2;
|
||||
import org.dynmap.bukkit.helper.v116_3.BukkitVersionHelperSpigot116_3;
|
||||
import org.dynmap.bukkit.helper.v116_4.BukkitVersionHelperSpigot116_4;
|
||||
|
||||
public class Helper {
|
||||
|
||||
@ -36,25 +31,25 @@ public class Helper {
|
||||
Log.info("Loading Glowstone support");
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
||||
}
|
||||
else if (v.contains("(MC: 1.16)") || v.contains("(MC: 1.16.1")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116();
|
||||
}
|
||||
else if (v.contains("(MC: 1.16.2)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_2();
|
||||
}
|
||||
// else if (v.contains("(MC: 1.16)") || v.contains("(MC: 1.16.1")) {
|
||||
// BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116();
|
||||
// }
|
||||
// else if (v.contains("(MC: 1.16.2)")) {
|
||||
// BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_2();
|
||||
// }
|
||||
else if (v.contains("(MC: 1.16.")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_3();
|
||||
}
|
||||
else if (v.contains("(MC: 1.15)") || v.contains("(MC: 1.15.")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
|
||||
}
|
||||
else if (v.contains("(MC: 1.14)") || v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
|
||||
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
|
||||
}
|
||||
else if (v.contains("(MC: 1.13.2)")) {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_4();
|
||||
}
|
||||
// else if (v.contains("(MC: 1.15)") || v.contains("(MC: 1.15.")) {
|
||||
// BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
|
||||
// }
|
||||
// else if (v.contains("(MC: 1.14)") || v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
|
||||
// v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
|
||||
// BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
|
||||
// }
|
||||
// else if (v.contains("(MC: 1.13.2)")) {
|
||||
// BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
|
||||
// }
|
||||
else {
|
||||
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user