import { world, system, BlockPermutation, ItemStack } from "@minecraft/server"

let fakeInventory = "null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0null0";

world.beforeEvents.itemUseOn.subscribe(function(data) {
    if ((data.itemStack.typeId == "minecraft:carved_pumpkin") || (data.itemStack.typeId == "minecraft:lit_pumpkin")) {
        let block;
        if (data.blockFace == "North")
            block = data.block.dimension.getBlock({ x: data.block.x, y: data.block.y, z: data.block.z - 1 });
        else if (data.blockFace == "South")
            block = data.block.dimension.getBlock({ x: data.block.x, y: data.block.y, z: data.block.z + 1 });
        else if (data.blockFace == "East")
            block = data.block.dimension.getBlock({ x: data.block.x + 1, y: data.block.y, z: data.block.z });
        else if (data.blockFace == "West")
            block = data.block.dimension.getBlock({ x: data.block.x - 1, y: data.block.y, z: data.block.z });
        else if (data.blockFace == "Up")
            block = data.block.dimension.getBlock({ x: data.block.x, y: data.block.y + 1, z: data.block.z });
        else if (data.blockFace == "Down")
            block = data.block.dimension.getBlock({ x: data.block.x, y: data.block.y - 1, z: data.block.z });
        else {
            block = data.block;
        }

        const blockDown1 = block.dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z });
        const blockDown2 = block.dimension.getBlock({ x: block.x, y: block.y - 2, z: block.z });
        const blockUp1 = block.dimension.getBlock({ x: block.x, y: block.y + 1, z: block.z });
        const blockUp2 = block.dimension.getBlock({ x: block.x, y: block.y + 2, z: block.z });

        const blockDown1North1 = block.dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z - 1 });
        const blockDown1South1 = block.dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z + 1 });
        const blockDown1East1 = block.dimension.getBlock({ x: block.x + 1, y: block.y - 1, z: block.z });
        const blockDown1West1 = block.dimension.getBlock({ x: block.x - 1, y: block.y - 1, z: block.z });

        const blockUp1North1 = block.dimension.getBlock({ x: block.x, y: block.y + 1, z: block.z - 1 });
        const blockUp1South1 = block.dimension.getBlock({ x: block.x, y: block.y + 1, z: block.z + 1 });
        const blockUp1East1 = block.dimension.getBlock({ x: block.x + 1, y: block.y + 1, z: block.z });
        const blockUp1West1 = block.dimension.getBlock({ x: block.x - 1, y: block.y + 1, z: block.z });

        const blockNorth1 = block.dimension.getBlock({ x: block.x, y: block.y, z: block.z - 1 });
        const blockSouth1 = block.dimension.getBlock({ x: block.x, y: block.y, z: block.z + 1 });
        const blockEast1 = block.dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z });
        const blockWest1 = block.dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z });

        const blockNorth1East1 = block.dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z - 1 });
        const blockNorth1West1 = block.dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z - 1 });
        const blockSouth1East1 = block.dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z + 1 });
        const blockSouth1West1 = block.dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z + 1 });

        const blockNorth2 = block.dimension.getBlock({ x: block.x, y: block.y, z: block.z - 2 });
        const blockSouth2 = block.dimension.getBlock({ x: block.x, y: block.y, z: block.z + 2 });
        const blockEast2 = block.dimension.getBlock({ x: block.x + 2, y: block.y, z: block.z });
        const blockWest2 = block.dimension.getBlock({ x: block.x - 2, y: block.y, z: block.z });

        if (blockDown1.typeId == "minecraft:iron_block" && blockDown2.typeId == "minecraft:iron_block" && blockDown1North1.typeId == "minecraft:iron_block" && blockDown1South1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockDown1.typeId == "minecraft:iron_block" && blockDown2.typeId == "minecraft:iron_block" && blockDown1East1.typeId == "minecraft:iron_block" && blockDown1West1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockDown1.typeId == "minecraft:snow" && blockDown2.typeId == "minecraft:snow") {
            data.cancel = true;
        }
        if (blockUp1.typeId == "minecraft:iron_block" && blockUp2.typeId == "minecraft:iron_block" && blockUp1North1.typeId == "minecraft:iron_block" && blockUp1South1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockUp1.typeId == "minecraft:iron_block" && blockUp2.typeId == "minecraft:iron_block" && blockUp1East1.typeId == "minecraft:iron_block" && blockUp1West1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockUp1.typeId == "minecraft:snow" && blockUp2.typeId == "minecraft:snow") {
            data.cancel = true;
        }
        else if (blockNorth1.typeId == "minecraft:iron_block" && blockNorth2.typeId == "minecraft:iron_block" && blockNorth1East1.typeId == "minecraft:iron_block" && blockNorth1West1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockSouth1.typeId == "minecraft:iron_block" && blockSouth2.typeId == "minecraft:iron_block" && blockSouth1East1.typeId == "minecraft:iron_block" && blockSouth1West1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockEast1.typeId == "minecraft:iron_block" && blockEast2.typeId == "minecraft:iron_block" && blockNorth1East1.typeId == "minecraft:iron_block" && blockSouth1East1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockWest1.typeId == "minecraft:iron_block" && blockWest2.typeId == "minecraft:iron_block" && blockNorth1West1.typeId == "minecraft:iron_block" && blockSouth1West1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockNorth1.typeId == "minecraft:snow" && blockNorth2.typeId == "minecraft:snow") {
            data.cancel = true;
        }
        else if (blockSouth1.typeId == "minecraft:snow" && blockSouth2.typeId == "minecraft:snow") {
            data.cancel = true;
        }
        else if (blockEast1.typeId == "minecraft:snow" && blockEast2.typeId == "minecraft:snow") {
            data.cancel = true;
        }
        else if (blockWest1.typeId == "minecraft:snow" && blockWest2.typeId == "minecraft:snow") {
            data.cancel = true;
        }
        else if (blockNorth1.typeId == "minecraft:iron_block" && blockNorth2.typeId == "minecraft:iron_block" && blockUp1North1.typeId == "minecraft:iron_block" && blockDown1North1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockSouth1.typeId == "minecraft:iron_block" && blockSouth2.typeId == "minecraft:iron_block" && blockUp1South1.typeId == "minecraft:iron_block" && blockDown1South1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockEast1.typeId == "minecraft:iron_block" && blockEast2.typeId == "minecraft:iron_block" && blockUp1East1.typeId == "minecraft:iron_block" && blockDown1East1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
        else if (blockWest1.typeId == "minecraft:iron_block" && blockWest2.typeId == "minecraft:iron_block" && blockUp1West1.typeId == "minecraft:iron_block" && blockDown1West1.typeId == "minecraft:iron_block") {
            data.cancel = true;
        }
    }
})

