trying to readd all lights
This commit is contained in:
1 parent
d9aa6f15ad
commit
b9f2e68ddb
3 files changed
+22
-6
No files matched your search
@@ -1,10 +1,11 @@
|
|||||||
package carpet.fakes;
|
package carpet.fakes;
|
||||||
|
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
public interface ServerLightingProviderInterface
|
public interface ServerLightingProviderInterface
|
||||||
{
|
{
|
||||||
void publicUpdateChunkStatus(ChunkPos pos);
|
void publicUpdateChunkStatus(ChunkPos pos);
|
||||||
void flush();
|
void flush();
|
||||||
void resetLight(ChunkPos pos);
|
void resetLight(Chunk chunk, ChunkPos pos);
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,9 @@ import net.minecraft.server.world.ServerLightingProvider;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.util.math.ChunkSectionPos;
|
import net.minecraft.util.math.ChunkSectionPos;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.LightType;
|
import net.minecraft.world.LightType;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.ChunkNibbleArray;
|
import net.minecraft.world.chunk.ChunkNibbleArray;
|
||||||
import net.minecraft.world.chunk.ChunkProvider;
|
import net.minecraft.world.chunk.ChunkProvider;
|
||||||
import net.minecraft.world.chunk.light.LightingProvider;
|
import net.minecraft.world.chunk.light.LightingProvider;
|
||||||
@@ -28,14 +30,14 @@ public abstract class ServerLightingProvider_scarpetMixin extends LightingProvid
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resetLight(ChunkPos chpos)
|
public void resetLight(Chunk chunk, ChunkPos pos)
|
||||||
{
|
{
|
||||||
//super.setRetainData(pos, false);
|
//super.setRetainData(pos, false);
|
||||||
//super.setLightEnabled(pos, false);
|
//super.setLightEnabled(pos, false);
|
||||||
for (int x = chpos.x-1; x <= chpos.x+1; x++ )
|
//for (int x = chpos.x-1; x <= chpos.x+1; x++ )
|
||||||
for (int z = chpos.z-1; z <= chpos.z+1; z++ )
|
// for (int z = chpos.z-1; z <= chpos.z+1; z++ )
|
||||||
{
|
{
|
||||||
ChunkPos pos = new ChunkPos(x, z);
|
//ChunkPos pos = new ChunkPos(x, z);
|
||||||
int j;
|
int j;
|
||||||
for(j = -1; j < 17; ++j) {
|
for(j = -1; j < 17; ++j) {
|
||||||
super.queueData(LightType.BLOCK, ChunkSectionPos.from(pos, j), new ChunkNibbleArray());
|
super.queueData(LightType.BLOCK, ChunkSectionPos.from(pos, j), new ChunkNibbleArray());
|
||||||
@@ -44,6 +46,17 @@ public abstract class ServerLightingProvider_scarpetMixin extends LightingProvid
|
|||||||
for(j = 0; j < 16; ++j) {
|
for(j = 0; j < 16; ++j) {
|
||||||
super.updateSectionStatus(ChunkSectionPos.from(pos, j), true);
|
super.updateSectionStatus(ChunkSectionPos.from(pos, j), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.setLightEnabled(pos, true);
|
||||||
|
|
||||||
|
chunk.getLightSourcesStream().forEach((blockPos) -> {
|
||||||
|
super.addLightSource(blockPos, chunk.getLuminance(blockPos));
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2955,7 +2955,9 @@ public class CarpetExpression
|
|||||||
BlockArgument locator = BlockArgument.findIn(cc, lv, 0);
|
BlockArgument locator = BlockArgument.findIn(cc, lv, 0);
|
||||||
BlockPos pos = locator.block.getPos();
|
BlockPos pos = locator.block.getPos();
|
||||||
ServerWorld world = cc.s.getWorld();
|
ServerWorld world = cc.s.getWorld();
|
||||||
((ServerLightingProviderInterface)world.getChunkManager().getLightingProvider()).resetLight(new ChunkPos(pos)); //light(world.getChunk(pos), false);
|
((ServerLightingProviderInterface)world.getChunkManager().getLightingProvider()).resetLight(world.getChunk(pos), new ChunkPos(pos)); //light(world.getChunk(pos), false);
|
||||||
|
forceChunkUpdate(pos, world);
|
||||||
|
world.getChunkManager().getLightingProvider().light(world.getChunk(pos), false);
|
||||||
return LazyValue.TRUE;
|
return LazyValue.TRUE;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user