mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-25 00:02:03 +01:00
Initial Spigot/Paper 1.20 support
This commit is contained in:
parent
130953bc12
commit
43a86b820c
@ -43,6 +43,7 @@ import net.minecraft.nbt.NBTTagString;
|
|||||||
import net.minecraft.resources.MinecraftKey;
|
import net.minecraft.resources.MinecraftKey;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.tags.TagsBlock;
|
||||||
import net.minecraft.world.level.BlockAccessAir;
|
import net.minecraft.world.level.BlockAccessAir;
|
||||||
import net.minecraft.world.level.biome.BiomeBase;
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
@ -189,13 +190,15 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
|
|||||||
int lightAtten = b.g(bd, BlockAccessAir.a, BlockPosition.b); // getLightBlock
|
int lightAtten = b.g(bd, BlockAccessAir.a, BlockPosition.b); // getLightBlock
|
||||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||||
// Fill in base attributes
|
// Fill in base attributes
|
||||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setAttenuatesLight(lightAtten);
|
||||||
if (mat.b()) { bld.setSolid(); }
|
if (bd.w() != null) { bld.setMaterial(bd.w().toString()); }
|
||||||
if (b instanceof BlockAir) { bld.setAir(); }
|
if (bd.e()) { bld.setSolid(); }
|
||||||
if (b instanceof BlockRotatable) { bld.setLog(); }
|
if (bd.i()) { bld.setAir(); }
|
||||||
if (b instanceof BlockLeaves) { bld.setLeaves(); }
|
if (bd.a(TagsBlock.t)) { bld.setLog(); }
|
||||||
if ((!bd.r().c()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
if (bd.a(TagsBlock.O)) { bld.setLeaves(); }
|
||||||
|
if ((!bd.u().c()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||||
bld.setWaterlogged();
|
bld.setWaterlogged();
|
||||||
|
//Log.info("statename=" + bname + "[" + sb + "] = waterlogged");
|
||||||
}
|
}
|
||||||
DynmapBlockState dbs = bld.build(); // Build state
|
DynmapBlockState dbs = bld.build(); // Build state
|
||||||
|
|
||||||
@ -338,12 +341,12 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getInhabitedTicks(Chunk c) {
|
public long getInhabitedTicks(Chunk c) {
|
||||||
return ((CraftChunk)c).getHandle(ChunkStatus.o).u();
|
return ((CraftChunk)c).getHandle(ChunkStatus.n).u();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
||||||
return ((CraftChunk)c).getHandle(ChunkStatus.o).i;
|
return ((CraftChunk)c).getHandle(ChunkStatus.n).k;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -398,7 +401,7 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
|
|||||||
return ((NBTTagByteArray)val).d();
|
return ((NBTTagByteArray)val).d();
|
||||||
}
|
}
|
||||||
else if(val instanceof NBTTagString) {
|
else if(val instanceof NBTTagString) {
|
||||||
return ((NBTTagString)val).f_();
|
return ((NBTTagString)val).m_();
|
||||||
}
|
}
|
||||||
else if(val instanceof NBTTagIntArray) {
|
else if(val instanceof NBTTagIntArray) {
|
||||||
return ((NBTTagIntArray)val).f();
|
return ((NBTTagIntArray)val).f();
|
||||||
|
@ -3,7 +3,7 @@ package org.dynmap.bukkit.helper.v120;
|
|||||||
import net.minecraft.world.level.biome.BiomeBase;
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
import net.minecraft.world.level.biome.BiomeFog;
|
import net.minecraft.world.level.biome.BiomeFog;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
|
||||||
import org.dynmap.DynmapChunk;
|
import org.dynmap.DynmapChunk;
|
||||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||||
import org.dynmap.bukkit.helper.BukkitWorld;
|
import org.dynmap.bukkit.helper.BukkitWorld;
|
||||||
@ -53,7 +53,7 @@ public class MapChunkCache119_4 extends GenericMapChunkCache {
|
|||||||
CraftWorld cw = (CraftWorld) w;
|
CraftWorld cw = (CraftWorld) w;
|
||||||
if (!cw.isChunkLoaded(chunk.x, chunk.z)) return null;
|
if (!cw.isChunkLoaded(chunk.x, chunk.z)) return null;
|
||||||
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z);
|
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z);
|
||||||
if (c == null || !c.o) return null; // c.loaded
|
if (c == null || !c.q) return null; // c.loaded
|
||||||
NBTTagCompound nbt = ChunkRegionLoader.a(cw.getHandle(), c);
|
NBTTagCompound nbt = ChunkRegionLoader.a(cw.getHandle(), c);
|
||||||
return nbt != null ? parseChunkFromNBT(new NBT.NBTCompound(nbt)) : null;
|
return nbt != null ? parseChunkFromNBT(new NBT.NBTCompound(nbt)) : null;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ public class MapChunkCache119_4 extends GenericMapChunkCache {
|
|||||||
ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
|
ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
|
||||||
GenericChunk gc = null;
|
GenericChunk gc = null;
|
||||||
try { // BUGBUG - convert this all to asyn properly, since now native async
|
try { // BUGBUG - convert this all to asyn properly, since now native async
|
||||||
nbt = cw.getHandle().k().a.f(cc).join().get(); // playerChunkMap
|
nbt = cw.getHandle().k().a.e(cc).join().get(); // playerChunkMap
|
||||||
} catch (CancellationException cx) {
|
} catch (CancellationException cx) {
|
||||||
} catch (NoSuchElementException snex) {
|
} catch (NoSuchElementException snex) {
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class NBT {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getAsString(String s) {
|
public String getAsString(String s) {
|
||||||
return obj.c(s).f_();
|
return obj.c(s).m_();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public GenericBitStorage makeBitStorage(int bits, int count, long[] data) {
|
public GenericBitStorage makeBitStorage(int bits, int count, long[] data) {
|
||||||
|
@ -34,7 +34,7 @@ minecraft {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project.archivesBaseName = "${project.archivesBaseName}-forge-1.19.3"
|
project.archivesBaseName = "${project.archivesBaseName}-forge-1.20"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(path: ":DynmapCore", configuration: "shadow")
|
implementation project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
@ -22,7 +22,7 @@ include ':bukkit-helper-118-2'
|
|||||||
include ':bukkit-helper-119'
|
include ':bukkit-helper-119'
|
||||||
include ':bukkit-helper-119-3'
|
include ':bukkit-helper-119-3'
|
||||||
include ':bukkit-helper-119-4'
|
include ':bukkit-helper-119-4'
|
||||||
//include ':bukkit-helper-120'
|
include ':bukkit-helper-120'
|
||||||
include ':bukkit-helper'
|
include ':bukkit-helper'
|
||||||
include ':dynmap-api'
|
include ':dynmap-api'
|
||||||
include ':DynmapCore'
|
include ':DynmapCore'
|
||||||
@ -61,7 +61,7 @@ project(':bukkit-helper-118-2').projectDir = "$rootDir/bukkit-helper-118-2" as F
|
|||||||
project(':bukkit-helper-119').projectDir = "$rootDir/bukkit-helper-119" as File
|
project(':bukkit-helper-119').projectDir = "$rootDir/bukkit-helper-119" as File
|
||||||
project(':bukkit-helper-119-3').projectDir = "$rootDir/bukkit-helper-119-3" as File
|
project(':bukkit-helper-119-3').projectDir = "$rootDir/bukkit-helper-119-3" as File
|
||||||
project(':bukkit-helper-119-4').projectDir = "$rootDir/bukkit-helper-119-4" as File
|
project(':bukkit-helper-119-4').projectDir = "$rootDir/bukkit-helper-119-4" as File
|
||||||
//project(':bukkit-helper-120').projectDir = "$rootDir/bukkit-helper-120" as File
|
project(':bukkit-helper-120').projectDir = "$rootDir/bukkit-helper-120" 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
|
||||||
|
@ -72,6 +72,9 @@ dependencies {
|
|||||||
implementation(project(':bukkit-helper-119-4')) {
|
implementation(project(':bukkit-helper-119-4')) {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
implementation(project(':bukkit-helper-120')) {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@ -108,6 +111,7 @@ shadowJar {
|
|||||||
include(dependency(':bukkit-helper-119'))
|
include(dependency(':bukkit-helper-119'))
|
||||||
include(dependency(':bukkit-helper-119-3'))
|
include(dependency(':bukkit-helper-119-3'))
|
||||||
include(dependency(':bukkit-helper-119-4'))
|
include(dependency(':bukkit-helper-119-4'))
|
||||||
|
include(dependency(':bukkit-helper-120'))
|
||||||
}
|
}
|
||||||
relocate('org.bstats', 'org.dynmap.bstats')
|
relocate('org.bstats', 'org.dynmap.bstats')
|
||||||
destinationDir = file '../target'
|
destinationDir = file '../target'
|
||||||
|
@ -18,6 +18,7 @@ import org.dynmap.bukkit.helper.v118_2.BukkitVersionHelperSpigot118_2;
|
|||||||
import org.dynmap.bukkit.helper.v119.BukkitVersionHelperSpigot119;
|
import org.dynmap.bukkit.helper.v119.BukkitVersionHelperSpigot119;
|
||||||
import org.dynmap.bukkit.helper.v119_3.BukkitVersionHelperSpigot119_3;
|
import org.dynmap.bukkit.helper.v119_3.BukkitVersionHelperSpigot119_3;
|
||||||
import org.dynmap.bukkit.helper.v119_4.BukkitVersionHelperSpigot119_4;
|
import org.dynmap.bukkit.helper.v119_4.BukkitVersionHelperSpigot119_4;
|
||||||
|
import org.dynmap.bukkit.helper.v120.BukkitVersionHelperSpigot120;
|
||||||
|
|
||||||
public class Helper {
|
public class Helper {
|
||||||
|
|
||||||
@ -43,6 +44,9 @@ public class Helper {
|
|||||||
Log.info("Loading Glowstone support");
|
Log.info("Loading Glowstone support");
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
||||||
}
|
}
|
||||||
|
else if (v.contains("(MC: 1.20")) {
|
||||||
|
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot120();
|
||||||
|
}
|
||||||
else if (v.contains("(MC: 1.19)") || v.contains("(MC: 1.19.1)") || v.contains("(MC: 1.19.2)")) {
|
else if (v.contains("(MC: 1.19)") || v.contains("(MC: 1.19.1)") || v.contains("(MC: 1.19.2)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot119();
|
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot119();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user