dev.polymodloader.api.content.item
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
ComponentType | 클래스 | The value type of an ItemComponentKey. |
FoodDefinition | 레코드 | Makes an item edible. |
ItemBehavior | 인터페이스 | Code that runs when a mod item is used. |
ItemComponentKey | 레코드 | A data component that mods attach to item stacks, such as a charge level or an owner's name. |
ItemDefinition | 레코드 | Properties of a mod item or block item. |
ItemDefinition.Builder | 클래스 | Builds an ItemDefinition. |
ItemHandle | 인터페이스 | A declared item. |
ItemRarity | 열거형 | Name colour of an item. |
ItemUse | 레코드 | A player using (right-clicking) a mod item in the air. |
ComponentType
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class ComponentType<T>
The value type of an ItemComponentKey.
| 상수·필드 | 타입 | 설명 |
|---|---|---|
INTEGER | ComponentType<Integer> | A whole number. |
BOOLEAN | ComponentType<Boolean> | true or false. |
STRING | ComponentType<String> | Text. |
TREE | ComponentType<DataTree> | A DataTree; stored and returned as copies. |
valueClass()
public Class<T> valueClass()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Java type of the value.
반환 Class<T>
FoodDefinition
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record FoodDefinition(int nutrition, float saturation, boolean alwaysEdible)
Makes an item edible.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
nutrition | int | hunger points restored (bread: 5) |
saturation | float | saturation modifier (bread: 0.6) |
alwaysEdible | boolean | whether it can be eaten with a full hunger bar |
ItemBehavior
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ItemBehavior
Code that runs when a mod item is used. Same thread and failure rules as BlockBehavior.
onUse(ItemUse)
default InteractionResult onUse(ItemUse use)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The item was used in the air. Returning InteractionResult.PASS keeps the game's default (for example eating, for food items).
| 인자 | 타입 | 설명 |
|---|---|---|
use | ItemUse | — |
반환 InteractionResult
ItemComponentKey
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ItemComponentKey<T>(ResourceId id, ComponentType<T> type)
A data component that mods attach to item stacks, such as a charge level or an owner's name. The value is saved with the stack, copied with it, shown in /give syntax as <id>=<value>, and synchronised to clients. Stacks with different values do not stack. Obtain keys from ContentRegistrar.itemComponent.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
id | ResourceId | component ID, <mod id>:<path> |
type | ComponentType<T> | value type |
ItemDefinition
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ItemDefinition(int maxStackSize, int durability, boolean fireResistant, ItemRarity rarity, Optional<FoodDefinition> food, Optional<CreativeTab> creativeTab, ItemBehavior behavior)
Properties of a mod item or block item. Created with builder(); immutable.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
maxStackSize | int | 1–99; items with durability always stack to 1 |
durability | int | uses before breaking, 0 for none |
fireResistant | boolean | whether the dropped item survives fire and lava |
rarity | ItemRarity | name colour |
food | Optional<FoodDefinition> | what eating it does, or empty when it is not food |
creativeTab | Optional<CreativeTab> | creative inventory tab to list it in, or empty |
behavior | ItemBehavior | use callbacks; ignored for block items |
builder()
public static ItemDefinition.Builder builder()
추가된 버전 0.1.0-alpha.4 또는 그 이전
A builder for a common item stacking to 64, listed in no tab.
반환 ItemDefinition.Builder
ItemDefinition.Builder
클래스 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static final class Builder
Builds an ItemDefinition.
maxStackSize(int)
public ItemDefinition.Builder maxStackSize(int maxStackSize)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the maximum stack size, 1–99.
| 인자 | 타입 | 설명 |
|---|---|---|
maxStackSize | int | — |
반환 ItemDefinition.Builder
durability(int)
public ItemDefinition.Builder durability(int durability)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Gives the item durability; also sets the stack size to 1.
| 인자 | 타입 | 설명 |
|---|---|---|
durability | int | — |
반환 ItemDefinition.Builder
fireResistant()
public ItemDefinition.Builder fireResistant()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The dropped item survives fire and lava.
반환 ItemDefinition.Builder
rarity(ItemRarity)
public ItemDefinition.Builder rarity(ItemRarity rarity)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the name colour.
| 인자 | 타입 | 설명 |
|---|---|---|
rarity | ItemRarity | — |
반환 ItemDefinition.Builder
food(FoodDefinition)
public ItemDefinition.Builder food(FoodDefinition food)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Makes the item edible.
| 인자 | 타입 | 설명 |
|---|---|---|
food | FoodDefinition | — |
반환 ItemDefinition.Builder
creativeTab(CreativeTab)
public ItemDefinition.Builder creativeTab(CreativeTab tab)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Lists the item at the end of a creative inventory tab.
| 인자 | 타입 | 설명 |
|---|---|---|
tab | CreativeTab | — |
반환 ItemDefinition.Builder
behavior(ItemBehavior)
public ItemDefinition.Builder behavior(ItemBehavior behavior)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the use callbacks.
| 인자 | 타입 | 설명 |
|---|---|---|
behavior | ItemBehavior | — |
반환 ItemDefinition.Builder
build()
public ItemDefinition build()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Creates the definition; invalid values throw IllegalArgumentException.
반환 ItemDefinition
ItemHandle
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ItemHandle extends ContentHandle
A declared item.
상위 형식: ContentHandle
ItemRarity
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum ItemRarity
Name colour of an item.
| 상수 | 설명 |
|---|---|
COMMON | — |
UNCOMMON | — |
RARE | — |
EPIC | — |
ItemUse
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ItemUse(WorldView world, PlayerView player, ItemStackRef stack)
A player using (right-clicking) a mod item in the air.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
world | WorldView | the world, client or server copy |
player | PlayerView | the player holding the item |
stack | ItemStackRef | the used stack, live |