world.beforeEvents.worldInitialize.subscribe(initEvent => {
    initEvent.blockComponentRegistry.registerCustomComponent("zpig:unstable_magma_component", {
        onTick: (event) => {
            const { block, dimension } = event;
            if (block.permutation.getState("zpig:magma_state") < 3) {
                block.setPermutation(block.permutation.withState("zpig:magma_state", (block.permutation.getState("zpig:magma_state") + 1)));
            }
            else {
                block.setPermutation(BlockPermutation.resolve("minecraft:flowing_lava"));
            }
        }
    });
    initEvent.blockComponentRegistry.registerCustomComponent("zpig:soul_core_component", {
        onPlace: (event) => {
            const { block, dimension, previousBlock } = event;
            
            const blockDown1 = dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z });
            const blockDown2 = dimension.getBlock({ x: block.x, y: block.y - 2, z: block.z });
            const blockDown3 = dimension.getBlock({ x: block.x, y: block.y - 3, z: block.z });

            const blockUp1North1 = dimension.getBlock({ x: block.x, y: block.y + 1, z: block.z - 1 });
            const blockUp1South1 = dimension.getBlock({ x: block.x, y: block.y + 1, z: block.z + 1 });
            const blockUp1East1 = dimension.getBlock({ x: block.x + 1, y: block.y + 1, z: block.z });
            const blockUp1West1 = dimension.getBlock({ x: block.x - 1, y: block.y + 1, z: block.z });

            const blockUp1North1East1 = dimension.getBlock({ x: block.x + 1, y: block.y + 1, z: block.z - 1 });
            const blockUp1North1West1 = dimension.getBlock({ x: block.x - 1, y: block.y + 1, z: block.z - 1 });
            const blockUp1South1East1 = dimension.getBlock({ x: block.x + 1, y: block.y + 1, z: block.z + 1 });
            const blockUp1South1West1 = dimension.getBlock({ x: block.x - 1, y: block.y + 1, z: block.z + 1 });

            const blockUp2North1 = dimension.getBlock({ x: block.x, y: block.y + 2, z: block.z - 1 });
            const blockUp2South1 = dimension.getBlock({ x: block.x, y: block.y + 2, z: block.z + 1 });
            const blockUp2East1 = dimension.getBlock({ x: block.x + 1, y: block.y + 2, z: block.z });
            const blockUp2West1 = dimension.getBlock({ x: block.x - 1, y: block.y + 2, z: block.z });

            const blockNorth1 = dimension.getBlock({ x: block.x, y: block.y, z: block.z - 1 });
            const blockSouth1 = dimension.getBlock({ x: block.x, y: block.y, z: block.z + 1 });
            const blockEast1 = dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z });
            const blockWest1 = dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z });

            const blockNorth2 = dimension.getBlock({ x: block.x, y: block.y, z: block.z - 2 });
            const blockSouth2 = dimension.getBlock({ x: block.x, y: block.y, z: block.z + 2 });
            const blockEast2 = dimension.getBlock({ x: block.x + 2, y: block.y, z: block.z });
            const blockWest2 = dimension.getBlock({ x: block.x - 2, y: block.y, z: block.z });

            const blockNorth3 = dimension.getBlock({ x: block.x, y: block.y, z: block.z - 3 });
            const blockSouth3 = dimension.getBlock({ x: block.x, y: block.y, z: block.z + 3 });
            const blockEast3 = dimension.getBlock({ x: block.x + 3, y: block.y, z: block.z });
            const blockWest3 = dimension.getBlock({ x: block.x - 3, y: block.y, z: block.z });

            const blockNorth1East1 = dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z - 1 });
            const blockNorth1West1 = dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z - 1 });
            const blockSouth1East1 = dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z + 1 });
            const blockSouth1West1 = dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z + 1 });

            const blockNorth1East2 = dimension.getBlock({ x: block.x + 2, y: block.y, z: block.z - 1 });
            const blockNorth1West2 = dimension.getBlock({ x: block.x - 2, y: block.y, z: block.z - 1 });
            const blockSouth1East2 = dimension.getBlock({ x: block.x + 2, y: block.y, z: block.z + 1 });
            const blockSouth1West2 = dimension.getBlock({ x: block.x - 2, y: block.y, z: block.z + 1 });

            const blockNorth2East1 = dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z - 2 });
            const blockNorth2West1 = dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z - 2 });
            const blockSouth2East1 = dimension.getBlock({ x: block.x + 1, y: block.y, z: block.z + 2 });
            const blockSouth2West1 = dimension.getBlock({ x: block.x - 1, y: block.y, z: block.z + 2 });

            const blockDown1North1 = dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z - 1 });
            const blockDown1South1 = dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z + 1 });
            const blockDown1East1 = dimension.getBlock({ x: block.x + 1, y: block.y - 1, z: block.z });
            const blockDown1West1 = dimension.getBlock({ x: block.x - 1, y: block.y - 1, z: block.z });

            const blockDown1North2 = dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z - 2 });
            const blockDown1South2 = dimension.getBlock({ x: block.x, y: block.y - 1, z: block.z + 2 });
            const blockDown1East2 = dimension.getBlock({ x: block.x + 2, y: block.y - 1, z: block.z });
            const blockDown1West2 = dimension.getBlock({ x: block.x - 2, y: block.y - 1, z: block.z });

            const blockDown1North1East1 = dimension.getBlock({ x: block.x + 1, y: block.y - 1, z: block.z - 1 });
            const blockDown1North1West1 = dimension.getBlock({ x: block.x - 1, y: block.y - 1, z: block.z - 1 });
            const blockDown1South1East1 = dimension.getBlock({ x: block.x + 1, y: block.y - 1, z: block.z + 1 });
            const blockDown1South1West1 = dimension.getBlock({ x: block.x - 1, y: block.y - 1, z: block.z + 1 });

            const blockDown2North2 = dimension.getBlock({ x: block.x, y: block.y - 2, z: block.z - 2 });
            const blockDown2South2 = dimension.getBlock({ x: block.x, y: block.y - 2, z: block.z + 2 });
            const blockDown2East2 = dimension.getBlock({ x: block.x + 2, y: block.y - 2, z: block.z });
            const blockDown2West2 = dimension.getBlock({ x: block.x - 2, y: block.y - 2, z: block.z });

            const blockDown3North1 = dimension.getBlock({ x: block.x, y: block.y - 3, z: block.z - 1 });
            const blockDown3South1 = dimension.getBlock({ x: block.x, y: block.y - 3, z: block.z + 1 });
            const blockDown3East1 = dimension.getBlock({ x: block.x + 1, y: block.y - 3, z: block.z });
            const blockDown3West1 = dimension.getBlock({ x: block.x - 1, y: block.y - 3, z: block.z });

            if (blockDown1.typeId == "minecraft:iron_block" && blockDown2.typeId == "minecraft:iron_block" && blockDown1North1.typeId == "minecraft:iron_block" && blockDown1South1.typeId == "minecraft:iron_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("minecraft:iron_golem<minecraft:from_player>", blockDown2.location);
            }
            else if (blockDown1.typeId == "minecraft:iron_block" && blockDown2.typeId == "minecraft:iron_block" && blockDown1East1.typeId == "minecraft:iron_block" && blockDown1West1.typeId == "minecraft:iron_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("minecraft:iron_golem<minecraft:from_player>", blockDown2.location);
            }
            else if (blockDown1.typeId == "minecraft:netherite_block" && blockDown2.typeId == "minecraft:gold_block" && blockDown1North1.typeId == "minecraft:diamond_block" && blockDown1South1.typeId == "minecraft:diamond_block" && blockDown1North2.typeId == "minecraft:gold_block" && blockDown1South2.typeId == "minecraft:gold_block" && blockDown2North2.typeId == "minecraft:diamond_block" && blockDown2South2.typeId == "minecraft:diamond_block" && blockDown3North1.typeId == "minecraft:gold_block" && blockDown3South1.typeId == "minecraft:gold_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2North2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2South2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3South1.location);
                dimension.spawnEntity("zpig:netherite_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:netherite_block" && blockDown2.typeId == "minecraft:gold_block" && blockDown1East1.typeId == "minecraft:diamond_block" && blockDown1West1.typeId == "minecraft:diamond_block" && blockDown1East2.typeId == "minecraft:gold_block" && blockDown1West2.typeId == "minecraft:gold_block" && blockDown2East2.typeId == "minecraft:diamond_block" && blockDown2West2.typeId == "minecraft:diamond_block" && blockDown3East1.typeId == "minecraft:gold_block" && blockDown3West1.typeId == "minecraft:gold_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3West1.location);
                dimension.spawnEntity("zpig:netherite_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:quartz_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:quartz_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:copper_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:clean>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:exposed_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:exposed>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:weathered_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:weathered>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:oxidized_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:oxidized>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:waxed_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:waxed_clean>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:waxed_exposed_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:waxed_exposed>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:waxed_weathered_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:waxed_weathered>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:waxed_oxidized_copper") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:copper_golem<zpig:waxed_oxidized>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:furnace" && blockDown1North1.typeId == "minecraft:coal_block" && blockDown1South1.typeId == "minecraft:coal_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:coal_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:furnace" && blockDown1East1.typeId == "minecraft:coal_block" && blockDown1West1.typeId == "minecraft:coal_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:coal_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:gold_block" && blockNorth1.typeId == "minecraft:gold_block" && blockSouth1.typeId == "minecraft:gold_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:gold_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:gold_block" && blockEast1.typeId == "minecraft:gold_block" && blockWest1.typeId == "minecraft:gold_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:gold_golem", blockDown1.location);
            }
            else if (blockNorth1.typeId == "minecraft:emerald_block" && blockUp1North1.typeId == "minecraft:flower_pot") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1.location);
                dimension.spawnEntity("zpig:emerald_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:emerald_block" && blockUp1South1.typeId == "minecraft:flower_pot") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1.location);
                dimension.spawnEntity("zpig:emerald_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:emerald_block" && blockUp1East1.typeId == "minecraft:flower_pot") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1East1.location);
                dimension.spawnEntity("zpig:emerald_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:emerald_block" && blockUp1West1.typeId == "minecraft:flower_pot") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1West1.location);
                dimension.spawnEntity("zpig:emerald_golem", block.location);
            }
            else if (blockDown1.typeId == "minecraft:diamond_block" && blockDown2.typeId == "minecraft:iron_block" && blockDown1North1.typeId == "minecraft:iron_block" && blockDown1South1.typeId == "minecraft:iron_block" && blockDown1North2.typeId == "minecraft:diamond_block" && blockDown1South2.typeId == "minecraft:diamond_block" && blockDown3North1.typeId == "minecraft:diamond_block" && blockDown3South1.typeId == "minecraft:diamond_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3South1.location);
                dimension.spawnEntity("zpig:diamond_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:diamond_block" && blockDown2.typeId == "minecraft:iron_block" && blockDown1East1.typeId == "minecraft:iron_block" && blockDown1West1.typeId == "minecraft:iron_block" && blockDown1East2.typeId == "minecraft:diamond_block" && blockDown1West2.typeId == "minecraft:diamond_block" && blockDown3East1.typeId == "minecraft:diamond_block" && blockDown3West1.typeId == "minecraft:diamond_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3West1.location);
                dimension.spawnEntity("zpig:diamond_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:cobblestone" && blockDown2.typeId == "minecraft:redstone_block" && blockDown1North1.typeId == "minecraft:redstone_block" && blockDown1South1.typeId == "minecraft:redstone_block" && blockDown3North1.typeId == "minecraft:cobblestone" && blockDown3South1.typeId == "minecraft:cobblestone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3South1.location);
                dimension.spawnEntity("zpig:redstone_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:cobblestone" && blockDown2.typeId == "minecraft:redstone_block" && blockDown1East1.typeId == "minecraft:redstone_block" && blockDown1West1.typeId == "minecraft:redstone_block" && blockDown3East1.typeId == "minecraft:cobblestone" && blockDown3West1.typeId == "minecraft:cobblestone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3West1.location);
                dimension.spawnEntity("zpig:redstone_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:cobblestone" && blockDown2.typeId == "minecraft:lapis_block" && blockDown1North1.typeId == "minecraft:lapis_block" && blockDown1South1.typeId == "minecraft:lapis_block" && blockDown3North1.typeId == "minecraft:cobblestone" && blockDown3South1.typeId == "minecraft:cobblestone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3South1.location);
                dimension.spawnEntity("zpig:lapislazuli_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:cobblestone" && blockDown2.typeId == "minecraft:lapis_block" && blockDown1East1.typeId == "minecraft:lapis_block" && blockDown1West1.typeId == "minecraft:lapis_block" && blockDown3East1.typeId == "minecraft:cobblestone" && blockDown3West1.typeId == "minecraft:cobblestone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3West1.location);
                dimension.spawnEntity("zpig:lapislazuli_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:carved_pumpkin" && blockDown2.typeId == "minecraft:snow") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("minecraft:snow_golem", blockDown2.location);
            }
            else if (blockNorth1.typeId == "minecraft:glowstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:glowstone_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:glowstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:glowstone_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:glowstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:glowstone_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:glowstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:glowstone_golem", block.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:black_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_black>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:black_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_black>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:black_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_black>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:black_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_black>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:brown_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_brown>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:brown_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_brown>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:brown_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_brown>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:brown_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_brown>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:cyan_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_cyan>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:cyan_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_cyan>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:cyan_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_cyan>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:cyan_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_cyan>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_gray>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_gray>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_gray>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_gray>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:green_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_green>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:green_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_green>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:green_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_green>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:green_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_green>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:light_blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_light_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:light_blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_light_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:light_blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_light_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:light_blue_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_light_blue>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:lime_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_lime>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:lime_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_lime>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:lime_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_lime>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:lime_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_lime>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:magenta_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_magenta>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:magenta_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_magenta>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:magenta_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_magenta>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:magenta_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_magenta>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:orange_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_orange>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:orange_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_orange>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:orange_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_orange>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:orange_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_orange>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:pink_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_pink>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:pink_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_pink>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:pink_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_pink>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:pink_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_pink>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:purple_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_purple>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:purple_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_purple>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:purple_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_purple>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:purple_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_purple>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:red_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_red>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:red_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_red>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:red_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_red>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:red_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_red>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:light_gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_silver>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:light_gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_silver>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:light_gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_silver>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:light_gray_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_silver>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:white_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_white>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:white_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_white>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:white_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_white>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:white_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_white>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1North1.typeId == "minecraft:yellow_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_yellow>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1South1.typeId == "minecraft:yellow_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_yellow>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1East1.typeId == "minecraft:yellow_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_yellow>", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:tuff" && blockDown1West1.typeId == "minecraft:yellow_wool") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:tuff_golem<zpig:spawn_yellow>", blockDown1.location);
            }
            else if (blockNorth1.typeId == "minecraft:sandstone" && blockUp1North1.typeId == "minecraft:sand" && blockUp2North1.typeId == "minecraft:cactus") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp2North1.location);
                dimension.spawnEntity("zpig:sandstone_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:sandstone" && blockUp1South1.typeId == "minecraft:sand" && blockUp2South1.typeId == "minecraft:cactus") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp2South1.location);
                dimension.spawnEntity("zpig:sandstone_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:sandstone" && blockUp1East1.typeId == "minecraft:sand" && blockUp2East1.typeId == "minecraft:cactus") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp2East1.location);
                dimension.spawnEntity("zpig:sandstone_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:sandstone" && blockUp1West1.typeId == "minecraft:sand" && blockUp2West1.typeId == "minecraft:cactus") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp2West1.location);
                dimension.spawnEntity("zpig:sandstone_golem", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:deepslate" && blockUp1North1.typeId == "minecraft:sculk_shrieker" && blockUp1North1East1.typeId == "minecraft:sculk" && blockUp1North1West1.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1West1.location);
                dimension.spawnEntity("zpig:deepslate_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:deepslate" && blockUp1South1.typeId == "minecraft:sculk_shrieker" && blockUp1South1East1.typeId == "minecraft:sculk" && blockUp1South1West1.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1West1.location);
                dimension.spawnEntity("zpig:deepslate_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:deepslate" && blockUp1East1.typeId == "minecraft:sculk_shrieker" && blockUp1North1East1.typeId == "minecraft:sculk" && blockUp1South1East1.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1East1.location);
                dimension.spawnEntity("zpig:deepslate_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:deepslate" && blockUp1West1.typeId == "minecraft:sculk_shrieker" && blockUp1North1West1.typeId == "minecraft:sculk" && blockUp1South1West1.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1West1.location);
                dimension.spawnEntity("zpig:deepslate_golem", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:gravel" && blockEast1.typeId == "minecraft:slime" && blockWest1.typeId == "minecraft:slime" && blockNorth1East1.typeId == "minecraft:gravel" && blockNorth1West1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_large>", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:gravel" && blockEast1.typeId == "minecraft:slime" && blockWest1.typeId == "minecraft:slime" && blockSouth1East1.typeId == "minecraft:gravel" && blockSouth1West1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_large>", block.location);
            }
            else if (blockEast1.typeId == "minecraft:gravel" && blockNorth1.typeId == "minecraft:slime" && blockSouth1.typeId == "minecraft:slime" && blockNorth1East1.typeId == "minecraft:gravel" && blockSouth1East1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_large>", block.location);
            }
            else if (blockWest1.typeId == "minecraft:gravel" && blockNorth1.typeId == "minecraft:slime" && blockSouth1.typeId == "minecraft:slime" && blockNorth1West1.typeId == "minecraft:gravel" && blockSouth1West1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_large>", block.location);
            }
            else if (blockEast1.typeId == "minecraft:slime" && blockWest1.typeId == "minecraft:slime" && blockNorth1East1.typeId == "minecraft:gravel" && blockNorth1West1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_medium>", block.location);
            }
            else if (blockEast1.typeId == "minecraft:slime" && blockWest1.typeId == "minecraft:slime" && blockSouth1East1.typeId == "minecraft:gravel" && blockSouth1West1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_medium>", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:slime" && blockSouth1.typeId == "minecraft:slime" && blockNorth1East1.typeId == "minecraft:gravel" && blockSouth1East1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_medium>", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:slime" && blockSouth1.typeId == "minecraft:slime" && blockNorth1West1.typeId == "minecraft:gravel" && blockSouth1West1.typeId == "minecraft:gravel") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_medium>", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:gravel" && blockEast1.typeId == "minecraft:slime" && blockWest1.typeId == "minecraft:slime") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_small>", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:gravel" && blockEast1.typeId == "minecraft:slime" && blockWest1.typeId == "minecraft:slime") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_small>", block.location);
            }
            else if (blockEast1.typeId == "minecraft:gravel" && blockNorth1.typeId == "minecraft:slime" && blockSouth1.typeId == "minecraft:slime") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_small>", block.location);
            }
            else if (blockWest1.typeId == "minecraft:gravel" && blockNorth1.typeId == "minecraft:slime" && blockSouth1.typeId == "minecraft:slime") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:gravel_golem<zpig:spawn_small>", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:end_stone" && blockNorth2.typeId == "minecraft:end_stone" && blockNorth3.typeId == "minecraft:end_stone" && blockNorth1East1.typeId == "minecraft:purpur_block" && blockNorth1West1.typeId == "minecraft:purpur_block" && blockNorth1East2.typeId == "minecraft:purpur_block" && blockNorth1West2.typeId == "minecraft:purpur_block" && blockNorth2East1.typeId == "minecraft:end_stone" && blockNorth2West1.typeId == "minecraft:end_stone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth3.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2West1.location);
                dimension.spawnEntity("zpig:endstone_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:end_stone" && blockSouth2.typeId == "minecraft:end_stone" && blockSouth3.typeId == "minecraft:end_stone" && blockSouth1East1.typeId == "minecraft:purpur_block" && blockSouth1West1.typeId == "minecraft:purpur_block" && blockSouth1East2.typeId == "minecraft:purpur_block" && blockSouth1West2.typeId == "minecraft:purpur_block" && blockSouth2East1.typeId == "minecraft:end_stone" && blockSouth2West1.typeId == "minecraft:end_stone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth3.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2West1.location);
                dimension.spawnEntity("zpig:endstone_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:end_stone" && blockEast2.typeId == "minecraft:end_stone" && blockEast3.typeId == "minecraft:end_stone" && blockNorth1East1.typeId == "minecraft:purpur_block" && blockSouth1East1.typeId == "minecraft:purpur_block" && blockNorth2East1.typeId == "minecraft:purpur_block" && blockSouth2East1.typeId == "minecraft:purpur_block" && blockNorth1East2.typeId == "minecraft:end_stone" && blockSouth1East2.typeId == "minecraft:end_stone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast2.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast3.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East2.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2East1.location);
                dimension.spawnEntity("zpig:endstone_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:end_stone" && blockWest2.typeId == "minecraft:end_stone" && blockWest3.typeId == "minecraft:end_stone" && blockNorth1West1.typeId == "minecraft:purpur_block" && blockSouth1West1.typeId == "minecraft:purpur_block" && blockNorth2West1.typeId == "minecraft:purpur_block" && blockSouth2West1.typeId == "minecraft:purpur_block" && blockNorth1West2.typeId == "minecraft:end_stone" && blockSouth1West2.typeId == "minecraft:end_stone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest2.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest3.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West2.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2West1.location);
                dimension.spawnEntity("zpig:endstone_golem", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:dark_prismarine" && blockNorth2.typeId == "minecraft:prismarine" && blockNorth3.typeId == "minecraft:prismarine" && blockNorth1East1.typeId == "minecraft:prismarine" && blockNorth1West1.typeId == "minecraft:prismarine" && blockUp1North1.typeId == "minecraft:glass") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth3.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1North1.location);
                dimension.spawnEntity("zpig:prismarine_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:dark_prismarine" && blockSouth2.typeId == "minecraft:prismarine" && blockSouth3.typeId == "minecraft:prismarine" && blockSouth1East1.typeId == "minecraft:prismarine" && blockSouth1West1.typeId == "minecraft:prismarine" && blockUp1South1.typeId == "minecraft:glass") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth3.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1South1.location);
                dimension.spawnEntity("zpig:prismarine_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:dark_prismarine" && blockEast2.typeId == "minecraft:prismarine" && blockEast3.typeId == "minecraft:prismarine" && blockNorth1East1.typeId == "minecraft:prismarine" && blockSouth1East1.typeId == "minecraft:prismarine" && blockUp1East1.typeId == "minecraft:glass") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast2.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast3.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1East1.location);
                dimension.spawnEntity("zpig:prismarine_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:dark_prismarine" && blockWest2.typeId == "minecraft:prismarine" && blockWest3.typeId == "minecraft:prismarine" && blockNorth1West1.typeId == "minecraft:prismarine" && blockSouth1West1.typeId == "minecraft:prismarine" && blockUp1West1.typeId == "minecraft:glass") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest2.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest3.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockUp1West1.location);
                dimension.spawnEntity("zpig:prismarine_golem", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:basalt" && blockNorth2.typeId == "minecraft:basalt" && blockDown1.typeId == "minecraft:basalt" && blockDown1North1.typeId == "minecraft:basalt" && blockDown1North2.typeId == "minecraft:basalt") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North2.location);
                dimension.spawnEntity("zpig:basalt_golem", blockDown1.location);
            }
            else if (blockSouth1.typeId == "minecraft:basalt" && blockSouth2.typeId == "minecraft:basalt" && blockDown1.typeId == "minecraft:basalt" && blockDown1South1.typeId == "minecraft:basalt" && blockDown1South2.typeId == "minecraft:basalt") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South2.location);
                dimension.spawnEntity("zpig:basalt_golem", blockDown1.location);
            }
            else if (blockEast1.typeId == "minecraft:basalt" && blockEast2.typeId == "minecraft:basalt" && blockDown1.typeId == "minecraft:basalt" && blockDown1East1.typeId == "minecraft:basalt" && blockDown1East2.typeId == "minecraft:basalt") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East2.location);
                dimension.spawnEntity("zpig:basalt_golem", blockDown1.location);
            }
            else if (blockWest1.typeId == "minecraft:basalt" && blockWest2.typeId == "minecraft:basalt" && blockDown1.typeId == "minecraft:basalt" && blockDown1West1.typeId == "minecraft:basalt" && blockDown1West2.typeId == "minecraft:basalt") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West2.location);
                dimension.spawnEntity("zpig:basalt_golem", blockDown1.location);
            }
            else if (blockNorth1.typeId == "minecraft:amethyst_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:amethyst_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:amethyst_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:amethyst_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:amethyst_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:amethyst_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:amethyst_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:amethyst_golem", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:purpur_block" && blockSouth1.typeId == "minecraft:purpur_block" && blockEast1.typeId == "minecraft:purpur_block" && blockWest1.typeId == "minecraft:purpur_block" && blockDown1North1East1.typeId == "minecraft:purpur_block" && blockDown1North1West1.typeId == "minecraft:purpur_block" && blockDown1South1East1.typeId == "minecraft:purpur_block" && blockDown1South1West1.typeId == "minecraft:purpur_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1West1.location);
                dimension.spawnEntity("zpig:purpur_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:crying_obsidian" && blockDown2.typeId == "minecraft:obsidian" && blockDown1North1.typeId == "minecraft:gold_block" && blockDown1South1.typeId == "minecraft:gold_block" && blockDown3North1.typeId == "minecraft:obsidian" && blockDown3South1.typeId == "minecraft:obsidian") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3South1.location);
                dimension.spawnEntity("zpig:obsidian_golem", blockDown3.location);
            }
            else if (blockDown1.typeId == "minecraft:crying_obsidian" && blockDown2.typeId == "minecraft:obsidian" && blockDown1East1.typeId == "minecraft:gold_block" && blockDown1West1.typeId == "minecraft:gold_block" && blockDown3East1.typeId == "minecraft:obsidian" && blockDown3West1.typeId == "minecraft:obsidian") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown3West1.location);
                dimension.spawnEntity("zpig:obsidian_golem", blockDown3.location);
            }
            else if (blockNorth1.typeId == "minecraft:bone_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:bone_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:bone_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:bone_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:bone_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:bone_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:bone_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:bone_golem", block.location);
            }
            else if (blockNorth1.typeId == "minecraft:sculk" && blockNorth2.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2.location);
                dimension.spawnEntity("zpig:sculk_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:sculk" && blockSouth2.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2.location);
                dimension.spawnEntity("zpig:sculk_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:sculk" && blockEast2.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast2.location);
                dimension.spawnEntity("zpig:sculk_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:sculk" && blockWest2.typeId == "minecraft:sculk") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest2.location);
                dimension.spawnEntity("zpig:sculk_golem", block.location);
            }
            else if (blockDown1.typeId == "minecraft:clay" && blockDown2.typeId == "minecraft:clay") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:clay_golem", blockDown2.location);
            }
            else if (blockDown1.typeId == "minecraft:hardened_clay" && blockDown2.typeId == "minecraft:hardened_clay") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:terracotta_golem", blockDown2.location);
            }
            else if (blockDown1.typeId == "minecraft:calcite") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:calcite_golem", blockDown1.location);
            }
            else if (blockNorth1.typeId == "minecraft:blackstone" && blockNorth2.typeId == "minecraft:blackstone" && blockDown1.typeId == "minecraft:blackstone" && blockDown1North1.typeId == "minecraft:blackstone" && blockDown1North2.typeId == "minecraft:blackstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1North2.location);
                dimension.spawnEntity("zpig:blackstone_golem", blockDown1.location);
            }
            else if (blockSouth1.typeId == "minecraft:blackstone" && blockSouth2.typeId == "minecraft:blackstone" && blockDown1.typeId == "minecraft:blackstone" && blockDown1South1.typeId == "minecraft:blackstone" && blockDown1South2.typeId == "minecraft:blackstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1South2.location);
                dimension.spawnEntity("zpig:blackstone_golem", blockDown1.location);
            }
            else if (blockEast1.typeId == "minecraft:blackstone" && blockEast2.typeId == "minecraft:blackstone" && blockDown1.typeId == "minecraft:blackstone" && blockDown1East1.typeId == "minecraft:blackstone" && blockDown1East2.typeId == "minecraft:blackstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1East2.location);
                dimension.spawnEntity("zpig:blackstone_golem", blockDown1.location);
            }
            else if (blockWest1.typeId == "minecraft:blackstone" && blockWest2.typeId == "minecraft:blackstone" && blockDown1.typeId == "minecraft:blackstone" && blockDown1West1.typeId == "minecraft:blackstone" && blockDown1West2.typeId == "minecraft:blackstone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest2.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1West2.location);
                dimension.spawnEntity("zpig:blackstone_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:dripstone_block") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:dripstone_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:ice" && blockDown2.typeId == "minecraft:ice") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:ice_golem", blockDown2.location);
            }
            else if (blockDown1.typeId == "minecraft:magma" && blockDown2.typeId == "minecraft:magma") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown2.location);
                dimension.spawnEntity("zpig:magma_golem", blockDown2.location);
            }
            else if (blockDown1.typeId == "minecraft:mud") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:mud_golem", blockDown1.location);
            }
            else if (blockNorth1.typeId == "minecraft:sand") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockNorth1.location);
                dimension.spawnEntity("zpig:sand_golem", block.location);
            }
            else if (blockSouth1.typeId == "minecraft:sand") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockSouth1.location);
                dimension.spawnEntity("zpig:sand_golem", block.location);
            }
            else if (blockEast1.typeId == "minecraft:sand") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockEast1.location);
                dimension.spawnEntity("zpig:sand_golem", block.location);
            }
            else if (blockWest1.typeId == "minecraft:sand") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockWest1.location);
                dimension.spawnEntity("zpig:sand_golem", block.location);
            }
            else if (blockDown1.typeId == "minecraft:netherrack") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:netherrack_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:stone") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:stone_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:diorite") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:diorite_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:granite") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:granite_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:andesite") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:andesite_golem", blockDown1.location);
            }
            else if (blockDown1.typeId == "minecraft:dirt") {
                dimension.spawnEntity("zpig:golem_soul", block.location);
                dimension.spawnEntity("zpig:golem_soul", blockDown1.location);
                dimension.spawnEntity("zpig:dirt_golem", blockDown1.location);
            }
        }
    });
});

