Initial compiling Spigot code (doesn't work, but it does compile...)
This commit is contained in:
parent
d89403d51a
commit
c91ac7ad86
6 changed files with 143 additions and 164 deletions
|
|
@ -1,32 +1,10 @@
|
||||||
|
|
||||||
plugins {
|
|
||||||
id "io.papermc.paperweight.userdev" version "1.2.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
description = 'bukkit-helper-1.18'
|
description = 'bukkit-helper-1.18'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
implementation project(path: ':DynmapCore', configuration: 'shadow')
|
implementation project(path: ':DynmapCore', configuration: 'shadow')
|
||||||
paperDevBundle("1.17.1-R0.1-SNAPSHOT")
|
implementation group: 'org.spigotmc', name: 'spigot-api', version:'1.18-R0.1-SNAPSHOT'
|
||||||
}
|
implementation group: 'org.spigotmc', name: 'spigot', version:'1.18-R0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
// Run reobfJar on build
|
|
||||||
build {
|
|
||||||
dependsOn(reobfJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
options.release.set(17)
|
|
||||||
}
|
|
||||||
javadoc {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
}
|
|
||||||
processResources {
|
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,25 +26,26 @@ import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import com.mojang.authlib.properties.PropertyMap;
|
import com.mojang.authlib.properties.PropertyMap;
|
||||||
|
|
||||||
import net.minecraft.core.IdMapper;
|
import net.minecraft.core.RegistryBlockID;
|
||||||
|
import net.minecraft.core.IRegistry;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.nbt.ByteArrayTag;
|
import net.minecraft.nbt.NBTTagByteArray;
|
||||||
import net.minecraft.nbt.ByteTag;
|
import net.minecraft.nbt.NBTTagByte;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.DoubleTag;
|
import net.minecraft.nbt.NBTTagDouble;
|
||||||
import net.minecraft.nbt.FloatTag;
|
import net.minecraft.nbt.NBTTagFloat;
|
||||||
import net.minecraft.nbt.IntArrayTag;
|
import net.minecraft.nbt.NBTTagIntArray;
|
||||||
import net.minecraft.nbt.IntTag;
|
import net.minecraft.nbt.NBTTagInt;
|
||||||
import net.minecraft.nbt.LongTag;
|
import net.minecraft.nbt.NBTTagLong;
|
||||||
import net.minecraft.nbt.ShortTag;
|
import net.minecraft.nbt.NBTTagShort;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.NBTTagString;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.LiquidBlock;
|
import net.minecraft.world.level.block.BlockFluids;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.TileEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.IBlockData;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -68,19 +69,19 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getBlockNames() {
|
public String[] getBlockNames() {
|
||||||
IdMapper<BlockState> bsids = Block.BLOCK_STATE_REGISTRY;
|
RegistryBlockID<IBlockData> bsids = Block.p;
|
||||||
Block baseb = null;
|
Block baseb = null;
|
||||||
Iterator<BlockState> iter = bsids.iterator();
|
Iterator<IBlockData> iter = bsids.iterator();
|
||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
BlockState bs = iter.next();
|
IBlockData bs = iter.next();
|
||||||
Block b = bs.getBlock();
|
Block b = bs.b();
|
||||||
// If this is new block vs last, it's the base block state
|
// If this is new block vs last, it's the base block state
|
||||||
if (b != baseb) {
|
if (b != baseb) {
|
||||||
baseb = b;
|
baseb = b;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String bn = b.getDescriptionId();
|
String bn = b.h();
|
||||||
if (bn != null) {
|
if (bn != null) {
|
||||||
names.add(bn);
|
names.add(bn);
|
||||||
}
|
}
|
||||||
|
|
@ -88,11 +89,11 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
return names.toArray(new String[0]);
|
return names.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Registry<Biome> reg = null;
|
private static Registry<BiomeBase> reg = null;
|
||||||
|
|
||||||
private static Registry<Biome> getBiomeReg() {
|
private static Registry<BiomeBase> getBiomeReg() {
|
||||||
if (reg == null) {
|
if (reg == null) {
|
||||||
reg = MinecraftServer.getServer().registryAccess().ownedRegistryOrThrow(Registry.BIOME_REGISTRY);
|
reg = MinecraftServer.getServer().aV().d(IRegistry.aR);
|
||||||
}
|
}
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
@ -104,11 +105,11 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
@Override
|
@Override
|
||||||
public Object[] getBiomeBaseList() {
|
public Object[] getBiomeBaseList() {
|
||||||
if (biomelist == null) {
|
if (biomelist == null) {
|
||||||
biomelist = new Biome[256];
|
biomelist = new BiomeBase[256];
|
||||||
Iterator<Biome> iter = getBiomeReg().iterator();
|
Iterator<BiomeBase> iter = getBiomeReg().iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Biome b = iter.next();
|
BiomeBase b = iter.next();
|
||||||
int bidx = getBiomeReg().getId(b);
|
int bidx = getBiomeReg().a(b);
|
||||||
if (bidx >= biomelist.length) {
|
if (bidx >= biomelist.length) {
|
||||||
biomelist = Arrays.copyOf(biomelist, bidx + biomelist.length);
|
biomelist = Arrays.copyOf(biomelist, bidx + biomelist.length);
|
||||||
}
|
}
|
||||||
|
|
@ -121,26 +122,26 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
/** Get ID from biomebase */
|
/** Get ID from biomebase */
|
||||||
@Override
|
@Override
|
||||||
public int getBiomeBaseID(Object bb) {
|
public int getBiomeBaseID(Object bb) {
|
||||||
return getBiomeReg().getId((Biome)bb);
|
return getBiomeReg().a((BiomeBase)bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IdentityHashMap<BlockState, DynmapBlockState> dataToState;
|
public static IdentityHashMap<IBlockData, DynmapBlockState> dataToState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
|
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initializeBlockStates() {
|
public void initializeBlockStates() {
|
||||||
dataToState = new IdentityHashMap<BlockState, DynmapBlockState>();
|
dataToState = new IdentityHashMap<IBlockData, DynmapBlockState>();
|
||||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||||
IdMapper<BlockState> bsids = Block.BLOCK_STATE_REGISTRY;
|
RegistryBlockID<IBlockData> bsids = Block.p;
|
||||||
Block baseb = null;
|
Block baseb = null;
|
||||||
Iterator<BlockState> iter = bsids.iterator();
|
Iterator<IBlockData> iter = bsids.iterator();
|
||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
// Loop through block data states
|
// Loop through block data states
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
BlockState bd = iter.next();
|
IBlockData bd = iter.next();
|
||||||
String bname = bd.getBlock().getDescriptionId();
|
String bname = bd.b().h();
|
||||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
if (lastbs != null) { // Yes
|
if (lastbs != null) { // Yes
|
||||||
|
|
@ -154,21 +155,21 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
int off2 = fname.indexOf(']');
|
int off2 = fname.indexOf(']');
|
||||||
sb = fname.substring(off1+1, off2);
|
sb = fname.substring(off1+1, off2);
|
||||||
}
|
}
|
||||||
net.minecraft.world.level.material.Material mat = bd.getMaterial();
|
net.minecraft.world.level.material.Material mat = bd.c();
|
||||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||||
if ((!bd.getFluidState().isEmpty()) && ((bd.getBlock() instanceof LiquidBlock) == false)) { // Test if fluid type for block is not empty
|
if ((!bd.n().b()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||||
bs.setWaterlogged();
|
bs.setWaterlogged();
|
||||||
}
|
}
|
||||||
if (mat == net.minecraft.world.level.material.Material.AIR) { // AIR
|
if (mat == net.minecraft.world.level.material.Material.a) { // AIR
|
||||||
bs.setAir();
|
bs.setAir();
|
||||||
}
|
}
|
||||||
if (mat == net.minecraft.world.level.material.Material.LEAVES) { // LEAVES
|
if (mat == net.minecraft.world.level.material.Material.F) { // LEAVES
|
||||||
bs.setLeaves();
|
bs.setLeaves();
|
||||||
}
|
}
|
||||||
if (mat == net.minecraft.world.level.material.Material.WOOD) { // WOOD
|
if (mat == net.minecraft.world.level.material.Material.z) { // WOOD
|
||||||
bs.setLog();
|
bs.setLog();
|
||||||
}
|
}
|
||||||
if (mat.isSolid()) {
|
if (mat.b()) {
|
||||||
bs.setSolid();
|
bs.setSolid();
|
||||||
}
|
}
|
||||||
dataToState.put(bd, bs);
|
dataToState.put(bd, bs);
|
||||||
|
|
@ -194,20 +195,20 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getBiomeBaseWaterMult(Object bb) {
|
public int getBiomeBaseWaterMult(Object bb) {
|
||||||
Biome biome = (Biome) bb;
|
BiomeBase biome = (BiomeBase) bb;
|
||||||
return biome.getWaterColor(); // waterColor
|
return biome.k(); // waterColor
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get temperature from biomebase */
|
/** Get temperature from biomebase */
|
||||||
@Override
|
@Override
|
||||||
public float getBiomeBaseTemperature(Object bb) {
|
public float getBiomeBaseTemperature(Object bb) {
|
||||||
return ((Biome)bb).getBaseTemperature();
|
return ((BiomeBase)bb).i();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get humidity from biomebase */
|
/** Get humidity from biomebase */
|
||||||
@Override
|
@Override
|
||||||
public float getBiomeBaseHumidity(Object bb) {
|
public float getBiomeBaseHumidity(Object bb) {
|
||||||
return ((Biome)bb).getDownfall();
|
return ((BiomeBase)bb).h();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -253,10 +254,10 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
public String[] getBiomeNames() {
|
public String[] getBiomeNames() {
|
||||||
if (biomenames == null) {
|
if (biomenames == null) {
|
||||||
biomenames = new String[256];
|
biomenames = new String[256];
|
||||||
Iterator<Biome> iter = getBiomeReg().iterator();
|
Iterator<BiomeBase> iter = getBiomeReg().iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Biome b = iter.next();
|
BiomeBase b = iter.next();
|
||||||
int bidx = getBiomeReg().getId(b);
|
int bidx = getBiomeReg().a(b);
|
||||||
if (bidx >= biomenames.length) {
|
if (bidx >= biomenames.length) {
|
||||||
biomenames = Arrays.copyOf(biomenames, bidx + biomenames.length);
|
biomenames = Arrays.copyOf(biomenames, bidx + biomenames.length);
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +275,7 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
@Override
|
@Override
|
||||||
/** Get ID string from biomebase */
|
/** Get ID string from biomebase */
|
||||||
public String getBiomeBaseIDString(Object bb) {
|
public String getBiomeBaseIDString(Object bb) {
|
||||||
String s = ((Biome)bb).toString();
|
String s = ((BiomeBase)bb).toString();
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
String[] ss = s.split("\\.");
|
String[] ss = s.split("\\.");
|
||||||
return ss[ss.length-1];
|
return ss[ss.length-1];
|
||||||
|
|
@ -305,70 +306,70 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getInhabitedTicks(Chunk c) {
|
public long getInhabitedTicks(Chunk c) {
|
||||||
return ((CraftChunk)c).getHandle().getInhabitedTime();
|
return ((CraftChunk)c).getHandle().u();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
||||||
return ((CraftChunk)c).getHandle().blockEntities;
|
return ((CraftChunk)c).getHandle().i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTileEntityX(Object te) {
|
public int getTileEntityX(Object te) {
|
||||||
BlockEntity tileent = (BlockEntity) te;
|
TileEntity tileent = (TileEntity) te;
|
||||||
return tileent.getBlockPos().getX();
|
return tileent.p().u();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTileEntityY(Object te) {
|
public int getTileEntityY(Object te) {
|
||||||
BlockEntity tileent = (BlockEntity) te;
|
TileEntity tileent = (TileEntity) te;
|
||||||
return tileent.getBlockPos().getY();
|
return tileent.p().v();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTileEntityZ(Object te) {
|
public int getTileEntityZ(Object te) {
|
||||||
BlockEntity tileent = (BlockEntity) te;
|
TileEntity tileent = (TileEntity) te;
|
||||||
return tileent.getBlockPos().getZ();
|
return tileent.p().w();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object readTileEntityNBT(Object te) {
|
public Object readTileEntityNBT(Object te) {
|
||||||
BlockEntity tileent = (BlockEntity) te;
|
TileEntity tileent = (TileEntity) te;
|
||||||
CompoundTag nbt = tileent.saveWithId();
|
NBTTagCompound nbt = tileent.n();
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getFieldValue(Object nbt, String field) {
|
public Object getFieldValue(Object nbt, String field) {
|
||||||
CompoundTag rec = (CompoundTag) nbt;
|
NBTTagCompound rec = (NBTTagCompound) nbt;
|
||||||
Tag val = rec.get(field);
|
NBTBase val = rec.c(field);
|
||||||
if(val == null) return null;
|
if(val == null) return null;
|
||||||
if(val instanceof ByteTag) {
|
if(val instanceof NBTTagByte) {
|
||||||
return ((ByteTag)val).getAsByte();
|
return ((NBTTagByte)val).h();
|
||||||
}
|
}
|
||||||
else if(val instanceof ShortTag) {
|
else if(val instanceof NBTTagShort) {
|
||||||
return ((ShortTag)val).getAsShort();
|
return ((NBTTagShort)val).g();
|
||||||
}
|
}
|
||||||
else if(val instanceof IntTag) {
|
else if(val instanceof NBTTagInt) {
|
||||||
return ((IntTag)val).getAsInt();
|
return ((NBTTagInt)val).f();
|
||||||
}
|
}
|
||||||
else if(val instanceof LongTag) {
|
else if(val instanceof NBTTagLong) {
|
||||||
return ((LongTag)val).getAsLong();
|
return ((NBTTagLong)val).e();
|
||||||
}
|
}
|
||||||
else if(val instanceof FloatTag) {
|
else if(val instanceof NBTTagFloat) {
|
||||||
return ((FloatTag)val).getAsFloat();
|
return ((NBTTagFloat)val).j();
|
||||||
}
|
}
|
||||||
else if(val instanceof DoubleTag) {
|
else if(val instanceof NBTTagDouble) {
|
||||||
return ((DoubleTag)val).getAsDouble();
|
return ((NBTTagDouble)val).i();
|
||||||
}
|
}
|
||||||
else if(val instanceof ByteArrayTag) {
|
else if(val instanceof NBTTagByteArray) {
|
||||||
return ((ByteArrayTag)val).getAsByteArray();
|
return ((NBTTagByteArray)val).d();
|
||||||
}
|
}
|
||||||
else if(val instanceof StringTag) {
|
else if(val instanceof NBTTagString) {
|
||||||
return ((StringTag)val).getAsString();
|
return ((NBTTagString)val).e_();
|
||||||
}
|
}
|
||||||
else if(val instanceof IntArrayTag) {
|
else if(val instanceof NBTTagIntArray) {
|
||||||
return ((IntArrayTag)val).getAsIntArray();
|
return ((NBTTagIntArray)val).f();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ import org.dynmap.utils.DataBitsPacked;
|
||||||
import org.dynmap.utils.DynIntHashMap;
|
import org.dynmap.utils.DynIntHashMap;
|
||||||
import org.dynmap.utils.VisibilityLimit;
|
import org.dynmap.utils.VisibilityLimit;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.BitStorage;
|
import net.minecraft.util.DataBits;
|
||||||
import net.minecraft.util.SimpleBitStorage;
|
import net.minecraft.util.SimpleBitStorage;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkCoordIntPair;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
|
||||||
import net.minecraft.world.level.chunk.storage.ChunkSerializer;
|
import net.minecraft.world.level.chunk.Chunk;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -150,14 +150,14 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
this.inhabitedTicks = inhabitedTime;
|
this.inhabitedTicks = inhabitedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTSnapshot(CompoundTag nbt, int worldheight) {
|
public NBTSnapshot(NBTTagCompound nbt, int worldheight) {
|
||||||
this.x = nbt.getInt("xPos");
|
this.x = nbt.h("xPos");
|
||||||
this.z = nbt.getInt("zPos");
|
this.z = nbt.h("zPos");
|
||||||
this.captureFulltime = 0;
|
this.captureFulltime = 0;
|
||||||
this.hmap = nbt.getIntArray("HeightMap");
|
this.hmap = nbt.n("HeightMap");
|
||||||
this.sectionCnt = worldheight / 16;
|
this.sectionCnt = worldheight / 16;
|
||||||
if (nbt.contains("InhabitedTime")) {
|
if (nbt.b("InhabitedTime")) {
|
||||||
this.inhabitedTicks = nbt.getLong("InhabitedTime");
|
this.inhabitedTicks = nbt.i("InhabitedTime");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.inhabitedTicks = 0;
|
this.inhabitedTicks = 0;
|
||||||
|
|
@ -172,10 +172,10 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
sectcnt++;
|
sectcnt++;
|
||||||
}
|
}
|
||||||
/* Get sections */
|
/* Get sections */
|
||||||
ListTag sect = nbt.getList("Sections", 10);
|
NBTTagList sect = nbt.c("Sections", 10);
|
||||||
for (int i = 0; i < sect.size(); i++) {
|
for (int i = 0; i < sect.size(); i++) {
|
||||||
CompoundTag sec = sect.getCompound(i);
|
NBTTagCompound sec = sect.a(i);
|
||||||
int secnum = sec.getByte("Y");
|
int secnum = sec.h("Y");
|
||||||
// Beyond end - extend up
|
// Beyond end - extend up
|
||||||
while (secnum >= (sectcnt - sectoff)) {
|
while (secnum >= (sectcnt - sectoff)) {
|
||||||
sections.addLast(empty_section); // Pad with empty
|
sections.addLast(empty_section); // Pad with empty
|
||||||
|
|
@ -194,19 +194,19 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
DynmapBlockState[] states = cursect.states;
|
DynmapBlockState[] states = cursect.states;
|
||||||
DynmapBlockState[] palette = null;
|
DynmapBlockState[] palette = null;
|
||||||
// If we've got palette and block states list, process non-empty section
|
// If we've got palette and block states list, process non-empty section
|
||||||
if (sec.contains("Palette", 9) && sec.contains("BlockStates", 12)) {
|
if (sec.b("Palette", 9) && sec.b("BlockStates", 12)) {
|
||||||
ListTag plist = sec.getList("Palette", 10);
|
NBTTagList plist = sec.c("Palette", 10);
|
||||||
long[] statelist = sec.getLongArray("BlockStates");
|
long[] statelist = sec.o("BlockStates");
|
||||||
palette = new DynmapBlockState[plist.size()];
|
palette = new DynmapBlockState[plist.size()];
|
||||||
for (int pi = 0; pi < plist.size(); pi++) {
|
for (int pi = 0; pi < plist.size(); pi++) {
|
||||||
CompoundTag tc = plist.getCompound(pi);
|
NBTTagCompound tc = plist.a(pi);
|
||||||
String pname = tc.getString("Name");
|
String pname = tc.l("Name");
|
||||||
if (tc.contains("Properties")) {
|
if (tc.b("Properties")) {
|
||||||
StringBuilder statestr = new StringBuilder();
|
StringBuilder statestr = new StringBuilder();
|
||||||
CompoundTag prop = tc.getCompound("Properties");
|
NBTTagCompound prop = tc.p("Properties");
|
||||||
for (String pid : prop.getAllKeys()) {
|
for (String pid : prop.d()) {
|
||||||
if (statestr.length() > 0) statestr.append(',');
|
if (statestr.length() > 0) statestr.append(',');
|
||||||
statestr.append(pid).append('=').append(prop.get(pid).getAsString());
|
statestr.append(pid).append('=').append(prop.c(pid).e_());
|
||||||
}
|
}
|
||||||
palette[pi] = DynmapBlockState.getStateByNameAndState(pname, statestr.toString());
|
palette[pi] = DynmapBlockState.getStateByNameAndState(pname, statestr.toString());
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
}
|
}
|
||||||
int recsperblock = (4096 + statelist.length - 1) / statelist.length;
|
int recsperblock = (4096 + statelist.length - 1) / statelist.length;
|
||||||
int bitsperblock = 64 / recsperblock;
|
int bitsperblock = 64 / recsperblock;
|
||||||
BitStorage db = null;
|
DataBits db = null;
|
||||||
DataBitsPacked dbp = null;
|
DataBitsPacked dbp = null;
|
||||||
try {
|
try {
|
||||||
db = new SimpleBitStorage(bitsperblock, 4096, statelist);
|
db = new SimpleBitStorage(bitsperblock, 4096, statelist);
|
||||||
|
|
@ -229,30 +229,30 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
}
|
}
|
||||||
if (bitsperblock > 8) { // Not palette
|
if (bitsperblock > 8) { // Not palette
|
||||||
for (int j = 0; j < 4096; j++) {
|
for (int j = 0; j < 4096; j++) {
|
||||||
int v = (dbp != null) ? dbp.getAt(j) : db.get(j);
|
int v = (dbp != null) ? dbp.getAt(j) : db.a(j);
|
||||||
states[j] = DynmapBlockState.getStateByGlobalIndex(v);
|
states[j] = DynmapBlockState.getStateByGlobalIndex(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int j = 0; j < 4096; j++) {
|
for (int j = 0; j < 4096; j++) {
|
||||||
int v = (dbp != null) ? dbp.getAt(j) : db.get(j);
|
int v = (dbp != null) ? dbp.getAt(j) : db.a(j);
|
||||||
states[j] = (v < palette.length) ? palette[v] : DynmapBlockState.AIR;
|
states[j] = (v < palette.length) ? palette[v] : DynmapBlockState.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sec.contains("BlockLight")) {
|
if (sec.b("BlockLight")) {
|
||||||
cursect.emitlight = dataCopy(sec.getByteArray("BlockLight"));
|
cursect.emitlight = dataCopy(sec.m("BlockLight"));
|
||||||
}
|
}
|
||||||
if (sec.contains("SkyLight")) {
|
if (sec.b("SkyLight")) {
|
||||||
cursect.skylight = dataCopy(sec.getByteArray("SkyLight"));
|
cursect.skylight = dataCopy(sec.m("SkyLight"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Get biome data */
|
/* Get biome data */
|
||||||
this.biome = new int[COLUMNS_PER_CHUNK];
|
this.biome = new int[COLUMNS_PER_CHUNK];
|
||||||
this.biomebase = new Object[COLUMNS_PER_CHUNK];
|
this.biomebase = new Object[COLUMNS_PER_CHUNK];
|
||||||
Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
|
Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
|
||||||
if (nbt.contains("Biomes")) {
|
if (nbt.b("Biomes")) {
|
||||||
int[] bb = nbt.getIntArray("Biomes");
|
int[] bb = nbt.n("Biomes");
|
||||||
if (bb != null) {
|
if (bb != null) {
|
||||||
// If v1.15+ format
|
// If v1.15+ format
|
||||||
if (bb.length > COLUMNS_PER_CHUNK) {
|
if (bb.length > COLUMNS_PER_CHUNK) {
|
||||||
|
|
@ -343,21 +343,21 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompoundTag fetchLoadedChunkNBT(World w, int x, int z) {
|
private NBTTagCompound fetchLoadedChunkNBT(World w, int x, int z) {
|
||||||
CraftWorld cw = (CraftWorld) w;
|
CraftWorld cw = (CraftWorld) w;
|
||||||
CompoundTag nbt = null;
|
NBTTagCompound nbt = null;
|
||||||
if (cw.isChunkLoaded(x, z)) {
|
if (cw.isChunkLoaded(x, z)) {
|
||||||
LevelChunk c = cw.getHandle().getChunk(x, z);
|
Chunk c = cw.getHandle().getChunkIfLoaded(x, z);
|
||||||
if ((c != null) && c.loaded) { // c.loaded
|
if ((c != null) && c.o) { // c.loaded
|
||||||
nbt = ChunkSerializer.write(cw.getHandle(), c);
|
nbt = ChunkRegionLoader.a(cw.getHandle(), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
nbt = nbt.getCompound("Level");
|
nbt = nbt.p("Level");
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
String stat = nbt.getString("Status");
|
String stat = nbt.l("Status");
|
||||||
ChunkStatus cs = ChunkStatus.byName(stat);
|
ChunkStatus cs = ChunkStatus.a(stat);
|
||||||
if ((stat == null) || (!cs.isOrAfter(ChunkStatus.LIGHT))) { // ChunkStatus.LIGHT
|
if ((stat == null) || (!cs.b(ChunkStatus.l))) { // ChunkStatus.LIGHT
|
||||||
nbt = null;
|
nbt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -365,25 +365,25 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompoundTag loadChunkNBT(World w, int x, int z) {
|
private NBTTagCompound loadChunkNBT(World w, int x, int z) {
|
||||||
CraftWorld cw = (CraftWorld) w;
|
CraftWorld cw = (CraftWorld) w;
|
||||||
CompoundTag nbt = null;
|
NBTTagCompound nbt = null;
|
||||||
ChunkPos cc = new ChunkPos(x, z);
|
ChunkCoordIntPair cc = new ChunkCoordIntPair(x, z);
|
||||||
try {
|
try {
|
||||||
nbt = cw.getHandle().getChunkSource().chunkMap.read(cc); // playerChunkMap
|
nbt = cw.getHandle().k().a.f(cc); // playerChunkMap
|
||||||
} catch (IOException iox) {
|
} catch (IOException iox) {
|
||||||
}
|
}
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
nbt = nbt.getCompound("Level");
|
nbt = nbt.p("Level");
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
String stat = nbt.getString("Status");
|
String stat = nbt.l("Status");
|
||||||
if ((stat == null) || (stat.equals("full") == false)) {
|
if ((stat == null) || (stat.equals("full") == false)) {
|
||||||
nbt = null;
|
nbt = null;
|
||||||
if ((stat == null) || stat.equals("") && DynmapCore.migrateChunks()) {
|
if ((stat == null) || stat.equals("") && DynmapCore.migrateChunks()) {
|
||||||
LevelChunk c = cw.getHandle().getChunk(x, z);
|
Chunk c = cw.getHandle().getChunkIfLoaded(x, z);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
nbt = fetchLoadedChunkNBT(w, x, z);
|
nbt = fetchLoadedChunkNBT(w, x, z);
|
||||||
cw.getHandle().unload(c);
|
cw.getHandle().a(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -457,7 +457,7 @@ public class MapChunkCache118 extends AbstractMapChunkCache {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Fetch NTB for chunk if loaded
|
// Fetch NTB for chunk if loaded
|
||||||
CompoundTag nbt = fetchLoadedChunkNBT(w, chunk.x, chunk.z);
|
NBTTagCompound nbt = fetchLoadedChunkNBT(w, chunk.x, chunk.z);
|
||||||
boolean did_load = false;
|
boolean did_load = false;
|
||||||
if (nbt == null) {
|
if (nbt == null) {
|
||||||
// Load NTB for chunk, if it exists
|
// Load NTB for chunk, if it exists
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ include ':bukkit-helper-116-2'
|
||||||
include ':bukkit-helper-116-3'
|
include ':bukkit-helper-116-3'
|
||||||
include ':bukkit-helper-116-4'
|
include ':bukkit-helper-116-4'
|
||||||
include ':bukkit-helper-117'
|
include ':bukkit-helper-117'
|
||||||
//NOTYET include ':bukkit-helper-118'
|
include ':bukkit-helper-118'
|
||||||
include ':bukkit-helper'
|
include ':bukkit-helper'
|
||||||
include ':dynmap-api'
|
include ':dynmap-api'
|
||||||
include ':DynmapCore'
|
include ':DynmapCore'
|
||||||
|
|
@ -40,7 +40,7 @@ project(':bukkit-helper-116-2').projectDir = "$rootDir/bukkit-helper-116-2" as F
|
||||||
project(':bukkit-helper-116-3').projectDir = "$rootDir/bukkit-helper-116-3" 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-116-4').projectDir = "$rootDir/bukkit-helper-116-4" as File
|
||||||
project(':bukkit-helper-117').projectDir = "$rootDir/bukkit-helper-117" as File
|
project(':bukkit-helper-117').projectDir = "$rootDir/bukkit-helper-117" as File
|
||||||
//NOTYET project(':bukkit-helper-118').projectDir = "$rootDir/bukkit-helper-118" as File
|
project(':bukkit-helper-118').projectDir = "$rootDir/bukkit-helper-118" as File
|
||||||
project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
||||||
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
||||||
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ dependencies {
|
||||||
implementation(project(':bukkit-helper-117')) {
|
implementation(project(':bukkit-helper-117')) {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
//NOTYET implementation(project(':bukkit-helper-118')) {
|
implementation(project(':bukkit-helper-118')) {
|
||||||
//NOTYET transitive = false
|
transitive = false
|
||||||
//NOTYET }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
@ -84,7 +84,7 @@ shadowJar {
|
||||||
include(dependency(':bukkit-helper-116-3'))
|
include(dependency(':bukkit-helper-116-3'))
|
||||||
include(dependency(':bukkit-helper-116-4'))
|
include(dependency(':bukkit-helper-116-4'))
|
||||||
include(dependency(':bukkit-helper-117'))
|
include(dependency(':bukkit-helper-117'))
|
||||||
//NOTYET include(dependency(':bukkit-helper-118'))
|
include(dependency(':bukkit-helper-118'))
|
||||||
}
|
}
|
||||||
relocate('org.bstats', 'org.dynmap.bstats')
|
relocate('org.bstats', 'org.dynmap.bstats')
|
||||||
destinationDir = file '../target'
|
destinationDir = file '../target'
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.dynmap.bukkit.helper.v116_2.BukkitVersionHelperSpigot116_2;
|
||||||
import org.dynmap.bukkit.helper.v116_3.BukkitVersionHelperSpigot116_3;
|
import org.dynmap.bukkit.helper.v116_3.BukkitVersionHelperSpigot116_3;
|
||||||
import org.dynmap.bukkit.helper.v116_4.BukkitVersionHelperSpigot116_4;
|
import org.dynmap.bukkit.helper.v116_4.BukkitVersionHelperSpigot116_4;
|
||||||
import org.dynmap.bukkit.helper.v117.BukkitVersionHelperSpigot117;
|
import org.dynmap.bukkit.helper.v117.BukkitVersionHelperSpigot117;
|
||||||
//NOTYET import org.dynmap.bukkit.helper.v118.BukkitVersionHelperSpigot118;
|
import org.dynmap.bukkit.helper.v118.BukkitVersionHelperSpigot118;
|
||||||
|
|
||||||
public class Helper {
|
public class Helper {
|
||||||
|
|
||||||
|
|
@ -39,9 +39,9 @@ public class Helper {
|
||||||
Log.info("Loading Glowstone support");
|
Log.info("Loading Glowstone support");
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
||||||
}
|
}
|
||||||
//NOTYET else if (v.contains("(MC: 1.18")) {
|
else if (v.contains("(MC: 1.18")) {
|
||||||
//NOTYET BukkitVersionHelper.helper = new BukkitVersionHelperSpigot118();
|
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot118();
|
||||||
//NOTYET }
|
}
|
||||||
else if (v.contains("(MC: 1.17")) {
|
else if (v.contains("(MC: 1.17")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot117();
|
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot117();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue