Search in sources :

Example 6 with LevelChunkSection

use of net.minecraft.world.level.chunk.LevelChunkSection in project SpongeCommon by SpongePowered.

the class UpdateChunkLightManagerEffect method processSideEffect.

@Override
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState, final SpongeBlockChangeFlag flag, final int limit) {
    final LevelChunkSection chunkSection = pipeline.getAffectedSection();
    final boolean wasEmpty = pipeline.wasEmpty();
    final boolean isStillEmpty = chunkSection.isEmpty();
    if (wasEmpty != isStillEmpty) {
        pipeline.getServerWorld().getChunkSource().getLightEngine().updateSectionStatus(oldState.pos, isStillEmpty);
    }
    return EffectResult.NULL_PASS;
}
Also used : LevelChunkSection(net.minecraft.world.level.chunk.LevelChunkSection)

Example 7 with LevelChunkSection

use of net.minecraft.world.level.chunk.LevelChunkSection in project SpongeCommon by SpongePowered.

the class SetBlockToChunkSectionEffect method processSideEffect.

@Override
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState, final SpongeBlockChangeFlag flag, final int limit) {
    final LevelChunkSection chunkSection = pipeline.getAffectedSection();
    final int x = oldState.pos.getX() & 15;
    final int y = oldState.pos.getY() & 15;
    final int z = oldState.pos.getZ() & 15;
    final BlockState oldStateReturned = chunkSection.setBlockState(x, y, z, newState);
    if (oldStateReturned == newState) {
        return EffectResult.NULL_RETURN;
    }
    return EffectResult.NULL_PASS;
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) LevelChunkSection(net.minecraft.world.level.chunk.LevelChunkSection)

Aggregations

LevelChunkSection (net.minecraft.world.level.chunk.LevelChunkSection)7 WeakReference (java.lang.ref.WeakReference)3 BlockState (net.minecraft.world.level.block.state.BlockState)3 LevelChunk (net.minecraft.world.level.chunk.LevelChunk)3 ServerLevel (net.minecraft.server.level.ServerLevel)2 ChunkPos (net.minecraft.world.level.ChunkPos)2 Biome (net.minecraft.world.level.biome.Biome)2 MonotonicNonNull (org.checkerframework.checker.nullness.qual.MonotonicNonNull)2 NonNull (org.checkerframework.checker.nullness.qual.NonNull)2 Nullable (org.checkerframework.checker.nullness.qual.Nullable)2 BiomeNMSImpl (com.denizenscript.denizen.nms.v1_18.impl.BiomeNMSImpl)1 AbstractMap (java.util.AbstractMap)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Set (java.util.Set)1 UUID (java.util.UUID)1