Skip to content

Package net.minecraft.world.item.equipment.trim

Part 1/1


ArmorTrim

  • Full name: net.minecraft.world.item.equipment.trim.ArmorTrim
  • Package: net.minecraft.world.item.equipment.trim
  • Source: commonnet/minecraft/world/item/equipment/trim/ArmorTrim.java
  • Type: record
  • Modifiers: public
  • Implements: TooltipProvider

net.minecraft.world.item.equipment.trim.ArmorTrim#addToTooltip(Item.TooltipContext,Consumer<Component>,TooltipFlag)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/ArmorTrim.java:50
  • Modifiers: public
  • Return: void

คืออะไร

เพิ่ม To Tooltip

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: accept(), space(), append(), value(), copyWithStyle(), description().

Parameters

  • Item.TooltipContext tooltipContext
  • Consumer<Component> consumer
  • TooltipFlag tooltipFlag

ตัวอย่างใช้งาน

ArmorTrim instance = ...;
Item.TooltipContext tooltipContext = ...;
Consumer<Component> consumer = ...;
TooltipFlag tooltipFlag = ...;
instance.addToTooltip(tooltipContext, consumer, tooltipFlag);

net.minecraft.world.item.equipment.trim.ArmorTrim#ArmorTrim(Holder<TrimMaterial>,Holder<TrimPattern>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/ArmorTrim.java:42
  • Modifiers: public
  • Kind: constructor

คืออะไร

สร้างออบเจ็กต์ ArmorTrim ด้วยพารามิเตอร์ที่ระบุ

ทำงานยังไง

ทำงานตาม body โดยตรง (ประมาณ 1 statement).

Parameters

  • Holder<TrimMaterial> holder
  • Holder<TrimPattern> holder2

ตัวอย่างใช้งาน

Holder<TrimMaterial> holder = ...;
Holder<TrimPattern> holder2 = ...;
ArmorTrim instance = new ArmorTrim(holder, holder2);

net.minecraft.world.item.equipment.trim.ArmorTrim#hasPatternAndMaterial(Holder<TrimPattern>,Holder<TrimMaterial>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/ArmorTrim.java:46
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่ามี Pattern And Material

ทำงานยังไง

เรียกต่อ: equals(). คืนค่า: holder.equals(this.pattern) && holder2.equals(this.material).

Parameters

  • Holder<TrimPattern> holder
  • Holder<TrimMaterial> holder2

ตัวอย่างใช้งาน

ArmorTrim instance = ...;
Holder<TrimPattern> holder = ...;
Holder<TrimMaterial> holder2 = ...;
boolean result = instance.hasPatternAndMaterial(holder, holder2);

net.minecraft.world.item.equipment.trim.ArmorTrim#withTooltip(boolean)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/ArmorTrim.java:59
  • Modifiers: public
  • Return: ArmorTrim

คืออะไร

ดำเนินการ withTooltip ตาม implementation ของ ArmorTrim

ทำงานยังไง

สร้างออบเจ็กต์: ArmorTrim. คืนค่า: new ArmorTrim(this.material, this.pattern, bl).

Parameters

  • boolean bl

ตัวอย่างใช้งาน

ArmorTrim instance = ...;
ArmorTrim result = instance.withTooltip(true);

TrimMaterial

  • Full name: net.minecraft.world.item.equipment.trim.TrimMaterial
  • Package: net.minecraft.world.item.equipment.trim
  • Source: commonnet/minecraft/world/item/equipment/trim/TrimMaterial.java
  • Type: record
  • Modifiers: public

net.minecraft.world.item.equipment.trim.TrimMaterial#create(String,Item,Component,Map<ResourceKey<EquipmentAsset>, String>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimMaterial.java:50
  • Modifiers: public static
  • Return: TrimMaterial

คืออะไร

สร้าง create

ทำงานยังไง

เรียกต่อ: wrapAsHolder(). สร้างออบเจ็กต์: TrimMaterial. คืนค่า: new TrimMaterial(string, BuiltInRegistries.ITEM.wrapAsHolder(item), map, component).

Parameters

  • String string
  • Item item
  • Component component
  • Map<ResourceKey<EquipmentAsset>, String> map

ตัวอย่างใช้งาน

Item item = ...;
Component component = ...;
Map<ResourceKey<EquipmentAsset>, String> map = ...;
TrimMaterial result = TrimMaterial.create("value", item, component, map);

TrimMaterials

  • Full name: net.minecraft.world.item.equipment.trim.TrimMaterials
  • Package: net.minecraft.world.item.equipment.trim
  • Source: commonnet/minecraft/world/item/equipment/trim/TrimMaterials.java
  • Type: class
  • Modifiers: public

net.minecraft.world.item.equipment.trim.TrimMaterials#bootstrap(BootstrapContext<TrimMaterial>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimMaterials.java:33
  • Modifiers: public static
  • Return: void

คืออะไร

ดำเนินการ bootstrap ตาม implementation ของ TrimMaterials

