Search in sources :

Example 1 with BlockGetter

use of net.minecraft.world.level.BlockGetter in project MysticTools by binary404.

the class BlockHelper method doNativeBreakBlock.

private static boolean doNativeBreakBlock(ServerLevel world, ServerPlayer player, BlockPos pos, BlockState stateBroken, ItemStack heldItem, boolean breakBlock, boolean ignoreHarvestRestrictions) {
    int xp;
    try {
        boolean preCancelEvent = false;
        if (!heldItem.isEmpty() && !heldItem.getItem().canAttackBlock(stateBroken, (Level) world, pos, (Player) player)) {
            preCancelEvent = true;
        }
        BlockEvent.BreakEvent event = new BlockEvent.BreakEvent((Level) world, pos, stateBroken, (Player) player);
        event.setCanceled(preCancelEvent);
        MinecraftForge.EVENT_BUS.post((Event) event);
        if (event.isCanceled()) {
            return false;
        }
        xp = event.getExpToDrop();
    } catch (Exception exc) {
        return false;
    }
    if (xp == -1) {
        return false;
    }
    if (heldItem.onBlockStartBreak(pos, (Player) player)) {
        return false;
    }
    boolean harvestable = true;
    try {
        if (!ignoreHarvestRestrictions) {
            harvestable = stateBroken.canHarvestBlock((BlockGetter) world, pos, (Player) player);
        }
    } catch (Exception exc) {
        return false;
    }
    try {
        heldItem.copy().mineBlock((Level) world, stateBroken, pos, (Player) player);
    } catch (Exception exc) {
        return false;
    }
    boolean wasCapturingStates = world.captureBlockSnapshots;
    List<BlockSnapshot> previousCapturedStates = new ArrayList<>(world.capturedBlockSnapshots);
    BlockEntity tileEntity = world.getBlockEntity(pos);
    world.captureBlockSnapshots = true;
    try {
        if (breakBlock) {
            if (!stateBroken.onDestroyedByPlayer((Level) world, pos, (Player) player, harvestable, Fluids.EMPTY.defaultFluidState())) {
                restoreWorldState((Level) world, wasCapturingStates, previousCapturedStates);
                return false;
            }
        } else {
            stateBroken.getBlock().playerWillDestroy((Level) world, pos, stateBroken, (Player) player);
        }
    } catch (Exception exc) {
        restoreWorldState((Level) world, wasCapturingStates, previousCapturedStates);
        return false;
    }
    stateBroken.getBlock().destroy((LevelAccessor) world, pos, stateBroken);
    if (harvestable) {
        try {
            stateBroken.getBlock().playerDestroy((Level) world, (Player) player, pos, stateBroken, tileEntity, heldItem.copy());
        } catch (Exception exc) {
            restoreWorldState((Level) world, wasCapturingStates, previousCapturedStates);
            return false;
        }
    }
    if (xp > 0) {
        stateBroken.getBlock().popExperience(world, pos, xp);
    }
    BlockDropCaptureHelper.startCapturing();
    try {
        world.captureBlockSnapshots = false;
        world.restoringBlockSnapshots = true;
        world.capturedBlockSnapshots.forEach(s -> {
            world.sendBlockUpdated(s.getPos(), s.getReplacedBlock(), s.getCurrentBlock(), s.getFlag());
            s.getCurrentBlock().updateNeighbourShapes((LevelAccessor) world, s.getPos(), 11);
        });
        world.restoringBlockSnapshots = false;
    } finally {
        BlockDropCaptureHelper.getCapturedStacksAndStop();
        world.capturedBlockSnapshots.clear();
        world.captureBlockSnapshots = wasCapturingStates;
        world.capturedBlockSnapshots.addAll(previousCapturedStates);
    }
    return true;
}
Also used : BlockGetter(net.minecraft.world.level.BlockGetter) Player(net.minecraft.world.entity.player.Player) ServerPlayer(net.minecraft.server.level.ServerPlayer) BlockSnapshot(net.minecraftforge.common.util.BlockSnapshot) ArrayList(java.util.ArrayList) ServerLevel(net.minecraft.server.level.ServerLevel) Level(net.minecraft.world.level.Level) BlockEvent(net.minecraftforge.event.world.BlockEvent) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Example 2 with BlockGetter

use of net.minecraft.world.level.BlockGetter in project Carpet-TCTC-Addition by The-Cat-Town-Craft.

the class FixCommand method fixChunk.