system.afterEvents.scriptEventReceive.subscribe((data) => {
    if (data.id == "zpig:calcite_golem_arrow_survival_logic") {
        const arrow = data.sourceEntity;
        const playerList = arrow.dimension.getPlayers({
            location: arrow.location,
            closest: 1,
        });
        const player = playerList[0];
        const pInven = player.getComponent('inventory').container
        if (pInven.emptySlotsCount > 0) {
            pInven.addItem(new ItemStack("minecraft:arrow", 1));
            arrow.runCommand("playsound random.pop @p ~ ~ ~ 0.5 1.5");
            arrow.runCommand("event entity @s zpig:despawn");
        }
        else {
            for (let i = 0; i < pInven.size; i++) {
                const slot = pInven.getSlot(i);
                if ((slot.typeId == "minecraft:arrow") && (slot.amount < 64)) {
                    pInven.addItem(new ItemStack("minecraft:arrow", 1));
                    arrow.runCommand("playsound random.pop @p ~ ~ ~ 0.5 1.5");
                    arrow.runCommand("event entity @s zpig:despawn");
                    return;
                }
            }
        }
    }
    else if (data.id == "zpig:netherite_golem_remains_random_direction") {
        const target = data.sourceEntity;
        let randomX, randomZ;
        randomX = target.location.x + (Math.random() * 8 - 4);
        randomZ = target.location.z + (Math.random() * 8 - 4);
        target.teleport({ x: randomX, y: target.location.y, z: randomZ });
    }
});

