개인 자료란 (JE)

  서버 커뮤니티

Profile ph2 대표칭호 없음

P0rnhub_com 8437300efbf74ddd9848e87807f731ea

Profile

질문하기 Java

활지급할때 내구도까인상태로 어떻게지급하나요.

2022.01.01 조회 수 93 추천 수 0
이해도 플러그인 

World world = player.getWorld();
Location location = player.getLocation();
world.dropItem(location, new ItemStack(Material.BOW, 1));

오픈소스 파일 수정중인데

내구도가 96밖에 없는 활을 주게끔 바꾸고십읍니다.

어떻게하나요 ? ?? ?? ??? ??

11개의 댓글

dontstarve
2022.01.01

저는 잘 모르겠네요

 

ph2
2022.01.01
@dontstarve

?

허두
2022.01.02
@dontstarve

?

데드풀리오
2022.01.01

https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemStack.html

-> https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/ItemMeta.html

참고하세요~

ph2
2022.01.01
@데드풀리오

오. 근데제가 뉴비라그런데. 응용법을몰라요. 읽어보니 itemmeta로 넣어야하는거같은데. 수정해주실수있나요 감사합니다.

데드풀리오
2022.01.01
@ph2
ItemStack item;
item.setDurability((short) 0);

이런식으로 하셔도 상관은 없을거같네요

ph2
2022.01.01
@데드풀리오

Deprecated.

durability is now part of ItemMeta. To avoid confusion and misuse, getItemMeta(), setItemMeta(ItemMeta) and Damageable.setDamage(int) should be used instead. This is because any call to this method will be overwritten by subsequent setting of ItemMeta which was created before this call.

Sets the durability of this item

 

선생님. item.setDurability를 넣었더니 이런 오류가뜹니다

ph2
2022.01.02
@데드풀리오

ItemStack bow=new ItemStack(Material.BOW);

World world = player.getWorld();

Location location = player.getLocation();

world.dropItem(location, new ItemStack(Material.BOW,1));

ItemMeta m=(ItemMeta) bow.getItemMeta();

Damageable

 

선생님 오류뜨는거 보고 독학으로 여기까지왔습니다 이제어쩌죠

허두
2022.01.02
@ph2

Damageable dm = (Damageable) m;

dm.setDamage(숫자);

bow.setItemMeta(dm);

 

이런식으로 하면 작동되려나요?

ph2
2022.01.02
@허두

다른분 도움 받아서 완성햇읍니다. 올려주신거랑 같은코드같네여. 감사합니다

허두
2022.01.02
@ph2

해결되셨다니 다행입니다 :)

뉴스 및 창작물
/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

/files/thumbnails/384/778/003/262x150.crop.jpg?20240512002324

업데이트

마인크래프트 자바 에디션 스냅샷 24w18a

학교가기싫다

2024-05-06

0

/files/thumbnails/855/781/003/262x150.crop.jpg?20240505141129

레드스톤

레이저 클리너

GlassesFilm

2024-05-05

1