ทำงานยังไง

เรียกต่อ: register(), withColor(), of().

Parameters

  • BootstrapContext<TrimMaterial> bootstrapContext

ตัวอย่างใช้งาน

BootstrapContext<TrimMaterial> bootstrapContext = ...;
TrimMaterials.bootstrap(bootstrapContext);

net.minecraft.world.item.equipment.trim.TrimMaterials#getFromIngredient(HolderLookup.Provider,ItemStack)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimMaterials.java:47
  • Modifiers: public static
  • Return: Optional<Holder.Reference<TrimMaterial>>

คืออะไร

อ่านค่า From Ingredient

ทำงานยังไง

เรียกต่อ: lookupOrThrow(), listElements(), filter(), is(), value(), ingredient(), findFirst(). คืนค่า: provider.lookupOrThrow(Registries.TRIM_MATERIAL).listElements().filter(reference -> itemStack.is(reference.value().ingredient())).findFirst().

Parameters

  • HolderLookup.Provider provider
  • ItemStack itemStack

ตัวอย่างใช้งาน

HolderLookup.Provider provider = ...;
ItemStack itemStack = ...;
Optional<Holder.Reference<TrimMaterial>> result = TrimMaterials.getFromIngredient(provider, itemStack);

TrimPattern

  • Full name: net.minecraft.world.item.equipment.trim.TrimPattern
  • Package: net.minecraft.world.item.equipment.trim
  • Source: commonnet/minecraft/world/item/equipment/trim/TrimPattern.java
  • Type: record
  • Modifiers: public

net.minecraft.world.item.equipment.trim.TrimPattern#copyWithStyle(Holder<TrimMaterial>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimPattern.java:40
  • Modifiers: public
  • Return: Component

คืออะไร

คัดลอก With Style

ทำงานยังไง

เรียกต่อ: copy(), withStyle(), value(), description(), getStyle(). คืนค่า: this.description.copy().withStyle(holder.value().description().getStyle()).

Parameters

  • Holder<TrimMaterial> holder

ตัวอย่างใช้งาน

TrimPattern instance = ...;
Holder<TrimMaterial> holder = ...;
Component result = instance.copyWithStyle(holder);

TrimPatterns

  • Full name: net.minecraft.world.item.equipment.trim.TrimPatterns
  • Package: net.minecraft.world.item.equipment.trim
  • Source: commonnet/minecraft/world/item/equipment/trim/TrimPatterns.java
  • Type: class
  • Modifiers: public

net.minecraft.world.item.equipment.trim.TrimPatterns#bootstrap(BootstrapContext<TrimPattern>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimPatterns.java:37
  • Modifiers: public static
  • Return: void

คืออะไร

ดำเนินการ bootstrap ตาม implementation ของ TrimPatterns

ทำงานยังไง

เรียกต่อ: register().

Parameters

  • BootstrapContext<TrimPattern> bootstrapContext

ตัวอย่างใช้งาน

BootstrapContext<TrimPattern> bootstrapContext = ...;
TrimPatterns.bootstrap(bootstrapContext);

net.minecraft.world.item.equipment.trim.TrimPatterns#getFromTemplate(HolderLookup.Provider,ItemStack)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimPatterns.java:58
  • Modifiers: public static
  • Return: Optional<Holder.Reference<TrimPattern>>

คืออะไร

อ่านค่า From Template

ทำงานยังไง

เรียกต่อ: lookupOrThrow(), listElements(), filter(), is(), value(), templateItem(), findFirst(). คืนค่า: provider.lookupOrThrow(Registries.TRIM_PATTERN).listElements().filter(reference -> itemStack.is(reference.value().templateItem())).findFirst().

Parameters

  • HolderLookup.Provider provider
  • ItemStack itemStack

ตัวอย่างใช้งาน

HolderLookup.Provider provider = ...;
ItemStack itemStack = ...;
Optional<Holder.Reference<TrimPattern>> result = TrimPatterns.getFromTemplate(provider, itemStack);

net.minecraft.world.item.equipment.trim.TrimPatterns#register(BootstrapContext<TrimPattern>,Item,ResourceKey<TrimPattern>)

  • Origin: common
  • Source: net/minecraft/world/item/equipment/trim/TrimPatterns.java:62
  • Modifiers: public static
  • Return: void

คืออะไร

ลงทะเบียน register

ทำงานยังไง

เรียกต่อ: location(), wrapAsHolder(), translatable(), makeDescriptionId(). สร้างออบเจ็กต์: TrimPattern.

Parameters

  • BootstrapContext<TrimPattern> bootstrapContext
  • Item item
  • ResourceKey<TrimPattern> resourceKey

ตัวอย่างใช้งาน

BootstrapContext<TrimPattern> bootstrapContext = ...;
Item item = ...;
ResourceKey<TrimPattern> resourceKey = ...;
TrimPatterns.register(bootstrapContext, item, resourceKey);