function SubtractPlayerExpPoints(player, amount) {
    let targetAmount = Math.max(player.getTotalXp() - amount, 0);
    player.resetLevel();
    player.addExperience(targetAmount);
}

world.afterEvents.entityHitEntity.subscribe(function(data) {
    if ((data.damagingEntity.typeId == "zpig:sculk_golem") && (data.hitEntity.typeId == "minecraft:player")) {
        const golem = data.damagingEntity;
        golem.runCommand("effect @s instant_health 1 0 true");
        const player = data.hitEntity;
        let xpToTransfer = player.totalXpNeededForNextLevel * (Math.floor(Math.random() * 3) + 1);
        let xpDifference = (1395 - golem.getProperty("zpig:exp_points"))
        if (golem.getProperty("zpig:exp_points") < 1395 && player.getTotalXp() > 0) {
            if ((golem.getProperty("zpig:exp_points") + xpToTransfer) <= 1395 && (player.level > 0) && xpToTransfer <= player.getTotalXp()) {
                golem.setProperty("zpig:exp_points", golem.getProperty("zpig:exp_points") + xpToTransfer);
                golem.runCommand("particle zpig:sculk_golem_exp");
                SubtractPlayerExpPoints(player, xpToTransfer);
            }
            else if ((player.level <= 0 && (xpDifference >= player.getTotalXp())) || ((xpToTransfer >= player.getTotalXp()) && (player.getTotalXp() <= xpDifference)) ) {
                golem.setProperty("zpig:exp_points", golem.getProperty("zpig:exp_points") + player.getTotalXp());
                golem.runCommand("particle zpig:sculk_golem_exp");
                SubtractPlayerExpPoints(player, player.getTotalXp());
            }
            else {
                SubtractPlayerExpPoints(player, xpDifference);
                golem.setProperty("zpig:exp_points", (golem.getProperty("zpig:exp_points") + xpDifference));
                golem.runCommand("particle zpig:sculk_golem_exp");
            }
        }
    }
});

