记录类 VillagerData
java.lang.Object
java.lang.Record
net.minecraft.world.entity.npc.VillagerData
public record VillagerData(Holder<VillagerType> type, Holder<VillagerProfession> profession, int level)
extends Record
-
字段概要
字段修饰符和类型字段说明static final com.mojang.serialization.Codec
<VillagerData> private final int
level
记录组件的字段。static final int
static final int
private static final int[]
private final Holder
<VillagerProfession> profession
记录组件的字段。static final StreamCodec
<RegistryFriendlyByteBuf, VillagerData> private final Holder
<VillagerType> type
记录组件的字段。 -
构造器概要
构造器构造器说明VillagerData
(Holder<VillagerType> type, Holder<VillagerProfession> profession, int level) 创建VillagerData
记录类的实例。 -
方法概要
修饰符和类型方法说明static boolean
canLevelUp
(int p_35583_) final boolean
指示某个其他对象是否“等于”此对象。static int
getMaxXpPerLevel
(int p_35578_) static int
getMinXpPerLevel
(int p_35573_) final int
hashCode()
返回此对象的哈希代码值。int
level()
返回level
记录组件的值。返回profession
记录组件的值。final String
toString()
返回此记录类的字符串表示形式。type()
返回type
记录组件的值。withLevel
(int p_397082_) withProfession
(Holder<VillagerProfession> p_397154_) withProfession
(HolderGetter.Provider p_397368_, ResourceKey<VillagerProfession> p_396992_) withType
(Holder<VillagerType> p_396986_) withType
(HolderGetter.Provider p_397285_, ResourceKey<VillagerType> p_397400_)
-
字段详细资料
-
type
type
记录组件的字段。 -
profession
profession
记录组件的字段。 -
level
private final int levellevel
记录组件的字段。 -
MIN_VILLAGER_LEVEL
public static final int MIN_VILLAGER_LEVEL- 另请参阅:
-
MAX_VILLAGER_LEVEL
public static final int MAX_VILLAGER_LEVEL- 另请参阅:
-
NEXT_LEVEL_XP_THRESHOLDS
private static final int[] NEXT_LEVEL_XP_THRESHOLDS -
CODEC
-
STREAM_CODEC
-
-
构造器详细资料
-
VillagerData
创建VillagerData
记录类的实例。- 参数:
type
-type
记录组件的值profession
-profession
记录组件的值level
-level
记录组件的值
-
-
方法详细资料
-
withType
-
withType
-
withProfession
-
withProfession
public VillagerData withProfession(HolderGetter.Provider p_397368_, ResourceKey<VillagerProfession> p_396992_) -
withLevel
-
getMinXpPerLevel
public static int getMinXpPerLevel(int p_35573_) -
getMaxXpPerLevel
public static int getMaxXpPerLevel(int p_35578_) -
canLevelUp
public static boolean canLevelUp(int p_35583_) -
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 使用Objects::equals(Object,Object)
对参考组件进行比较;使用 '==' 对基元组件进行比较 -
type
返回type
记录组件的值。- 返回:
type
记录组件的值
-
profession
返回profession
记录组件的值。- 返回:
profession
记录组件的值
-
level
public int level()返回level
记录组件的值。- 返回:
level
记录组件的值
-