Search in sources :

Example 1 with ApiaryStorageBlock

use of com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryStorageBlock in project ResourcefulBees by Resourceful-Bees.

the class ApiaryController method validateBlocks.

private boolean validateBlocks(AtomicBoolean isStructureValid, Level worldIn, @Nullable ServerPlayer validatingPlayer) {
    structureBlocks.forEach(pos -> {
        Block block = worldIn.getBlockState(pos).getBlock();
        if (block.is(BeeInfoUtils.getValidApiaryTag()) || block instanceof ApiaryBreederBlock || block instanceof ApiaryStorageBlock || block instanceof ApiaryBlock) {
            BlockEntity tile = worldIn.getBlockEntity(pos);
            linkStorageAndBreeder(tile);
        } else {
            isStructureValid.set(false);
            if (validatingPlayer != null)
                validatingPlayer.displayClientMessage(new TextComponent(String.format("Block at position (X: %1$s Y: %2$s Z: %3$s) is invalid!", pos.getX(), pos.getY(), pos.getZ())), false);
        }
    });
    return isStructureValid.get();
}
Also used : ApiaryBreederBlock(com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryBreederBlock) TextComponent(net.minecraft.network.chat.TextComponent) ApiaryStorageBlock(com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryStorageBlock) ApiaryBlock(com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryBlock) ApiaryBlock(com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryBlock) ApiaryBreederBlock(com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryBreederBlock) ApiaryStorageBlock(com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryStorageBlock) Block(net.minecraft.world.level.block.Block) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) TickableBlockEntity(net.minecraft.world.level.block.entity.TickableBlockEntity)

Aggregations

ApiaryBlock (com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryBlock)1 ApiaryBreederBlock (com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryBreederBlock)1 ApiaryStorageBlock (com.teamresourceful.resourcefulbees.block.multiblocks.apiary.ApiaryStorageBlock)1 TextComponent (net.minecraft.network.chat.TextComponent)1 Block (net.minecraft.world.level.block.Block)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 TickableBlockEntity (net.minecraft.world.level.block.entity.TickableBlockEntity)1