function SculkGolemReturnExp() {
    const allGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:sculk_golem',});
    const allGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:sculk_golem',});
    const allGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:sculk_golem',});
    const allGolems = allGolemsOverworld.concat(allGolemsNether, allGolemsEnd);
    allGolems.forEach((golem) => {
        if (golem.hasComponent("is_saddled")) {
            if (golem.getProperty("zpig:exp_points") > 0) {
                let exp_entity = golem.dimension.spawnEntity("zpig:sculk_golem_drop_exp_entity", golem.location);
                exp_entity.setProperty("zpig:exp_points", golem.getProperty("zpig:exp_points"));
                golem.resetProperty("zpig:exp_points");
            }
        }
    });
}

function GolemsWithInventoriesOnlyAllowCertainItems() {
    const allCalciteGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:calcite_golem',});
    const allCalciteGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:calcite_golem',});
    const allCalciteGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:calcite_golem',});
    const allCalciteGolems = allCalciteGolemsOverworld.concat(allCalciteGolemsNether, allCalciteGolemsEnd);

    const allDioriteGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:diorite_golem',});
    const allDioriteGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:diorite_golem',});
    const allDioriteGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:diorite_golem',});
    const allDioriteGolems = allDioriteGolemsOverworld.concat(allDioriteGolemsNether, allDioriteGolemsEnd);

    const allDirtGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:dirt_golem',});
    const allDirtGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:dirt_golem',});
    const allDirtGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:dirt_golem',});
    const allDirtGolems = allDirtGolemsOverworld.concat(allDirtGolemsNether, allDirtGolemsEnd);

    allCalciteGolems.forEach((golem) => {
        const golemInventory = golem.getComponent('inventory').container
		for (let i = 0; i < golemInventory.size; i++) {
			const slotItem = golemInventory.getItem(i);
			if (slotItem && slotItem.typeId != "minecraft:arrow") {
				golem.dimension.spawnItem(slotItem, golem.location);
				golemInventory.setItem(i, null);
			}
		}
    });
    allDioriteGolems.forEach((golem) => {
        const golemInventory = golem.getComponent('inventory').container
		for (let i = 0; i < golemInventory.size; i++) {
			const slotItem = golemInventory.getItem(i);
			if (slotItem && !((slotItem.typeId == "minecraft:chicken") ||
            (slotItem.typeId == "minecraft:beef") ||
            (slotItem.typeId == "minecraft:mutton") ||
            (slotItem.typeId == "minecraft:porkchop") ||
            (slotItem.typeId == "minecraft:rotten_flesh") ||
            (slotItem.typeId == "minecraft:bone") ||
            (slotItem.typeId == "minecraft:gunpowder") ||
            (slotItem.typeId == "minecraft:string") ||
            (slotItem.typeId == "minecraft:slime_ball") ||
            (slotItem.typeId == "minecraft:gold_nugget") ||
            (slotItem.typeId == "minecraft:emerald") ||
            (slotItem.typeId == "minecraft:ender_pearl"))) {
				golem.dimension.spawnItem(slotItem, golem.location);
				golemInventory.setItem(i, null);
			}
		}
    });
    allDirtGolems.forEach((golem) => {
        const golemInventory = golem.getComponent('inventory').container
		for (let i = 0; i < golemInventory.size; i++) {
			const slotItem = golemInventory.getItem(i);
			if (slotItem && !((slotItem.typeId == "minecraft:carrot") ||
            (slotItem.typeId == "minecraft:potato") ||
            (slotItem.typeId == "minecraft:wheat") ||
            (slotItem.typeId == "minecraft:beetroot") ||
            (slotItem.typeId == "minecraft:wheat_seeds") ||
            (slotItem.typeId == "minecraft:beetroot_seeds") ||
            (slotItem.typeId == "minecraft:bone_meal") ||
            (slotItem.typeId == "minecraft:torchflower_seeds") ||
            (slotItem.typeId == "minecraft:pitcher_pod"))) {
				golem.dimension.spawnItem(slotItem, golem.location);
				golemInventory.setItem(i, null);
			}
		}
    });
}