private static int fixChunk(CommandSourceStack source, ColumnPos pos) throws CommandSyntaxException {
    ServerLevel level = source.getLevel();
    ChunkPos chunkPos = new ChunkPos(pos.x >> 4, pos.z >> 4);
    BlockGetter blockGetter = level.getChunkForCollisions(chunkPos.x, chunkPos.z);
    if (!(blockGetter instanceof LevelChunk)) {
        throw BlockPosArgument.ERROR_NOT_LOADED.create();
    }
    LevelChunk levelChunk = (LevelChunk) blockGetter;
    Heightmap.primeHeightmaps(levelChunk, EnumSet.allOf(Heightmap.Types.class));
    MessageUtil.sendMessage(source, new TextComponent(String.format(tr("carpet-tctc-addition.message.command.fix.fixing", "Fixing chunk [%s, %s]..."), chunkPos.x, chunkPos.z)).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC));
    ((ThreadedLevelLightEngine) level.getLightEngine()).lightChunk(levelChunk, false).thenRun(() -> MessageUtil.sendMessage(source, new TextComponent(String.format(tr("carpet-tctc-addition.message.command.fix.fixed", "Fixed chunk [%s, %s]"), chunkPos.x, chunkPos.z)).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC)));
    return 1;
}
Also used : TextComponent(net.minecraft.network.chat.TextComponent) ServerLevel(net.minecraft.server.level.ServerLevel) BlockGetter(net.minecraft.world.level.BlockGetter) LevelChunk(net.minecraft.world.level.chunk.LevelChunk) ChunkPos(net.minecraft.world.level.ChunkPos)

Example 3 with BlockGetter

use of net.minecraft.world.level.BlockGetter in project Starlight by PaperMC.

the class StarLightEngine method performLightDecrease.

