mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-03-31 16:55:50 +02:00
Implement basic sky lighting for chunks with broken lighting (spigot)
This commit is contained in:
parent
3a3a970883
commit
5b735dab3f
@ -1094,6 +1094,7 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
|
||||
if (!hasLitState) {
|
||||
hasLight = false;
|
||||
}
|
||||
hasLight = false;//DEBUG
|
||||
// If no light, do simple generate
|
||||
if (!hasLight) {
|
||||
//Log.info(String.format("generateSky(%d,%d)", x, z));
|
||||
|
@ -26,6 +26,9 @@ import net.minecraft.server.v1_15_R1.BlockLogAbstract;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.IRegistry;
|
||||
import net.minecraft.server.v1_15_R1.Material;
|
||||
import net.minecraft.server.v1_15_R1.BlockAccessAir;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.BlockRotatable;
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
@ -111,9 +114,11 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
// Loop through block data states
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
Block b = bd.getBlock();
|
||||
String bname = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
@ -129,25 +134,22 @@ public class BukkitVersionHelperSpigot115 extends BukkitVersionHelperCB {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
int lightAtten = b.l(bd, BlockAccessAir.INSTANCE, BlockPosition.ZERO); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.AIR) { bld.setAir(); }
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.WOOD)) { bld.setLog(); }
|
||||
if (mat == Material.LEAVES) { bld.setLeaves(); }
|
||||
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 BlockLogAbstract) {
|
||||
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());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -24,7 +24,9 @@ import org.dynmap.utils.Polygon;
|
||||
|
||||
import net.minecraft.server.v1_16_R2.BiomeBase;
|
||||
import net.minecraft.server.v1_16_R2.Block;
|
||||
import net.minecraft.server.v1_16_R2.BlockAccessAir;
|
||||
import net.minecraft.server.v1_16_R2.BlockFluids;
|
||||
import net.minecraft.server.v1_16_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_16_R2.BlockRotatable;
|
||||
import net.minecraft.server.v1_16_R2.IBlockData;
|
||||
import net.minecraft.server.v1_16_R2.IRegistry;
|
||||
@ -98,9 +100,11 @@ public class BukkitVersionHelperSpigot116_2 extends BukkitVersionHelperGeneric {
|
||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
// Loop through block data states
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
Block b = bd.getBlock();
|
||||
String bname = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
@ -116,25 +120,22 @@ public class BukkitVersionHelperSpigot116_2 extends BukkitVersionHelperGeneric {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
int lightAtten = b.f(bd, BlockAccessAir.INSTANCE, BlockPosition.ZERO); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.AIR) { bld.setAir(); }
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.WOOD)) { bld.setLog(); }
|
||||
if (mat == Material.LEAVES) { bld.setLeaves(); }
|
||||
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());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -30,6 +30,8 @@ import net.minecraft.server.v1_16_R2.IBlockData;
|
||||
import net.minecraft.server.v1_16_R2.IRegistry;
|
||||
import net.minecraft.server.v1_16_R2.Material;
|
||||
import net.minecraft.server.v1_16_R2.MinecraftServer;
|
||||
import net.minecraft.server.v1_16_R2.BlockAccessAir;
|
||||
import net.minecraft.server.v1_16_R2.BlockPosition;
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
@ -98,9 +100,11 @@ public class BukkitVersionHelperSpigot116_3 extends BukkitVersionHelperGeneric {
|
||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
// Loop through block data states
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
Block b = bd.getBlock();
|
||||
String bname = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
@ -116,25 +120,22 @@ public class BukkitVersionHelperSpigot116_3 extends BukkitVersionHelperGeneric {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
int lightAtten = b.f(bd, BlockAccessAir.INSTANCE, BlockPosition.ZERO); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.AIR) { bld.setAir(); }
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.WOOD)) { bld.setLog(); }
|
||||
if (mat == Material.LEAVES) { bld.setLeaves(); }
|
||||
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());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -89,9 +89,11 @@ public class BukkitVersionHelperSpigot116_4 extends BukkitVersionHelperGeneric {
|
||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
// Loop through block data states
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
Block b = bd.getBlock();
|
||||
String bname = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
@ -107,25 +109,22 @@ public class BukkitVersionHelperSpigot116_4 extends BukkitVersionHelperGeneric {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
int lightAtten = b.f(bd, BlockAccessAir.INSTANCE, BlockPosition.ZERO); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.AIR) { bld.setAir(); }
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.WOOD)) { bld.setLog(); }
|
||||
if (mat == Material.LEAVES) { bld.setLeaves(); }
|
||||
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());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -29,6 +29,8 @@ import net.minecraft.server.v1_16_R1.BlockRotatable;
|
||||
import net.minecraft.server.v1_16_R1.IBlockData;
|
||||
import net.minecraft.server.v1_16_R1.IRegistry;
|
||||
import net.minecraft.server.v1_16_R1.Material;
|
||||
import net.minecraft.server.v1_16_R1.BlockAccessAir;
|
||||
import net.minecraft.server.v1_16_R1.BlockPosition;
|
||||
|
||||
/**
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
@ -88,9 +90,11 @@ public class BukkitVersionHelperSpigot116 extends BukkitVersionHelperGeneric {
|
||||
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
|
||||
|
||||
int cnt = Block.REGISTRY_ID.a();
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
// Loop through block data states
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
Block b = bd.getBlock();
|
||||
String bname = IRegistry.BLOCK.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
@ -106,25 +110,22 @@ public class BukkitVersionHelperSpigot116 extends BukkitVersionHelperGeneric {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
int lightAtten = b.f(bd, BlockAccessAir.INSTANCE, BlockPosition.ZERO); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.AIR) { bld.setAir(); }
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.WOOD)) { bld.setLog(); }
|
||||
if (mat == Material.LEAVES) { bld.setLeaves(); }
|
||||
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());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -26,6 +26,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
@ -39,6 +40,7 @@ import net.minecraft.nbt.NBTTagLong;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.BlockAccessAir;
|
||||
import net.minecraft.world.level.biome.BiomeBase;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.BlockFluids;
|
||||
@ -120,8 +122,10 @@ public class BukkitVersionHelperSpigot117 extends BukkitVersionHelper {
|
||||
|
||||
int cnt = Block.p.a();
|
||||
// Loop through block data states
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
IBlockData bd = Block.getByCombinedId(i);
|
||||
Block b = bd.getBlock();
|
||||
String bname = IRegistry.W.getKey(bd.getBlock()).toString();
|
||||
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
|
||||
int idx = 0;
|
||||
@ -137,25 +141,23 @@ public class BukkitVersionHelperSpigot117 extends BukkitVersionHelper {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
Material mat = bd.getMaterial();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
|
||||
int lightAtten = b.g(bd, BlockAccessAir.a, BlockPosition.b); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.a) { bld.setAir(); }
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.z)) { bld.setLog(); }
|
||||
if (mat == Material.E) { bld.setLeaves(); }
|
||||
if ((!bd.getFluid().isEmpty()) && ((bd.getBlock() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||
bs.setWaterlogged();
|
||||
}
|
||||
if (mat == Material.a) { // AIR
|
||||
bs.setAir();
|
||||
}
|
||||
if (mat == Material.E) { // LEAVES
|
||||
bs.setLeaves();
|
||||
}
|
||||
if ((bd.getBlock() instanceof BlockRotatable) && (bd.getMaterial() == Material.z)) { // 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());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -27,6 +27,7 @@ import com.mojang.authlib.properties.PropertyMap;
|
||||
|
||||
import net.minecraft.core.RegistryBlockID;
|
||||
import net.minecraft.core.RegistryBlocks;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.NBTTagByteArray;
|
||||
@ -42,6 +43,7 @@ import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.BlockAccessAir;
|
||||
import net.minecraft.world.level.biome.BiomeBase;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.BlockFluids;
|
||||
@ -146,6 +148,7 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
|
||||
// Loop through block data states
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
while (iter.hasNext()) {
|
||||
IBlockData bd = iter.next();
|
||||
Block b = bd.b();
|
||||
@ -165,25 +168,23 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||
sb = fname.substring(off1+1, off2);
|
||||
}
|
||||
net.minecraft.world.level.material.Material mat = bd.c();
|
||||
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb, mat.toString());
|
||||
|
||||
int lightAtten = b.g(bd, BlockAccessAir.a, BlockPosition.b); // getLightBlock
|
||||
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||
if (mat.b()) { bld.setSolid(); }
|
||||
if (mat == net.minecraft.world.level.material.Material.a) { bld.setAir(); }
|
||||
if (mat == net.minecraft.world.level.material.Material.z) { bld.setLog(); }
|
||||
if (mat == net.minecraft.world.level.material.Material.F) { bld.setLeaves(); }
|
||||
if ((!bd.n().c()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||
bs.setWaterlogged();
|
||||
}
|
||||
if (mat == net.minecraft.world.level.material.Material.a) { // AIR
|
||||
bs.setAir();
|
||||
}
|
||||
if (mat == net.minecraft.world.level.material.Material.F) { // LEAVES
|
||||
bs.setLeaves();
|
||||
}
|
||||
if (mat == net.minecraft.world.level.material.Material.z) { // WOOD
|
||||
bs.setLog();
|
||||
}
|
||||
if (mat.b()) {
|
||||
bs.setSolid();
|
||||
}
|
||||
dataToState.put(bd, bs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? bs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + bs.isWaterlogged());
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
|
||||
dataToState.put(bd, dbs);
|
||||
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user