function BoneGolemPilotingLogic() {
    const allGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:bone_golem',});
    const allGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:bone_golem',});
    const allGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:bone_golem',});
    const allGolems = allGolemsOverworld.concat(allGolemsNether, allGolemsEnd);
    allGolems.forEach((golem) => {
        if (golem.getComponent("variant").value == 1 && !golem.hasTag("zpig:piloted")) {
            golem.addTag("zpig:piloted");
            golem.runCommand("ride @s summon_rider zpig:ride_entity");
            golem.addTag("zpig:" + golem.id);
            const pilotList = golem.dimension.getPlayers({
                excludeTags: ['zpig:pilot'],
                location: golem.location,
                closest: 1,
            });
            pilotList.forEach((pilot) => {
                pilot.addTag("zpig:pilot");
                pilot.addTag("zpig:" + golem.id);
            });
        }
        else if (golem.getComponent("variant").value == 1 && golem.hasTag("zpig:piloted")) {
            const pilotList = golem.dimension.getPlayers({
                tags: ['zpig:pilot', 'zpig:' + golem.id],
                location: golem.location,
                closest: 1,
            });
            const pilot = pilotList[0];
            golem.runCommand(`execute as @s rotated as @a [tag=zpig:${golem.id},c=1] run tp @s ~ ~ ~ facing ^ ^ ^10`);
            golem.runCommand(`execute as @s rotated as @a [tag=zpig:${golem.id},c=1] run tp @s ^ ^ ^0.25 true`);
            golem.runCommand(`execute as @a [tag=zpig:${golem.id},c=1] at @e [type=zpig:bone_golem,tag=zpig:${golem.id},c=1] rotated as @a [tag=zpig:${golem.id},c=1] run camera @s set minecraft:free ease 1 out_expo pos ^ ^1 ^-3 facing ^ ^ ^1`);
            world.afterEvents.entityDie.subscribe((data) => {
                if ((data.deadEntity.id == golem.id) || (data.deadEntity.id == pilot.id)) {
                    golem.runCommand("event entity @s zpig:no_control");
                    golem.removeTag("zpig:piloted");
                    golem.removeTag("zpig:" + golem.id);
                    golem.runCommand("ride @s evict_riders");
                    pilot.removeTag("zpig:pilot");
                    pilot.removeTag("zpig:" + golem.id);
                    pilot.runCommand("camera @s clear");
                }
            });
            world.afterEvents.playerDimensionChange.subscribe((data) => {
                if (data.player.id == pilot.id) {
                    golem.runCommand("event entity @s zpig:no_control");
                    golem.removeTag("zpig:piloted");
                    golem.removeTag("zpig:" + golem.id);
                    golem.runCommand("ride @s evict_riders");
                    pilot.removeTag("zpig:pilot");
                    pilot.removeTag("zpig:" + golem.id);
                    pilot.runCommand("camera @s clear");
                }
            });
            world.beforeEvents.playerLeave.subscribe((data) => {
                if (data.player.id == pilot.id) {
                    golem.runCommand("event entity @s zpig:no_control");
                    golem.removeTag("zpig:piloted");
                    golem.removeTag("zpig:" + golem.id);
                    golem.runCommand("ride @s evict_riders");
                    pilot.removeTag("zpig:pilot");
                    pilot.removeTag("zpig:" + golem.id);
                    pilot.runCommand("camera @s clear");
                }
            });
            if (pilot.isSneaking || !pilot.isValid() || !golem.isValid()) {
                golem.runCommand("event entity @s zpig:no_control");
                golem.removeTag("zpig:piloted");
                golem.removeTag("zpig:" + golem.id);
                golem.runCommand("ride @s evict_riders");
                pilot.removeTag("zpig:pilot");
                pilot.removeTag("zpig:" + golem.id);
                pilot.runCommandAsync("camera @s clear");
            }
        }
    });
}