protected final void performLightDecrease(final LightChunkGetter lightAccess) {
    final BlockGetter world = lightAccess.getLevel();
    long[] queue = this.decreaseQueue;
    long[] increaseQueue = this.increaseQueue;
    int queueReadIndex = 0;
    int queueLength = this.decreaseQueueInitialLength;
    this.decreaseQueueInitialLength = 0;
    int increaseQueueLength = this.increaseQueueInitialLength;
    final int decodeOffsetX = -this.encodeOffsetX;
    final int decodeOffsetY = -this.encodeOffsetY;
    final int decodeOffsetZ = -this.encodeOffsetZ;
    final int encodeOffset = this.coordinateOffset;
    final int sectionOffset = this.chunkSectionIndexOffset;
    final int emittedMask = this.emittedLightMask;
    while (queueReadIndex < queueLength) {
        final long queueValue = queue[queueReadIndex++];
        final int posX = ((int) queueValue & 63) + decodeOffsetX;
        final int posZ = (((int) queueValue >>> 6) & 63) + decodeOffsetZ;
        final int posY = (((int) queueValue >>> 12) & ((1 << 16) - 1)) + decodeOffsetY;
        final int propagatedLightLevel = (int) ((queueValue >>> (6 + 6 + 16)) & 0xF);
        final AxisDirection[] checkDirections = OLD_CHECK_DIRECTIONS[(int) ((queueValue >>> (6 + 6 + 16 + 4)) & 63)];
        if ((queueValue & FLAG_HAS_SIDED_TRANSPARENT_BLOCKS) == 0L) {
            // we don't need to worry about our state here.
            for (final AxisDirection propagate : checkDirections) {
                final int offX = posX + propagate.x;
                final int offY = posY + propagate.y;
                final int offZ = posZ + propagate.z;
                final int sectionIndex = (offX >> 4) + 5 * (offZ >> 4) + (5 * 5) * (offY >> 4) + sectionOffset;
                final int localIndex = (offX & 15) | ((offZ & 15) << 4) | ((offY & 15) << 8);
                final SWMRNibbleArray currentNibble = this.nibbleCache[sectionIndex];
                final int lightLevel;
                if (currentNibble == null || (lightLevel = currentNibble.getUpdating(localIndex)) == 0) {
                    // already at lowest (or unloaded), nothing we can do
                    continue;
                }
                final BlockState blockState = this.getBlockState(sectionIndex, localIndex);
                if (blockState == null) {
                    continue;
                }
                final int opacityCached = ((ExtendedAbstractBlockState) blockState).getOpacityIfCached();
                if (opacityCached != -1) {
                    final int targetLevel = Math.max(0, propagatedLightLevel - Math.max(1, opacityCached));
                    if (lightLevel > targetLevel) {
                        // it looks like another source propagated here, so re-propagate it
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((lightLevel & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | FLAG_RECHECK_LEVEL;
                        continue;
                    }
                    final int emittedLight = blockState.getLightEmission() & emittedMask;
                    if (emittedLight != 0) {
                        // note: do not set recheck level, or else the propagation will fail
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((emittedLight & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | (((ExtendedAbstractBlockState) blockState).isConditionallyFullOpaque() ? (FLAG_WRITE_LEVEL | FLAG_HAS_SIDED_TRANSPARENT_BLOCKS) : FLAG_WRITE_LEVEL);
                    }
                    currentNibble.set(localIndex, 0);
                    this.postLightUpdate(offX, offY, offZ);
                    if (targetLevel > 0) {
                        // we actually need to propagate 0 just in case we find a neighbour...
                        if (queueLength >= queue.length) {
                            queue = this.resizeDecreaseQueue();
                        }
                        queue[queueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((targetLevel & 0xFL) << (6 + 6 + 16)) | ((propagate.everythingButTheOppositeDirection) << (6 + 6 + 16 + 4));
                        continue;
                    }
                    continue;
                } else {
                    this.mutablePos1.set(offX, offY, offZ);
                    long flags = 0;
                    if (((ExtendedAbstractBlockState) blockState).isConditionallyFullOpaque()) {
                        final VoxelShape cullingFace = blockState.getFaceOcclusionShape(world, this.mutablePos1, propagate.getOpposite().nms);
                        if (Shapes.faceShapeOccludes(Shapes.empty(), cullingFace)) {
                            continue;
                        }
                        flags |= FLAG_HAS_SIDED_TRANSPARENT_BLOCKS;
                    }
                    final int opacity = blockState.getLightBlock(world, this.mutablePos1);
                    final int targetLevel = Math.max(0, propagatedLightLevel - Math.max(1, opacity));
                    if (lightLevel > targetLevel) {
                        // it looks like another source propagated here, so re-propagate it
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((lightLevel & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | (FLAG_RECHECK_LEVEL | flags);
                        continue;
                    }
                    final int emittedLight = blockState.getLightEmission() & emittedMask;
                    if (emittedLight != 0) {
                        // note: do not set recheck level, or else the propagation will fail
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((emittedLight & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | (flags | FLAG_WRITE_LEVEL);
                    }
                    currentNibble.set(localIndex, 0);
                    this.postLightUpdate(offX, offY, offZ);
                    if (targetLevel > 0) {
                        if (queueLength >= queue.length) {
                            queue = this.resizeDecreaseQueue();
                        }
                        queue[queueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((targetLevel & 0xFL) << (6 + 6 + 16)) | ((propagate.everythingButTheOppositeDirection) << (6 + 6 + 16 + 4)) | flags;
                    }
                    continue;
                }
            }
        } else {
            // we actually need to worry about our state here
            final BlockState fromBlock = this.getBlockState(posX, posY, posZ);
            this.mutablePos2.set(posX, posY, posZ);
            for (final AxisDirection propagate : checkDirections) {
                final int offX = posX + propagate.x;
                final int offY = posY + propagate.y;
                final int offZ = posZ + propagate.z;
                final int sectionIndex = (offX >> 4) + 5 * (offZ >> 4) + (5 * 5) * (offY >> 4) + sectionOffset;
                final int localIndex = (offX & 15) | ((offZ & 15) << 4) | ((offY & 15) << 8);
                final VoxelShape fromShape = (((ExtendedAbstractBlockState) fromBlock).isConditionallyFullOpaque()) ? fromBlock.getFaceOcclusionShape(world, this.mutablePos2, propagate.nms) : Shapes.empty();
                if (fromShape != Shapes.empty() && Shapes.faceShapeOccludes(Shapes.empty(), fromShape)) {
                    continue;
                }
                final SWMRNibbleArray currentNibble = this.nibbleCache[sectionIndex];
                final int lightLevel;
                if (currentNibble == null || (lightLevel = currentNibble.getUpdating(localIndex)) == 0) {
                    // already at lowest (or unloaded), nothing we can do
                    continue;
                }
                final BlockState blockState = this.getBlockState(sectionIndex, localIndex);
                if (blockState == null) {
                    continue;
                }
                final int opacityCached = ((ExtendedAbstractBlockState) blockState).getOpacityIfCached();
                if (opacityCached != -1) {
                    final int targetLevel = Math.max(0, propagatedLightLevel - Math.max(1, opacityCached));
                    if (lightLevel > targetLevel) {
                        // it looks like another source propagated here, so re-propagate it
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((lightLevel & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | FLAG_RECHECK_LEVEL;
                        continue;
                    }
                    final int emittedLight = blockState.getLightEmission() & emittedMask;
                    if (emittedLight != 0) {
                        // note: do not set recheck level, or else the propagation will fail
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((emittedLight & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | (((ExtendedAbstractBlockState) blockState).isConditionallyFullOpaque() ? (FLAG_WRITE_LEVEL | FLAG_HAS_SIDED_TRANSPARENT_BLOCKS) : FLAG_WRITE_LEVEL);
                    }
                    currentNibble.set(localIndex, 0);
                    this.postLightUpdate(offX, offY, offZ);
                    if (targetLevel > 0) {
                        // we actually need to propagate 0 just in case we find a neighbour...
                        if (queueLength >= queue.length) {
                            queue = this.resizeDecreaseQueue();
                        }
                        queue[queueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((targetLevel & 0xFL) << (6 + 6 + 16)) | ((propagate.everythingButTheOppositeDirection) << (6 + 6 + 16 + 4));
                        continue;
                    }
                    continue;
                } else {
                    this.mutablePos1.set(offX, offY, offZ);
                    long flags = 0;
                    if (((ExtendedAbstractBlockState) blockState).isConditionallyFullOpaque()) {
                        final VoxelShape cullingFace = blockState.getFaceOcclusionShape(world, this.mutablePos1, propagate.getOpposite().nms);
                        if (Shapes.faceShapeOccludes(fromShape, cullingFace)) {
                            continue;
                        }
                        flags |= FLAG_HAS_SIDED_TRANSPARENT_BLOCKS;
                    }
                    final int opacity = blockState.getLightBlock(world, this.mutablePos1);
                    final int targetLevel = Math.max(0, propagatedLightLevel - Math.max(1, opacity));
                    if (lightLevel > targetLevel) {
                        // it looks like another source propagated here, so re-propagate it
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((lightLevel & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | (FLAG_RECHECK_LEVEL | flags);
                        continue;
                    }
                    final int emittedLight = blockState.getLightEmission() & emittedMask;
                    if (emittedLight != 0) {
                        // note: do not set recheck level, or else the propagation will fail
                        if (increaseQueueLength >= increaseQueue.length) {
                            increaseQueue = this.resizeIncreaseQueue();
                        }
                        increaseQueue[increaseQueueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((emittedLight & 0xFL) << (6 + 6 + 16)) | (((long) ALL_DIRECTIONS_BITSET) << (6 + 6 + 16 + 4)) | (flags | FLAG_WRITE_LEVEL);
                    }
                    currentNibble.set(localIndex, 0);
                    this.postLightUpdate(offX, offY, offZ);
                    if (targetLevel > 0) {
                        // we actually need to propagate 0 just in case we find a neighbour...
                        if (queueLength >= queue.length) {
                            queue = this.resizeDecreaseQueue();
                        }
                        queue[queueLength++] = ((offX + (offZ << 6) + (offY << 12) + encodeOffset) & ((1L << (6 + 6 + 16)) - 1)) | ((targetLevel & 0xFL) << (6 + 6 + 16)) | ((propagate.everythingButTheOppositeDirection) << (6 + 6 + 16 + 4)) | flags;
                    }
                    continue;
                }
            }
        }
    }
    // propagate sources we clobbered
    this.increaseQueueInitialLength = increaseQueueLength;
    this.performLightIncrease(lightAccess);
}
Also used : BlockGetter(net.minecraft.world.level.BlockGetter) BlockState(net.minecraft.world.level.block.state.BlockState) ExtendedAbstractBlockState(ca.spottedleaf.starlight.common.blockstate.ExtendedAbstractBlockState) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) ExtendedAbstractBlockState(ca.spottedleaf.starlight.common.blockstate.ExtendedAbstractBlockState)

Example 4 with BlockGetter

use of net.minecraft.world.level.BlockGetter in project Create by Creators-of-Create.

the class ToolboxBlock method getCloneItemStack.

@Override
public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) {
    ItemStack item = new ItemStack(this);
    Optional<ToolboxTileEntity> tileEntityOptional = getTileEntityOptional(world, pos);
    CompoundTag tag = item.getOrCreateTag();
    CompoundTag inv = tileEntityOptional.map(tb -> tb.inventory.serializeNBT()).orElse(new CompoundTag());
    tag.put("Inventory", inv);
    tileEntityOptional.map(tb -> tb.getUniqueId()).ifPresent(uid -> tag.putUUID("UniqueId", uid));
    tileEntityOptional.map(ToolboxTileEntity::getCustomName).ifPresent(item::setHoverName);
    return item;
}
Also used : CollisionContext(net.minecraft.world.phys.shapes.CollisionContext) DyeColor(net.minecraft.world.item.DyeColor) ITE(com.simibubi.create.foundation.block.ITE) LivingEntity(net.minecraft.world.entity.LivingEntity) Direction(net.minecraft.core.Direction) CreativeModeTab(net.minecraft.world.item.CreativeModeTab) BlockState(net.minecraft.world.level.block.state.BlockState) ServerLevel(net.minecraft.server.level.ServerLevel) Ingredient(net.minecraft.world.item.crafting.Ingredient) Builder(net.minecraft.world.level.block.state.StateDefinition.Builder) ServerPlayer(net.minecraft.server.level.ServerPlayer) BlockGetter(net.minecraft.world.level.BlockGetter) AllTileEntities(com.simibubi.create.AllTileEntities) NonNullList(net.minecraft.core.NonNullList) Fluids(net.minecraft.world.level.material.Fluids) AllBlocks(com.simibubi.create.AllBlocks) BlockStateProperties(net.minecraft.world.level.block.state.properties.BlockStateProperties) WATERLOGGED(net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED) SimpleWaterloggedBlock(net.minecraft.world.level.block.SimpleWaterloggedBlock) BlockHitResult(net.minecraft.world.phys.BlockHitResult) InteractionResult(net.minecraft.world.InteractionResult) AllShapes(com.simibubi.create.AllShapes) Player(net.minecraft.world.entity.player.Player) BlockHelper(com.simibubi.create.foundation.utility.BlockHelper) CompoundTag(net.minecraft.nbt.CompoundTag) BlockPos(net.minecraft.core.BlockPos) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) FluidState(net.minecraft.world.level.material.FluidState) Optional(java.util.Optional) BlockPlaceContext(net.minecraft.world.item.context.BlockPlaceContext) LevelAccessor(net.minecraft.world.level.LevelAccessor) Block(net.minecraft.world.level.block.Block) InteractionHand(net.minecraft.world.InteractionHand) ItemStack(net.minecraft.world.item.ItemStack) Level(net.minecraft.world.level.Level) HorizontalDirectionalBlock(net.minecraft.world.level.block.HorizontalDirectionalBlock) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) FakePlayer(net.minecraftforge.common.util.FakePlayer) NetworkHooks(net.minecraftforge.network.NetworkHooks) ItemStack(net.minecraft.world.item.ItemStack) CompoundTag(net.minecraft.nbt.CompoundTag)

Example 5 with BlockGetter

use of net.minecraft.world.level.BlockGetter in project Cyclic by Lothrazar.

the class DarkGlassConnectedBlock method getStateForPlacement.

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
    BlockGetter world = context.getLevel();
    BlockPos pos = context.getClickedPos();
    return super.getStateForPlacement(context).setValue(CONNECTED_DOWN, this.isSideConnectable(world, pos, Direction.DOWN)).setValue(CONNECTED_EAST, this.isSideConnectable(world, pos, Direction.EAST)).setValue(CONNECTED_NORTH, this.isSideConnectable(world, pos, Direction.NORTH)).setValue(CONNECTED_SOUTH, this.isSideConnectable(world, pos, Direction.SOUTH)).setValue(CONNECTED_UP, this.isSideConnectable(world, pos, Direction.UP)).setValue(CONNECTED_WEST, this.isSideConnectable(world, pos, Direction.WEST));
}
Also used : BlockGetter(net.minecraft.world.level.BlockGetter) BlockPos(net.minecraft.core.BlockPos)

Aggregations

BlockGetter (net.minecraft.world.level.BlockGetter)14 BlockPos (net.minecraft.core.BlockPos)8 Level (net.minecraft.world.level.Level)4 ServerLevel (net.minecraft.server.level.ServerLevel)3 BlockState (net.minecraft.world.level.block.state.BlockState)3 VoxelShape (net.minecraft.world.phys.shapes.VoxelShape)3 ExtendedAbstractBlockState (ca.spottedleaf.starlight.common.blockstate.ExtendedAbstractBlockState)2 ServerPlayer (net.minecraft.server.level.ServerPlayer)2 Player (net.minecraft.world.entity.player.Player)2 ChunkPos (net.minecraft.world.level.ChunkPos)2 AllBlocks (com.simibubi.create.AllBlocks)1 AllShapes (com.simibubi.create.AllShapes)1 AllTileEntities (com.simibubi.create.AllTileEntities)1 ITE (com.simibubi.create.foundation.block.ITE)1 BlockHelper (com.simibubi.create.foundation.utility.BlockHelper)1 ArrayList (java.util.ArrayList)1 Optional (java.util.Optional)1 Direction (net.minecraft.core.Direction)1 NonNullList (net.minecraft.core.NonNullList)1 CompoundTag (net.minecraft.nbt.CompoundTag)1