Implement basic sky lighting for chunks with broken lighting
(forge,fabric)
This commit is contained in:
parent
05819b1b74
commit
3a3a970883
12 changed files with 197 additions and 219 deletions
|
|
@ -51,6 +51,7 @@ import net.minecraft.server.players.GameProfileCache;
|
|||
import net.minecraft.server.players.UserBanList;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
|
@ -214,6 +215,7 @@ public class DynmapPlugin
|
|||
int baseidx = 0;
|
||||
|
||||
Iterator<BlockState> iter = bsids.iterator();
|
||||
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||
while (iter.hasNext()) {
|
||||
BlockState bs = iter.next();
|
||||
int idx = bsids.getId(bs);
|
||||
|
|
@ -245,25 +247,21 @@ public class DynmapPlugin
|
|||
}
|
||||
statename += p.getName() + "=" + bs.getValue(p).toString();
|
||||
}
|
||||
//Log.info("bn=" + bn + ", statenme=" + statename + ",idx=" + idx + ",baseidx=" + baseidx);
|
||||
DynmapBlockState dbs = new DynmapBlockState(basebs, idx - baseidx, bn, statename, mat.toString(), idx);
|
||||
int lightAtten = bs.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO) ? 15 : (bs.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO) ? 0 : 1);
|
||||
//Log.info("statename=" + bn + "[" + statename + "], lightAtten=" + lightAtten);
|
||||
// Fill in base attributes
|
||||
bld.setBaseState(basebs).setStateIndex(idx - baseidx).setBlockName(bn).setStateName(statename).setMaterial(mat.toString()).setLegacyBlockID(idx).setAttenuatesLight(lightAtten);
|
||||
if (mat.isSolid()) { bld.setSolid(); }
|
||||
if (mat == Material.AIR) { bld.setAir(); }
|
||||
if (mat == Material.WOOD) { bld.setLog(); }
|
||||
if (mat == Material.LEAVES) { bld.setLeaves(); }
|
||||
if ((!bs.getFluidState().isEmpty()) && !(bs.getBlock() instanceof LiquidBlock)) {
|
||||
bld.setWaterlogged();
|
||||
}
|
||||
DynmapBlockState dbs = bld.build(); // Build state
|
||||
stateByID[idx] = dbs;
|
||||
if (basebs == null) { basebs = dbs; }
|
||||
if (mat.isSolid()) {
|
||||
dbs.setSolid();
|
||||
}
|
||||
if (mat == Material.AIR) {
|
||||
dbs.setAir();
|
||||
}
|
||||
if (mat == Material.WOOD) {
|
||||
dbs.setLog();
|
||||
}
|
||||
if (mat == Material.LEAVES) {
|
||||
dbs.setLeaves();
|
||||
}
|
||||
if ((!bs.getFluidState().isEmpty()) && !(bs.getBlock() instanceof LiquidBlock)) {
|
||||
dbs.setWaterlogged();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (int gidx = 0; gidx < DynmapBlockState.getGlobalIndexMax(); gidx++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue