Search in sources :

Example 1 with ScheduledBlockUpdate

use of org.spongepowered.api.block.ScheduledBlockUpdate in project SpongeCommon by SpongePowered.

the class MixinWorldServer method addScheduledUpdate.

@Override
public ScheduledBlockUpdate addScheduledUpdate(int x, int y, int z, int priority, int ticks) {
    BlockPos pos = new BlockPos(x, y, z);
    this.updateBlockTick(pos, getBlockState(pos).getBlock(), ticks, priority);
    ScheduledBlockUpdate sbu = (ScheduledBlockUpdate) this.tmpScheduledObj;
    this.tmpScheduledObj = null;
    return sbu;
}
Also used : ScheduledBlockUpdate(org.spongepowered.api.block.ScheduledBlockUpdate) BlockPos(net.minecraft.util.math.BlockPos) IMixinBlockPos(org.spongepowered.common.interfaces.util.math.IMixinBlockPos)

Example 2 with ScheduledBlockUpdate

use of org.spongepowered.api.block.ScheduledBlockUpdate in project SpongeCommon by SpongePowered.

the class MixinWorldServer method getScheduledUpdates.

@Override
public Collection<ScheduledBlockUpdate> getScheduledUpdates(int x, int y, int z) {
    BlockPos position = new BlockPos(x, y, z);
    ImmutableList.Builder<ScheduledBlockUpdate> builder = ImmutableList.builder();
    for (NextTickListEntry sbu : this.pendingTickListEntriesTreeSet) {
        if (sbu.position.equals(position)) {
            builder.add((ScheduledBlockUpdate) sbu);
        }
    }
    return builder.build();
}
Also used : NextTickListEntry(net.minecraft.world.NextTickListEntry) IMixinNextTickListEntry(org.spongepowered.common.interfaces.IMixinNextTickListEntry) ImmutableList(com.google.common.collect.ImmutableList) ScheduledBlockUpdate(org.spongepowered.api.block.ScheduledBlockUpdate) BlockPos(net.minecraft.util.math.BlockPos) IMixinBlockPos(org.spongepowered.common.interfaces.util.math.IMixinBlockPos)

Example 3 with ScheduledBlockUpdate

use of org.spongepowered.api.block.ScheduledBlockUpdate in project LanternServer by LanternPowered.

the class LanternChunk method getScheduledUpdates.