function AmethystGolemEffectBroadcast() {
    const allGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:amethyst_golem',});
    const allGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:amethyst_golem',});
    const allGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:amethyst_golem',});
    const allGolems = allGolemsOverworld.concat(allGolemsNether, allGolemsEnd);
    allGolems.forEach((golem) => {
        if (golem.getComponent("variant").value > 0) {
            let range;
            if (golem.getComponent("variant").value == 1) {
                range = 2;
            }
            else if (golem.getComponent("variant").value == 2) {
                range = 3;
            }
            else if (golem.getComponent("variant").value == 3) {
                range = 4;
            }
            else if (golem.getComponent("variant").value == 4) {
                range = 5;
            }
            const validEntities = golem.dimension.getEntities({
                location: golem.location,
                maxDistance: range,
            });
            if (validEntities.length > 0) {
                let golemEffects = golem.getEffects();
                golemEffects.forEach((effect) => {
                    validEntities.forEach((target) => {
                        target.addEffect(effect.typeId, effect.duration, { amplifier: effect.amplifier });
                    });
                });
            }
        }
    });
}

function SandGolemTrapLogic() {
    const allGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:sand_golem',});
    const allGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:sand_golem',});
    const allGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:sand_golem',});
    const allGolems = allGolemsOverworld.concat(allGolemsNether, allGolemsEnd);
    allGolems.forEach((golem) => {
        if (golem.hasTag("zpig:trap_sprung")) {
            const possibleVictims = golem.dimension.getEntities({
                tags: ['zpig:trap_victim'],
                location: golem.location,
                closest: 1,
            });
            if (possibleVictims.length > 0) {
                possibleVictims.forEach((victim) => {
                    if ((Math.abs(victim.location.x - golem.location.x) < 0.65) && (Math.abs(victim.location.y - golem.location.y) < 0.65) && (Math.abs(victim.location.z - golem.location.z) < 0.65)) {
                        if ((golem.location.x != victim.location.x) || (golem.location.y != victim.location.y) || (golem.location.z != victim.location.z)) {
                            victim.teleport(golem.location);
                        }
                    }
                    else {
                        victim.runCommand("inputpermission set @s movement enabled");
                        if (golem.getComponent("skin_id").value == 1)
                            golem.runCommand("event entity @s zpig:untrap1");
                        else if (golem.getComponent("skin_id").value == 2)
                            golem.runCommand("event entity @s zpig:untrap2");
                        else if (golem.getComponent("skin_id").value == 3)
                            golem.runCommand("event entity @s zpig:untrap3");
                        else if (golem.getComponent("skin_id").value == 4)
                            golem.runCommand("event entity @s zpig:untrap4");
                    }
                });
            }
            else {
                if (golem.getComponent("skin_id").value == 1)
                    golem.runCommand("event entity @s zpig:untrap1");
                else if (golem.getComponent("skin_id").value == 2)
                    golem.runCommand("event entity @s zpig:untrap2");
                else if (golem.getComponent("skin_id").value == 3)
                    golem.runCommand("event entity @s zpig:untrap3");
                else if (golem.getComponent("skin_id").value == 4)
                    golem.runCommand("event entity @s zpig:untrap4");
            }
        }
    });
}

