dev.polymodloader.api.inventory
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
InventoryView | 인터페이스 | Slots of an inventory, such as a mod block entity's. |
ItemStackRef | 인터페이스 | A live item stack in a slot or a hand: changes apply to the game's stack directly. |
ItemStackView | 레코드 | An item and a count; a snapshot, so changing the inventory does not change it. |
InventoryView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface InventoryView
Slots of an inventory, such as a mod block entity's. Changes are saved with the world. Same thread rules as WorldView.
size()
int size()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Number of slots.
반환 int
get(int)
ItemStackView get(int slot)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The stack in slot; IndexOutOfBoundsException for a bad slot.
| 인자 | 타입 | 설명 |
|---|---|---|
slot | int | — |
반환 ItemStackView
set(int, ResourceId, int)
void set(int slot, ResourceId item, int count)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Replaces the stack in slot; a count of 0 empties it.
| 인자 | 타입 | 설명 |
|---|---|---|
slot | int | — |
item | ResourceId | — |
count | int | — |
예외 IllegalArgumentException — for an unknown item or a count above the item's stack size
add(ResourceId, int)
int add(ResourceId item, int count)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds items to existing stacks first, then to empty slots.
| 인자 | 타입 | 설명 |
|---|---|---|
item | ResourceId | — |
count | int | — |
반환 int — how many did not fit
count(ResourceId)
int count(ResourceId item)
추가된 버전 0.1.0-alpha.4 또는 그 이전
How many of item the inventory holds.
| 인자 | 타입 | 설명 |
|---|---|---|
item | ResourceId | — |
반환 int
stackAt(int)
ItemStackRef stackAt(int slot)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The live stack in slot, to read or change its components.
| 인자 | 타입 | 설명 |
|---|---|---|
slot | int | — |
반환 ItemStackRef
clear()
void clear()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Empties every slot.
ItemStackRef
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ItemStackRef
A live item stack in a slot or a hand: changes apply to the game's stack directly. Valid during the callback that handed it out; same thread rules as WorldView. Change stacks on the server; client changes are overwritten by the server's copy.
item()
ResourceId item()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The item, minecraft:air when empty.
반환 ResourceId
count()
int count()
추가된 버전 0.1.0-alpha.4 또는 그 이전
How many, 0 when empty.
반환 int
isEmpty()
default boolean isEmpty()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the stack is empty.
반환 boolean
isIn(TagKey)
boolean isIn(TagKey tag)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the stack's item is in an item tag, for example #minecraft:logs; false for an empty stack.
| 인자 | 타입 | 설명 |
|---|---|---|
tag | TagKey | — |
반환 boolean
예외 IllegalArgumentException — when tag is not an item tag
setCount(int)
void setCount(int count)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Changes the count; 0 empties the stack.
| 인자 | 타입 | 설명 |
|---|---|---|
count | int | — |
예외 IllegalArgumentException — for a negative count or one above the stack size
get(ItemComponentKey<T>)
<T> Optional<T> get(ItemComponentKey<T> key)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The component's value, or empty when the stack does not have it.
| 인자 | 타입 | 설명 |
|---|---|---|
key | ItemComponentKey<T> | — |
반환 Optional<T>
set(ItemComponentKey<T>, T)
<T> void set(ItemComponentKey<T> key, T value)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the component's value.
| 인자 | 타입 | 설명 |
|---|---|---|
key | ItemComponentKey<T> | — |
value | T | — |
예외 IllegalArgumentException — for a key that is not registered
예외 IllegalStateException — on an empty stack
remove(ItemComponentKey<?>)
void remove(ItemComponentKey<?> key)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Removes the component.
| 인자 | 타입 | 설명 |
|---|---|---|
key | ItemComponentKey<?> | — |
customName()
Optional<String> customName()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The name given with an anvil or setCustomName, if any.
반환 Optional<String>
setCustomName(String)
void setCustomName(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Gives the stack a name, or removes it with null.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
damage()
int damage()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Durability used up, 0 for undamaged or undamageable items.
반환 int
maxDamage()
int maxDamage()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Durability, 0 for undamageable items.
반환 int
setDamage(int)
void setDamage(int damage)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the used durability, clamped to [0, maxDamage].
| 인자 | 타입 | 설명 |
|---|---|---|
damage | int | — |
snapshot()
ItemStackView snapshot()
추가된 버전 0.1.0-alpha.4 또는 그 이전
A snapshot of item and count.
반환 ItemStackView
ItemStackView
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ItemStackView(ResourceId item, int count)
An item and a count; a snapshot, so changing the inventory does not change it.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
item | ResourceId | the item, minecraft:air for an empty slot |
count | int | how many, 0 for an empty slot |
| 상수·필드 | 타입 | 설명 |
|---|---|---|
EMPTY | ItemStackView | An empty slot. |
isEmpty()
public boolean isEmpty()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the slot is empty.
반환 boolean