블록을 깨면 그 위치에 좀비가 나오게 코딩

2025. 3. 19. 22:27마인크래프트

    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Location loc = event.getBlock().getLocation();
        World world = loc.getWorld();
        if (world != null) {
            Zombie zombie = (Zombie) world.spawnEntity(loc.add(0.5, 0, 0.5), EntityType.ZOMBIE);
            zombie.setCustomName("Block Guardian");
            zombie.setCustomNameVisible(true);
        }
    }