Package net.minecraft.world.food
Part 1/1
FoodConstants
- Full name:
net.minecraft.world.food.FoodConstants - Package:
net.minecraft.world.food - Source:
common—net/minecraft/world/food/FoodConstants.java - Type:
class - Modifiers:
public
net.minecraft.world.food.FoodConstants#saturationByModifier(int,float)
- Origin:
common - Source:
net/minecraft/world/food/FoodConstants.java:30 - Modifiers:
public static - Return:
float
คืออะไร
ดำเนินการ saturationByModifier ตาม implementation ของ FoodConstants
ทำงานยังไง
คืนค่า: i * f * 2.0F.
Parameters
int ifloat f
ตัวอย่างใช้งาน
FoodData
- Full name:
net.minecraft.world.food.FoodData - Package:
net.minecraft.world.food - Source:
common—net/minecraft/world/food/FoodData.java - Type:
class - Modifiers:
public
net.minecraft.world.food.FoodData#addAdditionalSaveData(CompoundTag)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:80 - Modifiers:
public - Return:
void
คืออะไร
เพิ่ม Additional Save Data
ทำงานยังไง
เรียกต่อ: putInt(), putFloat().
Parameters
CompoundTag compoundTag
ตัวอย่างใช้งาน
FoodData instance = ...;
CompoundTag compoundTag = ...;
instance.addAdditionalSaveData(compoundTag);
net.minecraft.world.food.FoodData#addExhaustion(float)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:95 - Modifiers:
public - Return:
void
คืออะไร
เพิ่ม Exhaustion
ทำงานยังไง
แก้ state: exhaustionLevel. เรียกต่อ: min().
Parameters
float f
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#eat(FoodProperties)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:25 - Modifiers:
public - Return:
void
คืออะไร
ดำเนินการ eat ตาม implementation ของ FoodData
ทำงานยังไง
เรียกต่อ: add(), nutrition(), saturation().
Parameters
FoodProperties foodProperties
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#eat(int,float)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:21 - Modifiers:
public - Return:
void
คืออะไร
ดำเนินการ eat ตาม implementation ของ FoodData
ทำงานยังไง
เรียกต่อ: add(), saturationByModifier().
Parameters
int ifloat f
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#getFoodLevel()
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:87 - Modifiers:
public - Return:
int
คืออะไร
อ่านค่า Food Level
ทำงานยังไง
คืนค่า: this.foodLevel.
Parameters
- ไม่มี
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#getSaturationLevel()
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:99 - Modifiers:
public - Return:
float
คืออะไร
อ่านค่า Saturation Level
ทำงานยังไง
คืนค่า: this.saturationLevel.
Parameters
- ไม่มี
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#needsFood()
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:91 - Modifiers:
public - Return:
boolean
คืออะไร
ดำเนินการ needsFood ตาม implementation ของ FoodData
ทำงานยังไง
คืนค่า: this.foodLevel < 20.
Parameters
- ไม่มี
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#readAdditionalSaveData(CompoundTag)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:71 - Modifiers:
public - Return:
void
คืออะไร
อ่าน Additional Save Data
ทำงานยังไง
ตรวจเงื่อนไขด้วย if. แก้ state: foodLevel, tickTimer, saturationLevel, exhaustionLevel. เรียกต่อ: contains(), getInt(), getFloat().
Parameters
CompoundTag compoundTag
ตัวอย่างใช้งาน
FoodData instance = ...;
CompoundTag compoundTag = ...;
instance.readAdditionalSaveData(compoundTag);
net.minecraft.world.food.FoodData#setFoodLevel(int)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:103 - Modifiers:
public - Return:
void
คืออะไร
กำหนดค่า Food Level
ทำงานยังไง
แก้ state: foodLevel.
Parameters
int i
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#setSaturation(float)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:107 - Modifiers:
public - Return:
void
คืออะไร
กำหนดค่า Saturation
ทำงานยังไง
แก้ state: saturationLevel.
Parameters
float f
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodData#tick(ServerPlayer)
- Origin:
common - Source:
net/minecraft/world/food/FoodData.java:29 - Modifiers:
public - Return:
void
คืออะไร
ประมวลผล tick tick
ทำงานยังไง
ตรวจเงื่อนไขด้วย if. แก้ state: exhaustionLevel, saturationLevel, foodLevel, tickTimer. เรียกต่อ: serverLevel(), getDifficulty(), max(), getGameRules(), getBoolean(), isHurt(), min(), heal().
Parameters
ServerPlayer serverPlayer
ตัวอย่างใช้งาน
FoodProperties
- Full name:
net.minecraft.world.food.FoodProperties - Package:
net.minecraft.world.food - Source:
common—net/minecraft/world/food/FoodProperties.java - Type:
record - Modifiers:
public - Implements:
ConsumableListener
net.minecraft.world.food.FoodProperties#onConsume(Level,LivingEntity,ItemStack,Consumable)
- Origin:
common - Source:
net/minecraft/world/food/FoodProperties.java:39 - Modifiers:
public - Return:
void
คืออะไร
จัดการเหตุการณ์ Consume
ทำงานยังไง
ตรวจเงื่อนไขด้วย if. เรียกต่อ: getRandom(), playSound(), getX(), getY(), getZ(), sound(), value(), triangle().
Parameters
Level levelLivingEntity livingEntityItemStack itemStackConsumable consumable
ตัวอย่างใช้งาน
FoodProperties instance = ...;
Level level = ...;
LivingEntity livingEntity = ...;
ItemStack itemStack = ...;
Consumable consumable = ...;
instance.onConsume(level, livingEntity, itemStack, consumable);
FoodProperties$Builder
- Full name:
net.minecraft.world.food.FoodProperties$Builder - Package:
net.minecraft.world.food - Source:
common—net/minecraft/world/food/FoodProperties.java - Type:
class - Modifiers:
public static
net.minecraft.world.food.FoodProperties$Builder#alwaysEdible()
- Origin:
common - Source:
net/minecraft/world/food/FoodProperties.java:75 - Modifiers:
public - Return:
FoodProperties.Builder
คืออะไร
ดำเนินการ alwaysEdible ตาม implementation ของ FoodProperties$Builder
ทำงานยังไง
แก้ state: canAlwaysEat. คืนค่า: this.
Parameters
- ไม่มี
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodProperties$Builder#build()
- Origin:
common - Source:
net/minecraft/world/food/FoodProperties.java:80 - Modifiers:
public - Return:
FoodProperties
คืออะไร
สร้าง build
ทำงานยังไง
เรียกต่อ: saturationByModifier(). สร้างออบเจ็กต์: FoodProperties. คืนค่า: new FoodProperties(this.nutrition, f, this.canAlwaysEat).
Parameters
- ไม่มี
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodProperties$Builder#nutrition(int)
- Origin:
common - Source:
net/minecraft/world/food/FoodProperties.java:65 - Modifiers:
public - Return:
FoodProperties.Builder
คืออะไร
ดำเนินการ nutrition ตาม implementation ของ FoodProperties$Builder
ทำงานยังไง
แก้ state: nutrition. คืนค่า: this.
Parameters
int i
ตัวอย่างใช้งาน
net.minecraft.world.food.FoodProperties$Builder#saturationModifier(float)
- Origin:
common - Source:
net/minecraft/world/food/FoodProperties.java:70 - Modifiers:
public - Return:
FoodProperties.Builder
คืออะไร
ดำเนินการ saturationModifier ตาม implementation ของ FoodProperties$Builder
ทำงานยังไง
แก้ state: saturationModifier. คืนค่า: this.
Parameters
float f
ตัวอย่างใช้งาน
FoodProperties.Builder instance = ...;
FoodProperties.Builder result = instance.saturationModifier(0.0F);