function UpdateObsidianGolemInventories() {
    const allGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:obsidian_golem',});
    const allGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:obsidian_golem',});
    const allGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:obsidian_golem',});
    const allGolems = allGolemsOverworld.concat(allGolemsNether, allGolemsEnd);
    if (allGolems.length > 1) {
        allGolems.forEach((golem) => {
            if (golem.hasTag("zpig:last")) {
                golem.removeTag("zpig:last");
            }
        });
    }
    else if (allGolems.length === 1) {
        allGolems.forEach((golem) => {
            if (!golem.hasTag("zpig:last")) {
                golem.addTag("zpig:last");
            }
        });
    }
    const validGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:obsidian_golem', excludeTags: ['zpig:spawn'],});
    const validGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:obsidian_golem', excludeTags: ['zpig:spawn'],});
    const validGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:obsidian_golem', excludeTags: ['zpig:spawn'],});
    const validGolems = validGolemsOverworld.concat(validGolemsNether, validGolemsEnd);
    if (validGolems.length > 1) {
        const newGolemsOverworld = world.getDimension("overworld").getEntities({type: 'zpig:obsidian_golem', tags: ['zpig:spawn'],});
        const newGolemsNether = world.getDimension("nether").getEntities({type: 'zpig:obsidian_golem', tags: ['zpig:spawn'],});
        const newGolemsEnd = world.getDimension("the_end").getEntities({type: 'zpig:obsidian_golem', tags: ['zpig:spawn'],});
        const newGolems = newGolemsOverworld.concat(newGolemsNether, newGolemsEnd);
        let inventoryCounts = new Map();
        validGolems.forEach((golem) => {
            newGolems.forEach((spawnedGolem) => {
                for (let i = 0; i < 27; i++) {
                    const goodItem = golem.getComponent('inventory').container.getItem(i);
                    spawnedGolem.getComponent('inventory').container.setItem(i, goodItem);
                }
            });
            let serializedInventory = "";
            for (let i = 0; i < 27; i++) {
                const item = golem.getComponent('inventory').container.getItem(i);
                serializedInventory += item ? item.typeId : "null";
                serializedInventory += item ? item.amount : "0";
            }
            inventoryCounts.set(serializedInventory, (inventoryCounts.get(serializedInventory) || 0) + 1);
        });
        inventoryCounts.set(fakeInventory, (inventoryCounts.get(fakeInventory) || 0) + 1);
        let uniqueSerializedInventory = [...inventoryCounts.entries()].find(([_, count]) => count === 1);
        if (uniqueSerializedInventory) {
            uniqueSerializedInventory = uniqueSerializedInventory[0];
            validGolems.forEach((validGolem) => {
                let serializedInventory = "";
                for (let i = 0; i < 27; i++) {
                    const item = validGolem.getComponent('inventory').container.getItem(i);
                    serializedInventory += item ? item.typeId : "null";
                    serializedInventory += item ? item.amount : "0";
                }
                if (serializedInventory === uniqueSerializedInventory) {
                    fakeInventory = uniqueSerializedInventory;
                    validGolems.forEach((obsidianGolem) => {
                        for (let i = 0; i < 27; i++) {
                            const uniqueItem = validGolem.getComponent('inventory').container.getItem(i);
                            obsidianGolem.getComponent('inventory').container.setItem(i, uniqueItem);
                        }
                    });
                }
            });
        }
    }
}

system.runInterval(UpdateObsidianGolemInventories, 1);

system.runInterval(SandGolemTrapLogic, 1);

system.runInterval(AmethystGolemEffectBroadcast, 1);

system.runInterval(BoneGolemPilotingLogic, 1);

system.runInterval(GolemsWithInventoriesOnlyAllowCertainItems, 1);

system.runInterval(SculkGolemReturnExp, 1);