본문으로 건너뛰기
버전: Minecraft 26.2

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.

인자타입설명
slotint—

반환 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.

인자타입설명
slotint—
itemResourceId—
countint—

예외 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.

인자타입설명
itemResourceId—
countint—

반환 int — how many did not fit

count(ResourceId)​

int count(ResourceId item)

추가된 버전 0.1.0-alpha.4 또는 그 이전

How many of item the inventory holds.

인자타입설명
itemResourceId—

반환 int

stackAt(int)​

ItemStackRef stackAt(int slot)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The live stack in slot, to read or change its components.

인자타입설명
slotint—

반환 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.

인자타입설명
tagTagKey—

반환 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.

인자타입설명
countint—

예외 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.

인자타입설명
keyItemComponentKey<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.

인자타입설명
keyItemComponentKey<T>—
valueT—

예외 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.

인자타입설명
keyItemComponentKey<?>—

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.

인자타입설명
nameString—

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].

인자타입설명
damageint—

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.

구성 요소타입설명
itemResourceIdthe item, minecraft:air for an empty slot
countinthow many, 0 for an empty slot
상수·필드타입설명
EMPTYItemStackViewAn empty slot.

isEmpty()​

public boolean isEmpty()

추가된 버전 0.1.0-alpha.4 또는 그 이전

Whether the slot is empty.

반환 boolean

Buy me a coffee