attempt to make the game no crash when resetting chunks. Lighting gonna get fixed later I presume
This commit is contained in:
1 parent
334f1060a5
commit
9cae675ede
3 files changed
+17
-26
No files matched your search
@@ -26,7 +26,7 @@ public abstract class BlockLightSectionStorage_scarpetChunkCreationMixin extends
|
|||||||
@Override
|
@Override
|
||||||
public void processRelight(final LightEngine<?, ?> lightProvider, final long cPos)
|
public void processRelight(final LightEngine<?, ?> lightProvider, final long cPos)
|
||||||
{
|
{
|
||||||
final DynamicGraphMinFixedPoint_resetChunkInterface levelPropagator = (DynamicGraphMinFixedPoint_resetChunkInterface) lightProvider;
|
//final DynamicGraphMinFixedPoint_resetChunkInterface levelPropagator = (DynamicGraphMinFixedPoint_resetChunkInterface) lightProvider.;
|
||||||
|
|
||||||
for (int y = -1; y < 17; ++y)
|
for (int y = -1; y < 17; ++y)
|
||||||
{
|
{
|
||||||
@@ -53,11 +53,12 @@ public abstract class BlockLightSectionStorage_scarpetChunkCreationMixin extends
|
|||||||
for (int dy = 0; dy < 16; ++dy)
|
for (int dy = 0; dy < 16; ++dy)
|
||||||
{
|
{
|
||||||
final long dst = BlockPos.offset(pos, ox + t * dx, dy, oz + t * dz);
|
final long dst = BlockPos.offset(pos, ox + t * dx, dy, oz + t * dz);
|
||||||
final long src = BlockPos.offset(dst, dir);
|
lightProvider.checkBlock(BlockPos.of(dst));
|
||||||
|
//final long src = BlockPos.offset(dst, dir);
|
||||||
|
|
||||||
final int srcLevel = ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborLightArray, src);
|
//final int srcLevel = ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborLightArray, src);
|
||||||
|
|
||||||
levelPropagator.cmInvokeUpdateLevel(src, dst, levelPropagator.cmCallGetPropagatedLevel(src, dst, srcLevel), true);
|
//levelPropagator.cmInvokeUpdateLevel(src, dst, levelPropagator.cmCallGetPropagatedLevel(src, dst, srcLevel), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public abstract class SkyLightSectionStorage_scarpetChunkCreationMixin extends L
|
|||||||
@Override
|
@Override
|
||||||
public void processRelight(final LightEngine<?, ?> lightProvider, final long cPos)
|
public void processRelight(final LightEngine<?, ?> lightProvider, final long cPos)
|
||||||
{
|
{
|
||||||
final DynamicGraphMinFixedPoint_resetChunkInterface levelPropagator = (DynamicGraphMinFixedPoint_resetChunkInterface) lightProvider;
|
//final DynamicGraphMinFixedPoint_resetChunkInterface levelPropagator = (DynamicGraphMinFixedPoint_resetChunkInterface) lightProvider;
|
||||||
|
|
||||||
for (int y = -1; y < 17; ++y)
|
for (int y = -1; y < 17; ++y)
|
||||||
{
|
{
|
||||||
@@ -102,17 +102,18 @@ public abstract class SkyLightSectionStorage_scarpetChunkCreationMixin extends L
|
|||||||
for (int dy = 0; dy < 16; ++dy)
|
for (int dy = 0; dy < 16; ++dy)
|
||||||
{
|
{
|
||||||
final long dst = BlockPos.offset(pos, ox + t * dx, dy, oz + t * dz);
|
final long dst = BlockPos.offset(pos, ox + t * dx, dy, oz + t * dz);
|
||||||
long src = BlockPos.offset(dst, dir);
|
//long src = BlockPos.offset(dst, dir);
|
||||||
|
|
||||||
long adj_src = (neighborLightArray != null)
|
//long adj_src = (neighborLightArray != null)
|
||||||
? src
|
// ? src
|
||||||
: BlockPos.asLong(BlockPos.getX(src), neighbourY, BlockPos.getZ(src));
|
// : BlockPos.asLong(BlockPos.getX(src), neighbourY, BlockPos.getZ(src));
|
||||||
|
|
||||||
final int srcLevel = neighborCeilingLightArray != null
|
//final int srcLevel = neighborCeilingLightArray != null
|
||||||
? ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborCeilingLightArray, adj_src)
|
// ? ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborCeilingLightArray, adj_src)
|
||||||
: emptyLightLevel;
|
// : emptyLightLevel;
|
||||||
|
|
||||||
levelPropagator.cmInvokeUpdateLevel(src, dst, levelPropagator.cmCallGetPropagatedLevel(src, dst, srcLevel), true);
|
lightProvider.checkBlock(BlockPos.of(dst));
|
||||||
|
//levelPropagator.cmInvokeUpdateLevel(src, dst, levelPropagator.cmCallGetPropagatedLevel(src, dst, srcLevel), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-13
@@ -35,8 +35,6 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
|
|||||||
@Final
|
@Final
|
||||||
private ChunkMap chunkMap;
|
private ChunkMap chunkMap;
|
||||||
|
|
||||||
//@Shadow public abstract void propagateLightSources(final ChunkPos chunkPos);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Invoker("updateChunkStatus")
|
@Invoker("updateChunkStatus")
|
||||||
public abstract void invokeUpdateChunkStatus(ChunkPos pos);
|
public abstract void invokeUpdateChunkStatus(ChunkPos pos);
|
||||||
@@ -61,22 +59,13 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
|
|||||||
final ChunkPos pos = chunk.getPos();
|
final ChunkPos pos = chunk.getPos();
|
||||||
|
|
||||||
propagateLightSources(pos);
|
propagateLightSources(pos);
|
||||||
/*this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||||
super.setLightEnabled(pos, true);
|
|
||||||
|
|
||||||
chunk.findBlockLightSources((lightPos, state) -> {
|
|
||||||
final int lightEmission = state.getLightEmission();
|
|
||||||
enqueueIncrease(lightPos.asLong(), LightEngine.QueueEntry.increaseLightFromEmission(lightEmission, isEmptyShape(state)));
|
|
||||||
});
|
|
||||||
|
|
||||||
chunk.getLights().forEach(
|
|
||||||
blockPos -> super.onBlockEmissionIncrease(blockPos, chunk.getLightEmission(blockPos))
|
|
||||||
);
|
|
||||||
|
|
||||||
((Lighting_scarpetChunkCreationInterface) this).relight(SectionPos.getZeroNode(SectionPos.asLong(pos.x, 0, pos.z)));
|
((Lighting_scarpetChunkCreationInterface) this).relight(SectionPos.getZeroNode(SectionPos.asLong(pos.x, 0, pos.z)));
|
||||||
},
|
},
|
||||||
() -> "Relight chunk " + pos
|
() -> "Relight chunk " + pos
|
||||||
));*/
|
));
|
||||||
|
|
||||||
return CompletableFuture.runAsync(
|
return CompletableFuture.runAsync(
|
||||||
Util.name(() -> {
|
Util.name(() -> {
|
||||||
|
|||||||
Reference in new issue
Block a user