개인 자료란 (JE)

  서버 커뮤니티

Profile 똠또 대표칭호 없음
Profile

질문하기 플러그인

몬스터를 발사하는 플러그인

14 일 전 조회 수 19 추천 수 0
이해도 초보자 
게임버전 (JE) 1.20.1 
게임버전 (BE) 1.20.x 

    @EventHandler
    public void gun2(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        ItemStack itemStack = player.getInventory().getItemInMainHand();
        if (event.getAction() == Action.LEFT_CLICK_AIR) {
            if (itemStack.getType() == Material.STICK && itemStack.getItemMeta().getPersistentDataContainer().has(getkey("vendal"), PersistentDataType.STRING)) {
                player.playSound(player.getLocation(), Sound.ENTITY_ARROW_SHOOT, 1.0f, 1.0f);
                Location location = player.getLocation().add(0, 1.5, 0);
                Vector direction = player.getLocation().getDirection();
                World world = location.getWorld();
                Slime slime = (Slime) world.spawnEntity(location, EntityType.SLIME);
                slime.setSize(1);
                slime.setAI(false);
                slime.getPersistentDataContainer().set(new NamespacedKey(this, "bullet"), PersistentDataType.STRING, "true");
                slime.setVelocity(direction.multiply(2));

                new BukkitRunnable() {
                    @Override
                    public void run(){
                       if (slime.getPersistentDataContainer().has(new NamespacedKey(Valorant.this,"bullet"),PersistentDataType.STRING));
                    slime.remove();
                    }
                }.runTaskLater(this,100L);
            }
        }
    }
    private NamespacedKey getkey(String tag){
        return new NamespacedKey(this,tag);
    }
}

이코드에서 슬라임이 생성되고 5초뒤 사라지는 것 까지는 되는데 발사가 안되요 해결방법좀 알려주세욤

Warning
댓글이 없습니다.

새로운 댓글을 등록해 주세요!

뉴스 및 창작물
/files/thumbnails/841/773/003/262x150.crop.jpg?20240526120908

레드스톤

마인크래프트 노트블록버전 『 봄을 고하다 (春を告げる) 』 [더블옥타브 버전]

노트블럭전문가

2024-05-26

0

/files/thumbnails/712/796/003/262x150.crop.jpg?20240525085438

레드스톤

마인크래프트 노트블록으로 만든 『 봄을 고하다 (春を告げる) 』 1

Sonttukk

2024-05-25

0

/files/thumbnails/268/789/003/262x150.crop.jpg?20240515192032

레드스톤

벌레먹은 돌 빠르게 제거하는 법

GlassesFilm

2024-05-15

0

/files/thumbnails/797/788/003/262x150.crop.jpg?20240515090924

건축

마인크래프트로 구현한 카르카손 보드게임

Warak

2024-05-15

1

/files/thumbnails/487/784/003/262x150.crop.jpg?20240508233607

모드

Windows Borderless 모드에서 악성코드 발견 3

학교가기싫다

2024-05-08

1