@Override
public Collection<ScheduledBlockUpdate> getScheduledUpdates(int x, int y, int z) {
    checkVolumeBounds(x, y, z);
    if (!this.loaded) {
        return Collections.emptyList();
    }
    final Vector3i position = new Vector3i(x, y, z);
    return this.scheduledBlockUpdateQueue.stream().filter(update -> update.getLocation().getBlockPosition().equals(position)).collect(ImmutableSet.toImmutableSet());
}
Also used : Arrays(java.util.Arrays) LanternEntity(org.lanternpowered.server.entity.LanternEntity) BiomeTypes(org.spongepowered.api.world.biome.BiomeTypes) PropertyStore(org.spongepowered.api.data.property.PropertyStore) ItemStack(org.spongepowered.api.item.inventory.ItemStack) MutableBiomeVolumeWorker(org.spongepowered.api.world.extent.worker.MutableBiomeVolumeWorker) BlockRegistryModule(org.lanternpowered.server.game.registry.type.block.BlockRegistryModule) GameProfile(org.spongepowered.api.profile.GameProfile) VecHelper(org.lanternpowered.server.util.VecHelper) Location(org.spongepowered.api.world.Location) AbstractPropertyHolder(org.lanternpowered.server.data.property.AbstractPropertyHolder) NibbleArray(org.lanternpowered.server.util.collect.array.NibbleArray) Extent(org.spongepowered.api.world.extent.Extent) BlockTypes(org.spongepowered.api.block.BlockTypes) ArchetypeVolume(org.spongepowered.api.world.extent.ArchetypeVolume) DataContainer(org.spongepowered.api.data.DataContainer) Set(java.util.Set) BlockAction(org.lanternpowered.server.block.action.BlockAction) BlockState(org.spongepowered.api.block.BlockState) Direction(org.spongepowered.api.util.Direction) AbstractExtent(org.lanternpowered.server.world.extent.AbstractExtent) World(org.spongepowered.api.world.World) AbstractDirectionRelativePropertyHolder(org.lanternpowered.server.data.property.AbstractDirectionRelativePropertyHolder) LanternTileEntity(org.lanternpowered.server.block.tile.LanternTileEntity) ImmutableValue(org.spongepowered.api.data.value.immutable.ImmutableValue) Vector3d(com.flowpowered.math.vector.Vector3d) LanternScheduledBlockUpdate(org.lanternpowered.server.block.LanternScheduledBlockUpdate) AABB(org.spongepowered.api.util.AABB) Collections3(org.lanternpowered.server.util.collect.Collections3) Key(org.spongepowered.api.data.key.Key) Vector2i(com.flowpowered.math.vector.Vector2i) CauseStack(org.lanternpowered.server.event.CauseStack) ExtentViewDownsize(org.lanternpowered.server.world.extent.ExtentViewDownsize) LanternWorld(org.lanternpowered.server.world.LanternWorld) CHUNK_BIOME_VOLUME(org.lanternpowered.server.world.chunk.LanternChunkLayout.CHUNK_BIOME_VOLUME) ObjectIterator(it.unimi.dsi.fastutil.objects.ObjectIterator) Nullable(javax.annotation.Nullable) TrackerIdAllocator(org.lanternpowered.server.world.TrackerIdAllocator) LanternBlockSnapshot(org.lanternpowered.server.block.LanternBlockSnapshot) InvalidDataException(org.spongepowered.api.data.persistence.InvalidDataException) DataHolder(org.spongepowered.api.data.DataHolder) Entity(org.spongepowered.api.entity.Entity) CachedSimpleObjectProvider(org.lanternpowered.server.block.provider.CachedSimpleObjectProvider) LanternMutableBlockVolumeWorker(org.lanternpowered.server.world.extent.worker.LanternMutableBlockVolumeWorker) Short2ObjectMap(it.unimi.dsi.fastutil.shorts.Short2ObjectMap) DataView(org.spongepowered.api.data.DataView) ITileEntityRefreshBehavior(org.lanternpowered.server.block.tile.ITileEntityRefreshBehavior) Vector3i(com.flowpowered.math.vector.Vector3i) StampedLock(java.util.concurrent.locks.StampedLock) LanternBlockType(org.lanternpowered.server.block.LanternBlockType) EntitySnapshot(org.spongepowered.api.entity.EntitySnapshot) PriorityBlockingQueue(java.util.concurrent.PriorityBlockingQueue) Short2ShortOpenHashMap(it.unimi.dsi.fastutil.shorts.Short2ShortOpenHashMap) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) TileEntity(org.spongepowered.api.block.tileentity.TileEntity) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) MergeFunction(org.spongepowered.api.data.merge.MergeFunction) BiomeRegistryModule(org.lanternpowered.server.game.registry.type.world.biome.BiomeRegistryModule) MutableBlockVolumeWorker(org.spongepowered.api.world.extent.worker.MutableBlockVolumeWorker) ImmutableSet(com.google.common.collect.ImmutableSet) Short2ObjectOpenHashMap(it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap) PositionOutOfBoundsException(org.spongepowered.api.util.PositionOutOfBoundsException) ImmutableMap(com.google.common.collect.ImmutableMap) Predicate(java.util.function.Predicate) Collection(java.util.Collection) UUID(java.util.UUID) Sets(com.google.common.collect.Sets) LanternEntityType(org.lanternpowered.server.entity.LanternEntityType) CHUNK_MASK(org.lanternpowered.server.world.chunk.LanternChunkLayout.CHUNK_MASK) SimpleObjectProvider(org.lanternpowered.server.block.provider.SimpleObjectProvider) Lantern(org.lanternpowered.server.game.Lantern) BlockType(org.spongepowered.api.block.BlockType) DataManipulator(org.spongepowered.api.data.manipulator.DataManipulator) Optional(java.util.Optional) Short2ShortMap(it.unimi.dsi.fastutil.shorts.Short2ShortMap) ScheduledBlockUpdate(org.spongepowered.api.block.ScheduledBlockUpdate) BlockSnapshot(org.spongepowered.api.block.BlockSnapshot) CHUNK_SIZE(org.lanternpowered.server.world.chunk.LanternChunkLayout.CHUNK_SIZE) BiomeType(org.spongepowered.api.world.biome.BiomeType) DataTransactionResult(org.spongepowered.api.data.DataTransactionResult) Function(java.util.function.Function) BlockChangeFlag(org.spongepowered.api.world.BlockChangeFlag) ImmutableList(com.google.common.collect.ImmutableList) ObjectProvider(org.lanternpowered.server.block.provider.ObjectProvider) ConstantObjectProvider(org.lanternpowered.server.block.provider.ConstantObjectProvider) Iterator(java.util.Iterator) ReentrantLock(java.util.concurrent.locks.ReentrantLock) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) BaseValue(org.spongepowered.api.data.value.BaseValue) Chunk(org.spongepowered.api.world.Chunk) Consumer(java.util.function.Consumer) LanternMutableBiomeVolumeWorker(org.lanternpowered.server.world.extent.worker.LanternMutableBiomeVolumeWorker) Condition(java.util.concurrent.locks.Condition) BlockChangeFlags(org.spongepowered.api.world.BlockChangeFlags) Property(org.spongepowered.api.data.Property) TileEntityProvider(org.lanternpowered.server.block.TileEntityProvider) EntityType(org.spongepowered.api.entity.EntityType) BitSet(java.util.BitSet) Collections(java.util.Collections) Vector3i(com.flowpowered.math.vector.Vector3i)

Aggregations

ScheduledBlockUpdate (org.spongepowered.api.block.ScheduledBlockUpdate)3 ImmutableList (com.google.common.collect.ImmutableList)2 BlockPos (net.minecraft.util.math.BlockPos)2 IMixinBlockPos (org.spongepowered.common.interfaces.util.math.IMixinBlockPos)2 Vector2i (com.flowpowered.math.vector.Vector2i)1 Vector3d (com.flowpowered.math.vector.Vector3d)1 Vector3i (com.flowpowered.math.vector.Vector3i)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 ObjectIterator (it.unimi.dsi.fastutil.objects.ObjectIterator)1 Short2ObjectMap (it.unimi.dsi.fastutil.shorts.Short2ObjectMap)1 Short2ObjectOpenHashMap (it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap)1 Short2ShortMap (it.unimi.dsi.fastutil.shorts.Short2ShortMap)1 Short2ShortOpenHashMap (it.unimi.dsi.fastutil.shorts.Short2ShortOpenHashMap)1 Arrays (java.util.Arrays)1 BitSet (java.util.BitSet)1 Collection (java.util.Collection)1