Skip to content

Package net.minecraft.world.entity.npc

Part 1/1


AbstractVillager

  • Full name: net.minecraft.world.entity.npc.AbstractVillager
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/AbstractVillager.java
  • Type: class
  • Modifiers: public abstract
  • Extends: AgeableMob
  • Implements: InventoryCarrier,Npc,Merchant

net.minecraft.world.entity.npc.AbstractVillager#AbstractVillager(EntityType<? extends AbstractVillager>,Level)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:51
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • EntityType<? extends AbstractVillager> entityType
  • Level level

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

EntityType<? extends AbstractVillager> entityType = ...;
Level level = ...;
AbstractVillager instance = new AbstractVillager(entityType, level);

net.minecraft.world.entity.npc.AbstractVillager#addAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:162
  • Modifiers: public
  • Return: void

คืออะไร

เพิ่ม Additional Save Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), getOffers(), isEmpty(), put(), encodeStart(), registryAccess(), createSerializationContext(), getOrThrow().

Parameters

  • CompoundTag compoundTag

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

AbstractVillager instance = ...;
CompoundTag compoundTag = ...;
instance.addAdditionalSaveData(compoundTag);

net.minecraft.world.entity.npc.AbstractVillager#addOffersFromItemListings(MerchantOffers,VillagerTrades.ItemListing[],int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:232
  • Modifiers: protected
  • Return: void

คืออะไร

เพิ่ม Offers From Item Listings

ทำงานยังไง

ตรวจเงื่อนไขด้วย if ; มีการวนลูป. เรียกต่อ: newArrayList(), isEmpty(), remove(), nextInt(), size(), getOffer(), add().

Parameters

  • MerchantOffers merchantOffers
  • VillagerTrades.ItemListing[] itemListings
  • int i

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

MerchantOffers merchantOffers = ...;
VillagerTrades.ItemListing[] itemListings = ...;
@Override
protected void addOffersFromItemListings(MerchantOffers merchantOffers, VillagerTrades.ItemListing[] itemListings, int i) {
    super.addOffersFromItemListings(merchantOffers, itemListings, i);
}

net.minecraft.world.entity.npc.AbstractVillager#addParticlesAroundSelf(ParticleOptions)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:205
  • Modifiers: protected
  • Return: void

คืออะไร

เพิ่ม Particles Around Self

ทำงานยังไง

มีการวนลูป. เรียกต่อ: nextGaussian(), level(), addParticle(), getRandomX(), getRandomY(), getRandomZ().

Parameters

  • ParticleOptions particleOptions

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

ParticleOptions particleOptions = ...;
@Override
protected void addParticlesAroundSelf(ParticleOptions particleOptions) {
    super.addParticlesAroundSelf(particleOptions);
}

net.minecraft.world.entity.npc.AbstractVillager#canBeLeashed()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:214
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่าสามารถ Be Leashed

ทำงานยังไง

คืนค่า: false.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
boolean result = instance.canBeLeashed();

net.minecraft.world.entity.npc.AbstractVillager#defineSynchedData(SynchedEntityData.Builder)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:81
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ defineSynchedData ตาม implementation ของ AbstractVillager

ทำงานยังไง

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

Parameters

  • SynchedEntityData.Builder builder

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

SynchedEntityData.Builder builder = ...;
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
    super.defineSynchedData(builder);
}

net.minecraft.world.entity.npc.AbstractVillager#die(DamageSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:199
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ die ตาม implementation ของ AbstractVillager

ทำงานยังไง

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

Parameters

  • DamageSource damageSource

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

AbstractVillager instance = ...;
DamageSource damageSource = ...;
instance.die(damageSource);

net.minecraft.world.entity.npc.AbstractVillager#finalizeSpawn(ServerLevelAccessor,DifficultyInstance,EntitySpawnReason,SpawnGroupData)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:57
  • Modifiers: public
  • Return: SpawnGroupData

คืออะไร

ดำเนินการ finalizeSpawn ตาม implementation ของ AbstractVillager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: AgeableMobGroupData(). สร้างออบเจ็กต์: AgeableMob.AgeableMobGroupData. คืนค่า: super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData).

Parameters

  • ServerLevelAccessor serverLevelAccessor
  • DifficultyInstance difficultyInstance
  • EntitySpawnReason entitySpawnReason
  • SpawnGroupData spawnGroupData

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

AbstractVillager instance = ...;
ServerLevelAccessor serverLevelAccessor = ...;
DifficultyInstance difficultyInstance = ...;
EntitySpawnReason entitySpawnReason = ...;
SpawnGroupData spawnGroupData = ...;
SpawnGroupData result = instance.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData);

net.minecraft.world.entity.npc.AbstractVillager#getInventory()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:219
  • Modifiers: public
  • Return: SimpleContainer

คืออะไร

อ่านค่า Inventory

ทำงานยังไง

คืนค่า: this.inventory.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
SimpleContainer result = instance.getInventory();

net.minecraft.world.entity.npc.AbstractVillager#getNotifyTradeSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:149
  • Modifiers: public
  • Return: SoundEvent

คืออะไร

อ่านค่า Notify Trade Sound

ทำงานยังไง

คืนค่า: SoundEvents.VILLAGER_YES.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
SoundEvent result = instance.getNotifyTradeSound();

net.minecraft.world.entity.npc.AbstractVillager#getOffers()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:102
  • Modifiers: public
  • Return: MerchantOffers

คืออะไร

อ่านค่า Offers

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: offers. เรียกต่อ: level(), updateTrades(). สร้างออบเจ็กต์: IllegalStateException, MerchantOffers. คืนค่า: this.offers.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
MerchantOffers result = instance.getOffers();

net.minecraft.world.entity.npc.AbstractVillager#getRopeHoldPosition(float)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:245
  • Modifiers: public
  • Return: Vec3

คืออะไร

อ่านค่า Rope Hold Position

ทำงานยังไง

เรียกต่อ: lerp(), getBoundingBox(), getYsize(), getPosition(), add(), yRot(). สร้างออบเจ็กต์: Vec3. คืนค่า: this.getPosition(f).add(vec3.yRot(-g)).

Parameters

  • float f

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

AbstractVillager instance = ...;
Vec3 result = instance.getRopeHoldPosition(0.0F);

net.minecraft.world.entity.npc.AbstractVillager#getSlot(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:224
  • Modifiers: public
  • Return: SlotAccess

คืออะไร

อ่านค่า Slot

ทำงานยังไง

เรียกต่อ: getContainerSize(), forContainer(). คืนค่า: j >= 0 && j < this.inventory.getContainerSize() ? SlotAccess.forContainer(this.inventory, j) : super.getSlot(i).

Parameters

  • int i

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

AbstractVillager instance = ...;
SlotAccess result = instance.getSlot(0);

net.minecraft.world.entity.npc.AbstractVillager#getTradeUpdatedSound(boolean)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:154
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Trade Updated Sound

ทำงานยังไง

คืนค่า: bl ? SoundEvents.VILLAGER_YES : SoundEvents.VILLAGER_NO.

Parameters

  • boolean bl

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

@Override
protected SoundEvent getTradeUpdatedSound(boolean bl) {
    return super.getTradeUpdatedSound(bl);
}

net.minecraft.world.entity.npc.AbstractVillager#getTradingPlayer()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:92
  • Modifiers: public
  • Return: Player

คืออะไร

อ่านค่า Trading Player

ทำงานยังไง

คืนค่า: this.tradingPlayer.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
Player result = instance.getTradingPlayer();

net.minecraft.world.entity.npc.AbstractVillager#getUnhappyCounter()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:68
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Unhappy Counter

ทำงานยังไง

เรียกต่อ: get(). คืนค่า: this.entityData.get(DATA_UNHAPPY_COUNTER).

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
int result = instance.getUnhappyCounter();

net.minecraft.world.entity.npc.AbstractVillager#getVillagerXp()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:76
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Villager Xp

ทำงานยังไง

คืนค่า: 0.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
int result = instance.getVillagerXp();

net.minecraft.world.entity.npc.AbstractVillager#isClientSide()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:252
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Client Side

ทำงานยังไง

เรียกต่อ: level(). คืนค่า: this.level().isClientSide.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
boolean result = instance.isClientSide();

net.minecraft.world.entity.npc.AbstractVillager#isTrading()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:98
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Trading

ทำงานยังไง

คืนค่า: this.tradingPlayer != null.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
boolean result = instance.isTrading();

net.minecraft.world.entity.npc.AbstractVillager#notifyTrade(MerchantOffer)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:124
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ notifyTrade ตาม implementation ของ AbstractVillager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: ambientSoundTime. เรียกต่อ: increaseUses(), getAmbientSoundInterval(), rewardTradeXp(), trigger(), getResult().

Parameters

  • MerchantOffer merchantOffer

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

AbstractVillager instance = ...;
MerchantOffer merchantOffer = ...;
instance.notifyTrade(merchantOffer);

net.minecraft.world.entity.npc.AbstractVillager#notifyTradeUpdated(ItemStack)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:141
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ notifyTradeUpdated ตาม implementation ของ AbstractVillager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: ambientSoundTime. เรียกต่อ: level(), getAmbientSoundInterval(), makeSound(), getTradeUpdatedSound(), isEmpty().

Parameters

  • ItemStack itemStack

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

AbstractVillager instance = ...;
ItemStack itemStack = ...;
instance.notifyTradeUpdated(itemStack);

net.minecraft.world.entity.npc.AbstractVillager#overrideOffers(MerchantOffers)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:116
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ overrideOffers ตาม implementation ของ AbstractVillager

ทำงานยังไง

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

Parameters

  • MerchantOffers merchantOffers

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

AbstractVillager instance = ...;
MerchantOffers merchantOffers = ...;
instance.overrideOffers(merchantOffers);

net.minecraft.world.entity.npc.AbstractVillager#overrideXp(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:120
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ overrideXp ตาม implementation ของ AbstractVillager

ทำงานยังไง

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

Parameters

  • int i

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

AbstractVillager instance = ...;
instance.overrideXp(0);

net.minecraft.world.entity.npc.AbstractVillager#playCelebrateSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:158
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ playCelebrateSound ตาม implementation ของ AbstractVillager

ทำงานยังไง

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

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
instance.playCelebrateSound();

net.minecraft.world.entity.npc.AbstractVillager#readAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:175
  • Modifiers: public
  • Return: void

คืออะไร

อ่าน Additional Save Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: offers. เรียกต่อ: contains(), parse(), registryAccess(), createSerializationContext(), get(), resultOrPartial(), prefix(), ifPresent().

Parameters

  • CompoundTag compoundTag

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

AbstractVillager instance = ...;
CompoundTag compoundTag = ...;
instance.readAdditionalSaveData(compoundTag);

net.minecraft.world.entity.npc.AbstractVillager#rewardTradeXp(MerchantOffer)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:134
  • Modifiers: protected abstract
  • Return: void

คืออะไร

ดำเนินการ rewardTradeXp ตาม implementation ของ AbstractVillager

ทำงานยังไง

ไม่มี implementation ใน declaration นี้; คลาสลูก/implementation เป็นผู้กำหนดพฤติกรรมจริง

Parameters

  • MerchantOffer merchantOffer

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

MerchantOffer merchantOffer = ...;
@Override
protected void rewardTradeXp(MerchantOffer merchantOffer) {
    super.rewardTradeXp(merchantOffer);
}

net.minecraft.world.entity.npc.AbstractVillager#setTradingPlayer(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:87
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Trading Player

ทำงานยังไง

แก้ state: tradingPlayer.

Parameters

  • Player player

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

AbstractVillager instance = ...;
Player player = ...;
instance.setTradingPlayer(player);

net.minecraft.world.entity.npc.AbstractVillager#setUnhappyCounter(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:72
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Unhappy Counter

ทำงานยังไง

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

Parameters

  • int i

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

AbstractVillager instance = ...;
instance.setUnhappyCounter(0);

net.minecraft.world.entity.npc.AbstractVillager#showProgressBar()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:136
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ showProgressBar ตาม implementation ของ AbstractVillager

ทำงานยังไง

คืนค่า: true.

Parameters

  • ไม่มี

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

AbstractVillager instance = ...;
boolean result = instance.showProgressBar();

net.minecraft.world.entity.npc.AbstractVillager#stillValid(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:257
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ stillValid ตาม implementation ของ AbstractVillager

ทำงานยังไง

เรียกต่อ: getTradingPlayer(), isAlive(), canInteractWithEntity(). คืนค่า: this.getTradingPlayer() == player && this.isAlive() && player.canInteractWithEntity(this, 4.0).

Parameters

  • Player player

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

AbstractVillager instance = ...;
Player player = ...;
boolean result = instance.stillValid(player);

net.minecraft.world.entity.npc.AbstractVillager#stopTrading()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:195
  • Modifiers: protected
  • Return: void

คืออะไร

หยุด Trading

ทำงานยังไง

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

Parameters

  • ไม่มี

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

@Override
protected void stopTrading() {
    super.stopTrading();
}

net.minecraft.world.entity.npc.AbstractVillager#teleport(TeleportTransition)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:188
  • Modifiers: public
  • Return: Entity

คืออะไร

ดำเนินการ teleport ตาม implementation ของ AbstractVillager

ทำงานยังไง

เรียกต่อ: stopTrading(). คืนค่า: super.teleport(teleportTransition).

Parameters

  • TeleportTransition teleportTransition

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

AbstractVillager instance = ...;
TeleportTransition teleportTransition = ...;
Entity result = instance.teleport(teleportTransition);

net.minecraft.world.entity.npc.AbstractVillager#updateTrades()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/AbstractVillager.java:230
  • Modifiers: protected abstract
  • Return: void

คืออะไร

อัปเดต Trades

ทำงานยังไง

ไม่มี implementation ใน declaration นี้; คลาสลูก/implementation เป็นผู้กำหนดพฤติกรรมจริง

Parameters

  • ไม่มี

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

@Override
protected void updateTrades() {
    super.updateTrades();
}

CatSpawner

  • Full name: net.minecraft.world.entity.npc.CatSpawner
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/CatSpawner.java
  • Type: class
  • Modifiers: public
  • Implements: CustomSpawner

net.minecraft.world.entity.npc.CatSpawner#tick(ServerLevel,boolean,boolean)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/CatSpawner.java:23
  • Modifiers: public
  • Return: int

คืออะไร

ประมวลผล tick tick

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: nextTick. เรียกต่อ: getGameRules(), getBoolean(), getRandomPlayer(), nextInt(), nextBoolean(), blockPosition(), offset(), hasChunksAt(). มีจุด return อย่างน้อย 7 จุด.

Parameters

  • ServerLevel serverLevel
  • boolean bl
  • boolean bl2

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

CatSpawner instance = ...;
ServerLevel serverLevel = ...;
int result = instance.tick(serverLevel, true, true);

ClientSideMerchant

  • Full name: net.minecraft.world.entity.npc.ClientSideMerchant
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/ClientSideMerchant.java
  • Type: class
  • Modifiers: public
  • Implements: Merchant

net.minecraft.world.entity.npc.ClientSideMerchant#ClientSideMerchant(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:17
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: source.

Parameters

  • Player player

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

Player player = ...;
ClientSideMerchant instance = new ClientSideMerchant(player);

net.minecraft.world.entity.npc.ClientSideMerchant#getNotifyTradeSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:74
  • Modifiers: public
  • Return: SoundEvent

คืออะไร

อ่านค่า Notify Trade Sound

ทำงานยังไง

คืนค่า: SoundEvents.VILLAGER_YES.

Parameters

  • ไม่มี

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

ClientSideMerchant instance = ...;
SoundEvent result = instance.getNotifyTradeSound();

net.minecraft.world.entity.npc.ClientSideMerchant#getOffers()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:30
  • Modifiers: public
  • Return: MerchantOffers

คืออะไร

อ่านค่า Offers

ทำงานยังไง

คืนค่า: this.offers.

Parameters

  • ไม่มี

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

ClientSideMerchant instance = ...;
MerchantOffers result = instance.getOffers();

net.minecraft.world.entity.npc.ClientSideMerchant#getTradingPlayer()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:21
  • Modifiers: public
  • Return: Player

คืออะไร

อ่านค่า Trading Player

ทำงานยังไง

คืนค่า: this.source.

Parameters

  • ไม่มี

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

ClientSideMerchant instance = ...;
Player result = instance.getTradingPlayer();

net.minecraft.world.entity.npc.ClientSideMerchant#getVillagerXp()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:59
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Villager Xp

ทำงานยังไง

คืนค่า: this.xp.

Parameters

  • ไม่มี

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

ClientSideMerchant instance = ...;
int result = instance.getVillagerXp();

net.minecraft.world.entity.npc.ClientSideMerchant#isClientSide()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:49
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Client Side

ทำงานยังไง

เรียกต่อ: level(). คืนค่า: this.source.level().isClientSide.

Parameters

  • ไม่มี

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

ClientSideMerchant instance = ...;
boolean result = instance.isClientSide();

net.minecraft.world.entity.npc.ClientSideMerchant#notifyTrade(MerchantOffer)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:40
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ notifyTrade ตาม implementation ของ ClientSideMerchant

ทำงานยังไง

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

Parameters

  • MerchantOffer merchantOffer

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

ClientSideMerchant instance = ...;
MerchantOffer merchantOffer = ...;
instance.notifyTrade(merchantOffer);

net.minecraft.world.entity.npc.ClientSideMerchant#notifyTradeUpdated(ItemStack)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:45
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ notifyTradeUpdated ตาม implementation ของ ClientSideMerchant

ทำงานยังไง

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

Parameters

  • ItemStack itemStack

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

ClientSideMerchant instance = ...;
ItemStack itemStack = ...;
instance.notifyTradeUpdated(itemStack);

net.minecraft.world.entity.npc.ClientSideMerchant#overrideOffers(MerchantOffers)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:35
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ overrideOffers ตาม implementation ของ ClientSideMerchant

ทำงานยังไง

แก้ state: offers.

Parameters

  • MerchantOffers merchantOffers

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

ClientSideMerchant instance = ...;
MerchantOffers merchantOffers = ...;
instance.overrideOffers(merchantOffers);

net.minecraft.world.entity.npc.ClientSideMerchant#overrideXp(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:64
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ overrideXp ตาม implementation ของ ClientSideMerchant

ทำงานยังไง

แก้ state: xp.

Parameters

  • int i

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

ClientSideMerchant instance = ...;
instance.overrideXp(0);

net.minecraft.world.entity.npc.ClientSideMerchant#setTradingPlayer(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:26
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Trading Player

ทำงานยังไง

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

Parameters

  • Player player

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

ClientSideMerchant instance = ...;
Player player = ...;
instance.setTradingPlayer(player);

net.minecraft.world.entity.npc.ClientSideMerchant#showProgressBar()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:69
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ showProgressBar ตาม implementation ของ ClientSideMerchant

ทำงานยังไง

คืนค่า: true.

Parameters

  • ไม่มี

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

ClientSideMerchant instance = ...;
boolean result = instance.showProgressBar();

net.minecraft.world.entity.npc.ClientSideMerchant#stillValid(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/ClientSideMerchant.java:54
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ stillValid ตาม implementation ของ ClientSideMerchant

ทำงานยังไง

แก้ state: source. คืนค่า: this.source == player.

Parameters

  • Player player

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

ClientSideMerchant instance = ...;
Player player = ...;
boolean result = instance.stillValid(player);

InventoryCarrier

  • Full name: net.minecraft.world.entity.npc.InventoryCarrier
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/InventoryCarrier.java
  • Type: interface
  • Modifiers: public

net.minecraft.world.entity.npc.InventoryCarrier#getInventory()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/InventoryCarrier.java:14
  • Modifiers: ``
  • Return: SimpleContainer

คืออะไร

อ่านค่า Inventory

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • ไม่มี

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

InventoryCarrier instance = ...;
SimpleContainer result = instance.getInventory();

net.minecraft.world.entity.npc.InventoryCarrier#pickUpItem(ServerLevel,Mob,InventoryCarrier,ItemEntity)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/InventoryCarrier.java:16
  • Modifiers: static
  • Return: void

คืออะไร

ดำเนินการ pickUpItem ตาม implementation ของ InventoryCarrier

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getItem(), wantsToPickUp(), getInventory(), canAddItem(), onItemPickup(), getCount(), addItem(), take().

Parameters

  • ServerLevel serverLevel
  • Mob mob
  • InventoryCarrier inventoryCarrier
  • ItemEntity itemEntity

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

ServerLevel serverLevel = ...;
Mob mob = ...;
InventoryCarrier inventoryCarrier = ...;
ItemEntity itemEntity = ...;
InventoryCarrier.pickUpItem(serverLevel, mob, inventoryCarrier, itemEntity);

net.minecraft.world.entity.npc.InventoryCarrier#readInventoryFromTag(CompoundTag,HolderLookup.Provider)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/InventoryCarrier.java:37
  • Modifiers: default
  • Return: void

คืออะไร

อ่าน Inventory From Tag

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: contains(), getInventory(), fromTag(), getList().

Parameters

  • CompoundTag compoundTag
  • HolderLookup.Provider provider

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

InventoryCarrier instance = ...;
CompoundTag compoundTag = ...;
HolderLookup.Provider provider = ...;
instance.readInventoryFromTag(compoundTag, provider);

net.minecraft.world.entity.npc.InventoryCarrier#writeInventoryToTag(CompoundTag,HolderLookup.Provider)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/InventoryCarrier.java:43
  • Modifiers: default
  • Return: void

คืออะไร

เขียน Inventory To Tag

ทำงานยังไง

เรียกต่อ: put(), getInventory(), createTag().

Parameters

  • CompoundTag compoundTag
  • HolderLookup.Provider provider

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

InventoryCarrier instance = ...;
CompoundTag compoundTag = ...;
HolderLookup.Provider provider = ...;
instance.writeInventoryToTag(compoundTag, provider);

Villager

  • Full name: net.minecraft.world.entity.npc.Villager
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/Villager.java
  • Type: class
  • Modifiers: public
  • Extends: AbstractVillager
  • Implements: ReputationEventHandler,VillagerDataHolder

net.minecraft.world.entity.npc.Villager#addAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:488
  • Modifiers: public
  • Return: void

คืออะไร

เพิ่ม Additional Save Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: encodeStart(), getVillagerData(), resultOrPartial(), ifPresent(), put(), putByte(), store(), putInt().

Parameters

  • CompoundTag compoundTag

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

Villager instance = ...;
CompoundTag compoundTag = ...;
instance.addAdditionalSaveData(compoundTag);

net.minecraft.world.entity.npc.Villager#ageBoundaryReached()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:244
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ ageBoundaryReached ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), refreshBrain().

Parameters

  • ไม่มี

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

@Override
protected void ageBoundaryReached() {
    super.ageBoundaryReached();
}

net.minecraft.world.entity.npc.Villager#assignProfessionWhenSpawned()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:256
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ assignProfessionWhenSpawned ตาม implementation ของ Villager

ทำงานยังไง

คืนค่า: this.assignProfessionWhenSpawned.

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.assignProfessionWhenSpawned();

net.minecraft.world.entity.npc.Villager#brainProvider()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:193
  • Modifiers: protected
  • Return: Brain.Provider<Villager>

คืออะไร

ดำเนินการ brainProvider ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: provider(). คืนค่า: Brain.provider(MEMORY_TYPES, SENSOR_TYPES).

Parameters

  • ไม่มี

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

@Override
protected Brain.Provider<Villager> brainProvider() {
    return super.brainProvider();
}

net.minecraft.world.entity.npc.Villager#canBreed()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:655
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่าสามารถ Breed

ทำงานยังไง

เรียกต่อ: countFoodPointsInInventory(), isSleeping(), getAge(). คืนค่า: this.foodLevel + this.countFoodPointsInInventory() >= 12 && !this.isSleeping() && this.getAge() == 0.

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.canBreed();

net.minecraft.world.entity.npc.Villager#canRestock()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:380
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่าสามารถ Restock

ทำงานยังไง

คืนค่า: true.

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.canRestock();

net.minecraft.world.entity.npc.Villager#createAttributes()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:252
  • Modifiers: public static
  • Return: AttributeSupplier.Builder

คืออะไร

สร้าง Attributes

ทำงานยังไง

เรียกต่อ: createMobAttributes(), add(). คืนค่า: Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5).

Parameters

  • ไม่มี

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

AttributeSupplier.Builder result = Villager.createAttributes();

net.minecraft.world.entity.npc.Villager#customServerAiStep(ServerLevel)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:260
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ customServerAiStep ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: assignProfessionWhenSpawned, updateMerchantTimer, increaseProfessionLevelOnUpdate, lastTradedPlayer. เรียกต่อ: get(), push(), getBrain(), tick(), pop(), isTrading(), increaseMerchantCareer(), addEffect(). สร้างออบเจ็กต์: MobEffectInstance.

Parameters

  • ServerLevel serverLevel

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

ServerLevel serverLevel = ...;
@Override
protected void customServerAiStep(ServerLevel serverLevel) {
    super.customServerAiStep(serverLevel);
}

net.minecraft.world.entity.npc.Villager#defineSynchedData(SynchedEntityData.Builder)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:482
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ defineSynchedData ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: define(). สร้างออบเจ็กต์: VillagerData.

Parameters

  • SynchedEntityData.Builder builder

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

SynchedEntityData.Builder builder = ...;
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
    super.defineSynchedData(builder);
}

net.minecraft.world.entity.npc.Villager#die(DamageSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:607
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ die ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: info(), getLocalizedDeathMessage(), getString(), getEntity(), tellWitnessesThatIWasMurdered(), releaseAllPois().

Parameters

  • DamageSource damageSource

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

Villager instance = ...;
DamageSource damageSource = ...;
instance.die(damageSource);

net.minecraft.world.entity.npc.Villager#eatAndDigestFood()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:694
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ eatAndDigestFood ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: eatUntilFull(), digestFood().

Parameters

  • ไม่มี

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

Villager instance = ...;
instance.eatAndDigestFood();

net.minecraft.world.entity.npc.Villager#finalizeSpawn(ServerLevelAccessor,DifficultyInstance,EntitySpawnReason,SpawnGroupData)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:735
  • Modifiers: public
  • Return: SpawnGroupData

คืออะไร

ดำเนินการ finalizeSpawn ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: assignProfessionWhenSpawned. เรียกต่อ: setVillagerData(), getVillagerData(), setProfession(), isSpawner(), setType(), byBiome(), getBiome(), blockPosition(). คืนค่า: super.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData).

Parameters

  • ServerLevelAccessor serverLevelAccessor
  • DifficultyInstance difficultyInstance
  • EntitySpawnReason entitySpawnReason
  • SpawnGroupData spawnGroupData

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

Villager instance = ...;
ServerLevelAccessor serverLevelAccessor = ...;
DifficultyInstance difficultyInstance = ...;
EntitySpawnReason entitySpawnReason = ...;
SpawnGroupData spawnGroupData = ...;
SpawnGroupData result = instance.finalizeSpawn(serverLevelAccessor, difficultyInstance, entitySpawnReason, spawnGroupData);

net.minecraft.world.entity.npc.Villager#getAmbientSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:540
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Ambient Sound

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: isSleeping(), isTrading(). มีจุด return อย่างน้อย 2 จุด.

Parameters

  • ไม่มี

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

@Override
protected SoundEvent getAmbientSound() {
    return super.getAmbientSound();
}

net.minecraft.world.entity.npc.Villager#getBrain()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:188
  • Modifiers: public
  • Return: Brain<Villager>

คืออะไร

อ่านค่า Brain

ทำงานยังไง

คืนค่า: (Brain<Villager>)super.getBrain().

Parameters

  • ไม่มี

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

Villager instance = ...;
Brain<Villager> result = instance.getBrain();

net.minecraft.world.entity.npc.Villager#getBreedOffspring(ServerLevel,AgeableMob)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:758
  • Modifiers: public
  • Return: Villager

คืออะไร

อ่านค่า Breed Offspring

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: nextDouble(), byBiome(), getBiome(), blockPosition(), getVillagerData(), getType(), finalizeSpawn(), getCurrentDifficultyAt(). สร้างออบเจ็กต์: Villager. คืนค่า: villager.

Parameters

  • ServerLevel serverLevel
  • AgeableMob ageableMob

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

Villager instance = ...;
ServerLevel serverLevel = ...;
AgeableMob ageableMob = ...;
Villager result = instance.getBreedOffspring(serverLevel, ageableMob);

net.minecraft.world.entity.npc.Villager#getDeathSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:555
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Death Sound

ทำงานยังไง

คืนค่า: SoundEvents.VILLAGER_DEATH.

Parameters

  • ไม่มี

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

@Override
protected SoundEvent getDeathSound() {
    return super.getDeathSound();
}

net.minecraft.world.entity.npc.Villager#getGossips()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:908
  • Modifiers: public
  • Return: GossipContainer

คืออะไร

อ่านค่า Gossips

ทำงานยังไง

คืนค่า: this.gossips.

Parameters

  • ไม่มี

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

Villager instance = ...;
GossipContainer result = instance.getGossips();

net.minecraft.world.entity.npc.Villager#getHurtSound(DamageSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:550
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Hurt Sound

ทำงานยังไง

คืนค่า: SoundEvents.VILLAGER_HURT.

Parameters

  • DamageSource damageSource

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

DamageSource damageSource = ...;
@Override
protected SoundEvent getHurtSound(DamageSource damageSource) {
    return super.getHurtSound(damageSource);
}

net.minecraft.world.entity.npc.Villager#getPlayerReputation(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:686
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Player Reputation

ทำงานยังไง

เรียกต่อ: getReputation(), getUUID(). คืนค่า: this.gossips.getReputation(player.getUUID(), gossipType -> true).

Parameters

  • Player player

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

Villager instance = ...;
Player player = ...;
int result = instance.getPlayerReputation(player);

net.minecraft.world.entity.npc.Villager#getTypeName()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:713
  • Modifiers: protected
  • Return: Component

คืออะไร

อ่านค่า Type Name

ทำงานยังไง

เรียกต่อ: translatable(), getType(), getDescriptionId(), getKey(), getVillagerData(), getProfession(), getPath().

Parameters

  • ไม่มี

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

@Override
protected Component getTypeName() {
    return super.getTypeName();
}

net.minecraft.world.entity.npc.Villager#getVillagerData()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:574
  • Modifiers: public
  • Return: VillagerData

คืออะไร

อ่านค่า Villager Data

ทำงานยังไง

เรียกต่อ: get(). คืนค่า: this.entityData.get(DATA_VILLAGER_DATA).

Parameters

  • ไม่มี

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

Villager instance = ...;
VillagerData result = instance.getVillagerData();

net.minecraft.world.entity.npc.Villager#getVillagerXp()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:894
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Villager Xp

ทำงานยังไง

คืนค่า: this.villagerXp.

Parameters

  • ไม่มี

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

Villager instance = ...;
int result = instance.getVillagerXp();

net.minecraft.world.entity.npc.Villager#gossip(ServerLevel,Villager,long)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:841
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ gossip ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: lastGossipTime. เรียกต่อ: transferFrom(), spawnGolemIfNeeded().

Parameters

  • ServerLevel serverLevel
  • Villager villager
  • long l

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

Villager instance = ...;
ServerLevel serverLevel = ...;
Villager villager = ...;
instance.gossip(serverLevel, villager, 0L);

net.minecraft.world.entity.npc.Villager#handleEntityEvent(byte)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:720
  • Modifiers: public
  • Return: void

คืออะไร

จัดการ Entity Event

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: addParticlesAroundSelf().

Parameters

  • byte b

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

Villager instance = ...;
instance.handleEntityEvent(0);

net.minecraft.world.entity.npc.Villager#hasExcessFood()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:804
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่ามี Excess Food

ทำงานยังไง

เรียกต่อ: countFoodPointsInInventory(). คืนค่า: this.countFoodPointsInInventory() >= 24.

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.hasExcessFood();

net.minecraft.world.entity.npc.Villager#hasFarmSeeds()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:817
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่ามี Farm Seeds

ทำงานยังไง

เรียกต่อ: getInventory(), hasAnyMatching(), is(). คืนค่า: this.getInventory().hasAnyMatching(itemStack -> itemStack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS)).

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.hasFarmSeeds();

net.minecraft.world.entity.npc.Villager#makeBrain(Dynamic<?>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:198
  • Modifiers: protected
  • Return: Brain<?>

คืออะไร

สร้าง Brain

ทำงานยังไง

เรียกต่อ: brainProvider(), registerBrainGoals(). คืนค่า: brain.

Parameters

  • Dynamic<?> dynamic

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

Dynamic<?> dynamic = ...;
@Override
protected Brain<?> makeBrain(Dynamic<?> dynamic) {
    return super.makeBrain(dynamic);
}

net.minecraft.world.entity.npc.Villager#mobInteract(Player,InteractionHand)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:312
  • Modifiers: public
  • Return: InteractionResult

คืออะไร

ดำเนินการ mobInteract ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getItemInHand(), is(), isAlive(), isTrading(), isSleeping(), isBaby(), setUnhappy(), level(). มีจุด return อย่างน้อย 4 จุด.

Parameters

  • Player player
  • InteractionHand interactionHand

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

Villager instance = ...;
Player player = ...;
InteractionHand interactionHand = ...;
InteractionResult result = instance.mobInteract(player, interactionHand);

net.minecraft.world.entity.npc.Villager#onReputationEventFrom(ReputationEventType,Entity)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:880
  • Modifiers: public
  • Return: void

คืออะไร

จัดการเหตุการณ์ Reputation Event From

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: add(), getUUID().

Parameters

  • ReputationEventType reputationEventType
  • Entity entity

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

Villager instance = ...;
ReputationEventType reputationEventType = ...;
Entity entity = ...;
instance.onReputationEventFrom(reputationEventType, entity);

net.minecraft.world.entity.npc.Villager#pickUpItem(ServerLevel,ItemEntity)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:792
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ pickUpItem ตาม implementation ของ Villager

ทำงานยังไง

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

Parameters

  • ServerLevel serverLevel
  • ItemEntity itemEntity

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

ServerLevel serverLevel = ...;
ItemEntity itemEntity = ...;
@Override
protected void pickUpItem(ServerLevel serverLevel, ItemEntity itemEntity) {
    super.pickUpItem(serverLevel, itemEntity);
}

net.minecraft.world.entity.npc.Villager#playWorkSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:560
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ playWorkSound ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: makeSound(), getVillagerData(), getProfession(), workSound().

Parameters

  • ไม่มี

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

Villager instance = ...;
instance.playWorkSound();

net.minecraft.world.entity.npc.Villager#readAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:503
  • Modifiers: public
  • Return: void

คืออะไร

อ่าน Additional Save Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: foodLevel, villagerXp, lastRestockGameTime, lastGossipDecayTime, numberOfRestocksToday, assignProfessionWhenSpawned. เรียกต่อ: contains(), parse(), get(), resultOrPartial(), ifPresent(), set(), getByte(), getList(). สร้างออบเจ็กต์: Dynamic<>.

Parameters

  • CompoundTag compoundTag

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

Villager instance = ...;
CompoundTag compoundTag = ...;
instance.readAdditionalSaveData(compoundTag);

net.minecraft.world.entity.npc.Villager#refreshBrain(ServerLevel)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:205
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ refreshBrain ตาม implementation ของ Villager

ทำงานยังไง

แก้ state: brain. เรียกต่อ: getBrain(), stopAll(), copyWithoutBehaviors(), registerBrainGoals().

Parameters

  • ServerLevel serverLevel

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

Villager instance = ...;
ServerLevel serverLevel = ...;
instance.refreshBrain(serverLevel);

net.minecraft.world.entity.npc.Villager#releasePoi(MemoryModuleType<GlobalPos>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:637
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ releasePoi ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), getServer(), getMemory(), ifPresent(), getLevel(), dimension(), getPoiManager(), getType().

Parameters

  • MemoryModuleType<GlobalPos> memoryModuleType

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

Villager instance = ...;
MemoryModuleType<GlobalPos> memoryModuleType = ...;
instance.releasePoi(memoryModuleType);

net.minecraft.world.entity.npc.Villager#removeWhenFarAway(double)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:535
  • Modifiers: public
  • Return: boolean

คืออะไร

ลบ When Far Away

ทำงานยังไง

คืนค่า: false.

Parameters

  • double d

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

Villager instance = ...;
boolean result = instance.removeWhenFarAway(0.0D);

net.minecraft.world.entity.npc.Villager#restock()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:385
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ restock ตาม implementation ของ Villager

ทำงานยังไง

มีการวนลูป. แก้ state: lastRestockGameTime, numberOfRestocksToday. เรียกต่อ: updateDemand(), getOffers(), resetUses(), resendOffersToTradingPlayer(), level(), getGameTime().

Parameters

  • ไม่มี

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

Villager instance = ...;
instance.restock();

net.minecraft.world.entity.npc.Villager#rewardTradeXp(MerchantOffer)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:579
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ rewardTradeXp ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: villagerXp, lastTradedPlayer, updateMerchantTimer, increaseProfessionLevelOnUpdate. เรียกต่อ: nextInt(), getXp(), getTradingPlayer(), shouldIncreaseLevel(), shouldRewardExp(), level(), addFreshEntity(), getX(). สร้างออบเจ็กต์: ExperienceOrb.

Parameters

  • MerchantOffer merchantOffer

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

MerchantOffer merchantOffer = ...;
@Override
protected void rewardTradeXp(MerchantOffer merchantOffer) {
    super.rewardTradeXp(merchantOffer);
}

net.minecraft.world.entity.npc.Villager#sendDebugPackets()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:916
  • Modifiers: protected
  • Return: void

คืออะไร

ส่ง Debug Packets

ทำงานยังไง

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

Parameters

  • ไม่มี

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

@Override
protected void sendDebugPackets() {
    super.sendDebugPackets();
}

net.minecraft.world.entity.npc.Villager#setGossips(Tag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:912
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Gossips

ทำงานยังไง

เรียกต่อ: update(). สร้างออบเจ็กต์: Dynamic<>.

Parameters

  • Tag tag

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

Villager instance = ...;
Tag tag = ...;
instance.setGossips(tag);

net.minecraft.world.entity.npc.Villager#setLastHurtByMob(LivingEntity)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:595
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Last Hurt By Mob

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), onReputationEvent(), isAlive(), broadcastEntityEvent().

Parameters

  • LivingEntity livingEntity

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

Villager instance = ...;
LivingEntity livingEntity = ...;
instance.setLastHurtByMob(livingEntity);

net.minecraft.world.entity.npc.Villager#setOffers(MerchantOffers)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:699
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Offers

ทำงานยังไง

แก้ state: offers.

Parameters

  • MerchantOffers merchantOffers

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

Villager instance = ...;
MerchantOffers merchantOffers = ...;
instance.setOffers(merchantOffers);

net.minecraft.world.entity.npc.Villager#setTradingPlayer(Player)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:357
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Trading Player

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getTradingPlayer(), stopTrading().

Parameters

  • Player player

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

Villager instance = ...;
Player player = ...;
instance.setTradingPlayer(player);

net.minecraft.world.entity.npc.Villager#setVillagerData(VillagerData)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:564
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Villager Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: offers. เรียกต่อ: getVillagerData(), getProfession(), set().

Parameters

  • VillagerData villagerData

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

Villager instance = ...;
VillagerData villagerData = ...;
instance.setVillagerData(villagerData);

net.minecraft.world.entity.npc.Villager#setVillagerXp(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:899
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Villager Xp

ทำงานยังไง

แก้ state: villagerXp.

Parameters

  • int i

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

Villager instance = ...;
instance.setVillagerXp(0);

net.minecraft.world.entity.npc.Villager#shouldRestock()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:421
  • Modifiers: public
  • Return: boolean

คืออะไร

ตรวจสอบว่าควร Restock

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: lastRestockCheckDayTime, lastRestockGameTime. เรียกต่อ: level(), getGameTime(), getDayTime(), resetNumberOfRestocks(), allowedToRestock(), needsToRestock(). คืนค่า: this.allowedToRestock() && this.needsToRestock().

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.shouldRestock();

net.minecraft.world.entity.npc.Villager#spawnGolemIfNeeded(ServerLevel,long,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:860
  • Modifiers: public
  • Return: void

คืออะไร

สร้าง entity ในโลก Golem If Needed

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: wantsToSpawnGolem(), getBoundingBox(), inflate(), getEntitiesOfClass(), stream(), filter(), limit(), toList().

Parameters

  • ServerLevel serverLevel
  • long l
  • int i

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

Villager instance = ...;
ServerLevel serverLevel = ...;
instance.spawnGolemIfNeeded(serverLevel, 0L, 0);

net.minecraft.world.entity.npc.Villager#startSleeping(BlockPos)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:922
  • Modifiers: public
  • Return: void

คืออะไร

เริ่ม Sleeping

ทำงานยังไง

เรียกต่อ: setMemory(), level(), getGameTime(), eraseMemory().

Parameters

  • BlockPos blockPos

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

Villager instance = ...;
BlockPos blockPos = ...;
instance.startSleeping(blockPos);

net.minecraft.world.entity.npc.Villager#stopSleeping()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:930
  • Modifiers: public
  • Return: void

คืออะไร

หยุด Sleeping

ทำงานยังไง

เรียกต่อ: setMemory(), level(), getGameTime().

Parameters

  • ไม่มี

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

Villager instance = ...;
instance.stopSleeping();

net.minecraft.world.entity.npc.Villager#stopTrading()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:366
  • Modifiers: protected
  • Return: void

คืออะไร

หยุด Trading

ทำงานยังไง

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

Parameters

  • ไม่มี

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

@Override
protected void stopTrading() {
    super.stopTrading();
}

net.minecraft.world.entity.npc.Villager#thunderHit(ServerLevel,LightningBolt)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:775
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ thunderHit ตาม implementation ของ Villager

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getDifficulty(), info(), convertTo(), single(), finalizeSpawn(), getCurrentDifficultyAt(), blockPosition(), setPersistenceRequired().

Parameters

  • ServerLevel serverLevel
  • LightningBolt lightningBolt

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

Villager instance = ...;
ServerLevel serverLevel = ...;
LightningBolt lightningBolt = ...;
instance.thunderHit(serverLevel, lightningBolt);

net.minecraft.world.entity.npc.Villager#tick()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:302
  • Modifiers: public
  • Return: void

คืออะไร

ประมวลผล tick tick

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getUnhappyCounter(), setUnhappyCounter(), maybeDecayGossip().

Parameters

  • ไม่มี

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

Villager instance = ...;
instance.tick();

net.minecraft.world.entity.npc.Villager#updateTrades()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:821
  • Modifiers: protected
  • Return: void

คืออะไร

อัปเดต Trades

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getVillagerData(), level(), enabledFeatures(), contains(), get(), getProfession(), isEmpty(), getLevel().

Parameters

  • ไม่มี

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

@Override
protected void updateTrades() {
    super.updateTrades();
}

net.minecraft.world.entity.npc.Villager#Villager(EntityType<? extends Villager>,Level)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:175
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • EntityType<? extends Villager> entityType
  • Level level

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

EntityType<? extends Villager> entityType = ...;
Level level = ...;
Villager instance = new Villager(entityType, level);

net.minecraft.world.entity.npc.Villager#Villager(EntityType<? extends Villager>,Level,VillagerType)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:179
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

เรียกต่อ: getNavigation(), setCanOpenDoors(), setCanFloat(), setRequiredPathLength(), setCanPickUpLoot(), setVillagerData(), getVillagerData(), setType().

Parameters

  • EntityType<? extends Villager> entityType
  • Level level
  • VillagerType villagerType

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

EntityType<? extends Villager> entityType = ...;
Level level = ...;
VillagerType villagerType = ...;
Villager instance = new Villager(entityType, level, villagerType);

net.minecraft.world.entity.npc.Villager#wantsMoreFood()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:808
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ wantsMoreFood ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: countFoodPointsInInventory(). คืนค่า: this.countFoodPointsInInventory() < 12.

Parameters

  • ไม่มี

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

Villager instance = ...;
boolean result = instance.wantsMoreFood();

net.minecraft.world.entity.npc.Villager#wantsToPickUp(ServerLevel,ItemStack)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:797
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ wantsToPickUp ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: getItem(), is(), getVillagerData(), getProfession(), requestedItems(), contains(), getInventory(), canAddItem().

Parameters

  • ServerLevel serverLevel
  • ItemStack itemStack

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

Villager instance = ...;
ServerLevel serverLevel = ...;
ItemStack itemStack = ...;
boolean result = instance.wantsToPickUp(serverLevel, itemStack);

net.minecraft.world.entity.npc.Villager#wantsToSpawnGolem(long)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/Villager.java:876
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ wantsToSpawnGolem ตาม implementation ของ Villager

ทำงานยังไง

เรียกต่อ: golemSpawnConditionsMet(), level(), getGameTime(), hasMemoryValue(). คืนค่า: !this.golemSpawnConditionsMet(this.level().getGameTime()) ? false : !this.brain.hasMemoryValue(MemoryModuleType.GOLEM_DETECTED_RECENTLY).

Parameters

  • long l

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

Villager instance = ...;
boolean result = instance.wantsToSpawnGolem(0L);

VillagerData

  • Full name: net.minecraft.world.entity.npc.VillagerData
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerData.java
  • Type: class
  • Modifiers: public

net.minecraft.world.entity.npc.VillagerData#canLevelUp(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:78
  • Modifiers: public static
  • Return: boolean

คืออะไร

ตรวจสอบว่าสามารถ Level Up

ทำงานยังไง

คืนค่า: i >= 1 && i < 5.

Parameters

  • int i

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

boolean result = VillagerData.canLevelUp(0);

net.minecraft.world.entity.npc.VillagerData#getLevel()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:54
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Level

ทำงานยังไง

คืนค่า: this.level.

Parameters

  • ไม่มี

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

VillagerData instance = ...;
int result = instance.getLevel();

net.minecraft.world.entity.npc.VillagerData#getMaxXpPerLevel(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:74
  • Modifiers: public static
  • Return: int

คืออะไร

อ่านค่า Max Xp Per Level

ทำงานยังไง

เรียกต่อ: canLevelUp(). คืนค่า: canLevelUp(i) ? NEXT_LEVEL_XP_THRESHOLDS[i] : 0.

Parameters

  • int i

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

int result = VillagerData.getMaxXpPerLevel(0);

net.minecraft.world.entity.npc.VillagerData#getMinXpPerLevel(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:70
  • Modifiers: public static
  • Return: int

คืออะไร

อ่านค่า Min Xp Per Level

ทำงานยังไง

เรียกต่อ: canLevelUp(). คืนค่า: canLevelUp(i) ? NEXT_LEVEL_XP_THRESHOLDS[i - 1] : 0.

Parameters

  • int i

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

int result = VillagerData.getMinXpPerLevel(0);

net.minecraft.world.entity.npc.VillagerData#getProfession()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:50
  • Modifiers: public
  • Return: VillagerProfession

คืออะไร

อ่านค่า Profession

ทำงานยังไง

คืนค่า: this.profession.

Parameters

  • ไม่มี

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

VillagerData instance = ...;
VillagerProfession result = instance.getProfession();

net.minecraft.world.entity.npc.VillagerData#getType()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:46
  • Modifiers: public
  • Return: VillagerType

คืออะไร

อ่านค่า Type

ทำงานยังไง

คืนค่า: this.type.

Parameters

  • ไม่มี

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

VillagerData instance = ...;
VillagerType result = instance.getType();

net.minecraft.world.entity.npc.VillagerData#setLevel(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:66
  • Modifiers: public
  • Return: VillagerData

คืออะไร

กำหนดค่า Level

ทำงานยังไง

สร้างออบเจ็กต์: VillagerData. คืนค่า: new VillagerData(this.type, this.profession, i).

Parameters

  • int i

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

VillagerData instance = ...;
VillagerData result = instance.setLevel(0);

net.minecraft.world.entity.npc.VillagerData#setProfession(VillagerProfession)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:62
  • Modifiers: public
  • Return: VillagerData

คืออะไร

กำหนดค่า Profession

ทำงานยังไง

สร้างออบเจ็กต์: VillagerData. คืนค่า: new VillagerData(this.type, villagerProfession, this.level).

Parameters

  • VillagerProfession villagerProfession

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

VillagerData instance = ...;
VillagerProfession villagerProfession = ...;
VillagerData result = instance.setProfession(villagerProfession);

net.minecraft.world.entity.npc.VillagerData#setType(VillagerType)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:58
  • Modifiers: public
  • Return: VillagerData

คืออะไร

กำหนดค่า Type

ทำงานยังไง

สร้างออบเจ็กต์: VillagerData. คืนค่า: new VillagerData(villagerType, this.profession, this.level).

Parameters

  • VillagerType villagerType

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

VillagerData instance = ...;
VillagerType villagerType = ...;
VillagerData result = instance.setType(villagerType);

net.minecraft.world.entity.npc.VillagerData#VillagerData(VillagerType,VillagerProfession,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerData.java:40
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: type, profession, level. เรียกต่อ: max().

Parameters

  • VillagerType villagerType
  • VillagerProfession villagerProfession
  • int i

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

VillagerType villagerType = ...;
VillagerProfession villagerProfession = ...;
VillagerData instance = new VillagerData(villagerType, villagerProfession, 0);

VillagerDataHolder

  • Full name: net.minecraft.world.entity.npc.VillagerDataHolder
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerDataHolder.java
  • Type: interface
  • Modifiers: public
  • Implements: VariantHolder<VillagerType>

net.minecraft.world.entity.npc.VillagerDataHolder#getVariant()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerDataHolder.java:10
  • Modifiers: default
  • Return: VillagerType

คืออะไร

อ่านค่า Variant

ทำงานยังไง

เรียกต่อ: getVillagerData(), getType(). คืนค่า: this.getVillagerData().getType().

Parameters

  • ไม่มี

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

VillagerDataHolder instance = ...;
VillagerType result = instance.getVariant();

net.minecraft.world.entity.npc.VillagerDataHolder#getVillagerData()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerDataHolder.java:6
  • Modifiers: ``
  • Return: VillagerData

คืออะไร

อ่านค่า Villager Data

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • ไม่มี

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

VillagerDataHolder instance = ...;
VillagerData result = instance.getVillagerData();

net.minecraft.world.entity.npc.VillagerDataHolder#setVariant(VillagerType)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerDataHolder.java:14
  • Modifiers: default
  • Return: void

คืออะไร

กำหนดค่า Variant

ทำงานยังไง

เรียกต่อ: setVillagerData(), getVillagerData(), setType().

Parameters

  • VillagerType villagerType

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

VillagerDataHolder instance = ...;
VillagerType villagerType = ...;
instance.setVariant(villagerType);

net.minecraft.world.entity.npc.VillagerDataHolder#setVillagerData(VillagerData)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerDataHolder.java:8
  • Modifiers: ``
  • Return: void

คืออะไร

กำหนดค่า Villager Data

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • VillagerData villagerData

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

VillagerDataHolder instance = ...;
VillagerData villagerData = ...;
instance.setVillagerData(villagerData);

VillagerProfession

  • Full name: net.minecraft.world.entity.npc.VillagerProfession
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerProfession.java
  • Type: record
  • Modifiers: public

net.minecraft.world.entity.npc.VillagerProfession#toString()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerProfession.java:52
  • Modifiers: public
  • Return: String

คืออะไร

ดำเนินการ toString ตาม implementation ของ VillagerProfession

ทำงานยังไง

คืนค่า: this.name.

Parameters

  • ไม่มี

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

VillagerProfession instance = ...;
String result = instance.toString();

VillagerTrades$DyedArmorForEmeralds

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$DyedArmorForEmeralds
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$DyedArmorForEmeralds#DyedArmorForEmeralds(Item,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1279
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • Item item
  • int i

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

Item item = ...;
VillagerTrades.DyedArmorForEmeralds instance = new VillagerTrades.DyedArmorForEmeralds(item, 0);

net.minecraft.world.entity.npc.VillagerTrades$DyedArmorForEmeralds#DyedArmorForEmeralds(Item,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1283
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: item, value, maxUses, villagerXp.

Parameters

  • Item item
  • int i
  • int j
  • int k

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

Item item = ...;
VillagerTrades.DyedArmorForEmeralds instance = new VillagerTrades.DyedArmorForEmeralds(item, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$DyedArmorForEmeralds#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1290
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: is(), newArrayList(), add(), getRandomDye(), nextFloat(), applyDyes(). สร้างออบเจ็กต์: ItemCost, ItemStack, MerchantOffer. คืนค่า: new MerchantOffer(itemCost, itemStack, this.maxUses, this.villagerXp, 0.2F).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.DyedArmorForEmeralds instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

VillagerTrades$EmeraldForItems

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$EmeraldForItems
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$EmeraldForItems#EmeraldForItems(ItemCost,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1331
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: itemStack, maxUses, villagerXp, emeraldAmount, priceMultiplier.

Parameters

  • ItemCost itemCost
  • int i
  • int j
  • int k

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

ItemCost itemCost = ...;
VillagerTrades.EmeraldForItems instance = new VillagerTrades.EmeraldForItems(itemCost, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$EmeraldForItems#EmeraldForItems(ItemLike,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1323
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • ItemLike itemLike
  • int i
  • int j
  • int k

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

ItemLike itemLike = ...;
VillagerTrades.EmeraldForItems instance = new VillagerTrades.EmeraldForItems(itemLike, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$EmeraldForItems#EmeraldForItems(ItemLike,int,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1327
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

เรียกต่อ: asItem(). สร้างออบเจ็กต์: ItemCost.

Parameters

  • ItemLike itemLike
  • int i
  • int j
  • int k
  • int l

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

ItemLike itemLike = ...;
VillagerTrades.EmeraldForItems instance = new VillagerTrades.EmeraldForItems(itemLike, 0, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$EmeraldForItems#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1339
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

สร้างออบเจ็กต์: MerchantOffer, ItemStack. คืนค่า: new MerchantOffer(this.itemStack, new ItemStack(Items.EMERALD, this.emeraldAmount), this.maxUses, this.villagerXp, this.priceMultiplier).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.EmeraldForItems instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

VillagerTrades$EmeraldsForVillagerTypeItem

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$EmeraldsForVillagerTypeItem
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$EmeraldsForVillagerTypeItem#EmeraldsForVillagerTypeItem(int,int,int,Map<VillagerType, Item>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1351
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

มีการวนลูป. แก้ state: trades, cost, maxUses, villagerXp. เรียกต่อ: stream(), filter(), containsKey(), findAny(), ifPresent(), getKey(). สร้างออบเจ็กต์: IllegalStateException.

Parameters

  • int i
  • int j
  • int k
  • Map<VillagerType, Item> map

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

Map<VillagerType, Item> map = ...;
VillagerTrades.EmeraldsForVillagerTypeItem instance = new VillagerTrades.EmeraldsForVillagerTypeItem(0, 0, 0, map);

net.minecraft.world.entity.npc.VillagerTrades$EmeraldsForVillagerTypeItem#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1361
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: get(), getVillagerData(), getType(). สร้างออบเจ็กต์: ItemCost, MerchantOffer, ItemStack. มีจุด return อย่างน้อย 2 จุด.

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.EmeraldsForVillagerTypeItem instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

VillagerTrades$EnchantBookForEmeralds

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$EnchantBookForEmeralds
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$EnchantBookForEmeralds#EnchantBookForEmeralds(int,int,int,TagKey<Enchantment>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1383
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: minLevel, maxLevel, villagerXp, tradeableEnchantments.

Parameters

  • int i
  • int j
  • int k
  • TagKey<Enchantment> tagKey

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

TagKey<Enchantment> tagKey = ...;
VillagerTrades.EnchantBookForEmeralds instance = new VillagerTrades.EnchantBookForEmeralds(0, 0, 0, tagKey);

net.minecraft.world.entity.npc.VillagerTrades$EnchantBookForEmeralds#EnchantBookForEmeralds(int,TagKey<Enchantment>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1379
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • int i
  • TagKey<Enchantment> tagKey

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

TagKey<Enchantment> tagKey = ...;
VillagerTrades.EnchantBookForEmeralds instance = new VillagerTrades.EnchantBookForEmeralds(0, tagKey);

net.minecraft.world.entity.npc.VillagerTrades$EnchantBookForEmeralds#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1390
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), registryAccess(), lookupOrThrow(), getRandomElementOf(), isEmpty(), get(), value(), max(). สร้างออบเจ็กต์: EnchantmentInstance, ItemStack, MerchantOffer, ItemCost. คืนค่า: new MerchantOffer(new ItemCost(Items.EMERALD, l), Optional.of(new ItemCost(Items.BOOK)), itemStack, 12, this.villagerXp, 0.2F).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.EnchantBookForEmeralds instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

VillagerTrades$EnchantedItemForEmeralds

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$EnchantedItemForEmeralds
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$EnchantedItemForEmeralds#EnchantedItemForEmeralds(Item,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1429
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • Item item
  • int i
  • int j
  • int k

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

Item item = ...;
VillagerTrades.EnchantedItemForEmeralds instance = new VillagerTrades.EnchantedItemForEmeralds(item, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$EnchantedItemForEmeralds#EnchantedItemForEmeralds(Item,int,int,int,float)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1433
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: itemStack, baseEmeraldCost, maxUses, villagerXp, priceMultiplier. สร้างออบเจ็กต์: ItemStack.

Parameters

  • Item item
  • int i
  • int j
  • int k
  • float f

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

Item item = ...;
VillagerTrades.EnchantedItemForEmeralds instance = new VillagerTrades.EnchantedItemForEmeralds(item, 0, 0, 0, 0.0F);

net.minecraft.world.entity.npc.VillagerTrades$EnchantedItemForEmeralds#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1441
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

เรียกต่อ: nextInt(), level(), registryAccess(), lookupOrThrow(), get(), enchantItem(), getItem(), min(). สร้างออบเจ็กต์: ItemStack, ItemCost, MerchantOffer. คืนค่า: new MerchantOffer(itemCost, itemStack, this.maxUses, this.villagerXp, this.priceMultiplier).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.EnchantedItemForEmeralds instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

VillagerTrades$ItemListing

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$ItemListing
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: interface
  • Modifiers: public

net.minecraft.world.entity.npc.VillagerTrades$ItemListing#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1461
  • Modifiers: ``
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.ItemListing instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

VillagerTrades$ItemsAndEmeraldsToItems

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$ItemsAndEmeraldsToItems
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$ItemsAndEmeraldsToItems#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1496
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

เรียกต่อ: copy(), level(), ifPresent(), enchantItemFromProvider(), registryAccess(), getCurrentDifficultyAt(), blockPosition(), of(). สร้างออบเจ็กต์: MerchantOffer, ItemCost.

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.ItemsAndEmeraldsToItems instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

net.minecraft.world.entity.npc.VillagerTrades$ItemsAndEmeraldsToItems#ItemsAndEmeraldsToItems(ItemCost,int,ItemStack,int,int,float,Optional<ResourceKey<EnchantmentProvider>>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1486
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: fromItem, emeraldCost, toItem, maxUses, villagerXp, priceMultiplier.

Parameters

  • ItemCost itemCost
  • int i
  • ItemStack itemStack
  • int j
  • int k
  • float f
  • Optional<ResourceKey<EnchantmentProvider>> optional

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

ItemCost itemCost = ...;
ItemStack itemStack = ...;
Optional<ResourceKey<EnchantmentProvider>> optional = ...;
VillagerTrades.ItemsAndEmeraldsToItems instance = new VillagerTrades.ItemsAndEmeraldsToItems(itemCost, 0, itemStack, 0, 0, 0.0F, optional);

net.minecraft.world.entity.npc.VillagerTrades$ItemsAndEmeraldsToItems#ItemsAndEmeraldsToItems(ItemLike,int,int,Item,int,int,int,float)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1474
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

สร้างออบเจ็กต์: ItemStack.

Parameters

  • ItemLike itemLike
  • int i
  • int j
  • Item item
  • int k
  • int l
  • int m
  • float f

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

ItemLike itemLike = ...;
Item item = ...;
VillagerTrades.ItemsAndEmeraldsToItems instance = new VillagerTrades.ItemsAndEmeraldsToItems(itemLike, 0, 0, item, 0, 0, 0, 0.0F);

VillagerTrades$ItemsForEmeralds

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1559
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

เรียกต่อ: copy(), level(), ifPresent(), enchantItemFromProvider(), registryAccess(), getCurrentDifficultyAt(), blockPosition(). สร้างออบเจ็กต์: MerchantOffer, ItemCost. คืนค่า: new MerchantOffer(new ItemCost(Items.EMERALD, this.emeraldCost), itemStack, this.maxUses, this.villagerXp, this.priceMultiplier).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.ItemsForEmeralds instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(Block,int,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1521
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

สร้างออบเจ็กต์: ItemStack.

Parameters

  • Block block
  • int i
  • int j
  • int k
  • int l

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

Block block = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(block, 0, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(Item,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1525
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

สร้างออบเจ็กต์: ItemStack.

Parameters

  • Item item
  • int i
  • int j
  • int k

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

Item item = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(item, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(Item,int,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1529
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

สร้างออบเจ็กต์: ItemStack.

Parameters

  • Item item
  • int i
  • int j
  • int k
  • int l

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

Item item = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(item, 0, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(Item,int,int,int,int,float)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1537
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

สร้างออบเจ็กต์: ItemStack.

Parameters

  • Item item
  • int i
  • int j
  • int k
  • int l
  • float f

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

Item item = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(item, 0, 0, 0, 0, 0.0F);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(Item,int,int,int,int,float,ResourceKey<EnchantmentProvider>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1541
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

เรียกต่อ: of(). สร้างออบเจ็กต์: ItemStack.

Parameters

  • Item item
  • int i
  • int j
  • int k
  • int l
  • float f
  • ResourceKey<EnchantmentProvider> resourceKey

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

Item item = ...;
ResourceKey<EnchantmentProvider> resourceKey = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(item, 0, 0, 0, 0, 0.0F, resourceKey);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(ItemStack,int,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1533
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • ItemStack itemStack
  • int i
  • int j
  • int k
  • int l

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

ItemStack itemStack = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(itemStack, 0, 0, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(ItemStack,int,int,int,int,float)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1545
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • ItemStack itemStack
  • int i
  • int j
  • int k
  • int l
  • float f

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

ItemStack itemStack = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(itemStack, 0, 0, 0, 0, 0.0F);

net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds#ItemsForEmeralds(ItemStack,int,int,int,int,float,Optional<ResourceKey<EnchantmentProvider>>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1549
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: itemStack, emeraldCost, maxUses, villagerXp, priceMultiplier, enchantmentProvider. เรียกต่อ: setCount().

Parameters

  • ItemStack itemStack
  • int i
  • int j
  • int k
  • int l
  • float f
  • Optional<ResourceKey<EnchantmentProvider>> optional

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

ItemStack itemStack = ...;
Optional<ResourceKey<EnchantmentProvider>> optional = ...;
VillagerTrades.ItemsForEmeralds instance = new VillagerTrades.ItemsForEmeralds(itemStack, 0, 0, 0, 0, 0.0F, optional);

VillagerTrades$SuspiciousStewForEmerald

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$SuspiciousStewForEmerald
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$SuspiciousStewForEmerald#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1588
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

เรียกต่อ: set(). สร้างออบเจ็กต์: ItemStack, MerchantOffer, ItemCost. คืนค่า: new MerchantOffer(new ItemCost(Items.EMERALD), itemStack, 12, this.xp, this.priceMultiplier).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.SuspiciousStewForEmerald instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

net.minecraft.world.entity.npc.VillagerTrades$SuspiciousStewForEmerald#SuspiciousStewForEmerald(Holder<MobEffect>,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1578
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

เรียกต่อ: of(), Entry(). สร้างออบเจ็กต์: SuspiciousStewEffects, SuspiciousStewEffects.Entry.

Parameters

  • Holder<MobEffect> holder
  • int i
  • int j

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

Holder<MobEffect> holder = ...;
VillagerTrades.SuspiciousStewForEmerald instance = new VillagerTrades.SuspiciousStewForEmerald(holder, 0, 0);

net.minecraft.world.entity.npc.VillagerTrades$SuspiciousStewForEmerald#SuspiciousStewForEmerald(SuspiciousStewEffects,int,float)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1582
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: effects, xp, priceMultiplier.

Parameters

  • SuspiciousStewEffects suspiciousStewEffects
  • int i
  • float f

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

SuspiciousStewEffects suspiciousStewEffects = ...;
VillagerTrades.SuspiciousStewForEmerald instance = new VillagerTrades.SuspiciousStewForEmerald(suspiciousStewEffects, 0, 0.0F);

VillagerTrades$TippedArrowForItemsAndEmeralds

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$TippedArrowForItemsAndEmeralds
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$TippedArrowForItemsAndEmeralds#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1618
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

เรียกต่อ: listElements(), filter(), value(), getEffects(), isEmpty(), level(), potionBrewing(), isBrewablePotion(). สร้างออบเจ็กต์: ItemCost, ItemStack, PotionContents, MerchantOffer. คืนค่า: new MerchantOffer(itemCost, Optional.of(new ItemCost(this.fromItem, this.fromCount)), itemStack, this.maxUses, this.villagerXp, this.priceMultiplier).

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.TippedArrowForItemsAndEmeralds instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

net.minecraft.world.entity.npc.VillagerTrades$TippedArrowForItemsAndEmeralds#TippedArrowForItemsAndEmeralds(Item,int,Item,int,int,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1607
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: toItem, emeraldCost, maxUses, villagerXp, fromItem, fromCount. สร้างออบเจ็กต์: ItemStack.

Parameters

  • Item item
  • int i
  • Item item2
  • int j
  • int k
  • int l
  • int m

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

Item item = ...;
Item item2 = ...;
VillagerTrades.TippedArrowForItemsAndEmeralds instance = new VillagerTrades.TippedArrowForItemsAndEmeralds(item, 0, item2, 0, 0, 0, 0);

VillagerTrades$TreasureMapForEmeralds

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: class
  • Modifiers: public static
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1649
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), findNearestMapStructure(), blockPosition(), create(), getX(), getZ(), renderBiomePreviewMap(), addTargetDecoration(). สร้างออบเจ็กต์: MerchantOffer, ItemCost. มีจุด return อย่างน้อย 2 จุด.

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.TreasureMapForEmeralds instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds#TreasureMapForEmeralds(int,TagKey<Structure>,String,Holder<MapDecorationType>,int,int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1640
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: emeraldCost, destination, displayName, destinationType, maxUses, villagerXp.

Parameters

  • int i
  • TagKey<Structure> tagKey
  • String string
  • Holder<MapDecorationType> holder
  • int j
  • int k

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

TagKey<Structure> tagKey = ...;
Holder<MapDecorationType> holder = ...;
VillagerTrades.TreasureMapForEmeralds instance = new VillagerTrades.TreasureMapForEmeralds(0, tagKey, "value", holder, 0, 0);

VillagerTrades$TypeSpecificTrade

  • Full name: net.minecraft.world.entity.npc.VillagerTrades$TypeSpecificTrade
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerTrades.java
  • Type: record
  • Modifiers: public
  • Implements: VillagerTrades.ItemListing

net.minecraft.world.entity.npc.VillagerTrades$TypeSpecificTrade#getOffer(Entity,RandomSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1679
  • Modifiers: public
  • Return: MerchantOffer

คืออะไร

อ่านค่า Offer

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getVillagerData(), getType(), get(). มีจุด return อย่างน้อย 2 จุด.

Parameters

  • Entity entity
  • RandomSource randomSource

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

VillagerTrades.TypeSpecificTrade instance = ...;
Entity entity = ...;
RandomSource randomSource = ...;
MerchantOffer result = instance.getOffer(entity, randomSource);

net.minecraft.world.entity.npc.VillagerTrades$TypeSpecificTrade#oneTradeInBiomes(VillagerTrades.ItemListing,VillagerType[])

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerTrades.java:1673
  • Modifiers: public static
  • Return: VillagerTrades.TypeSpecificTrade

คืออะไร

ดำเนินการ oneTradeInBiomes ตาม implementation ของ VillagerTrades$TypeSpecificTrade

ทำงานยังไง

เรียกต่อ: TypeSpecificTrade(), stream(), collect(), toMap(). สร้างออบเจ็กต์: VillagerTrades.TypeSpecificTrade.

Parameters

  • VillagerTrades.ItemListing itemListing
  • VillagerType[] villagerTypes

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

VillagerTrades.ItemListing itemListing = ...;
VillagerType[] villagerTypes = ...;
VillagerTrades.TypeSpecificTrade result = VillagerTrades.TypeSpecificTrade.oneTradeInBiomes(itemListing, villagerTypes);

VillagerType

  • Full name: net.minecraft.world.entity.npc.VillagerType
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/VillagerType.java
  • Type: class
  • Modifiers: public final

net.minecraft.world.entity.npc.VillagerType#byBiome(Holder<Biome>)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerType.java:68
  • Modifiers: public static
  • Return: VillagerType

คืออะไร

ดำเนินการ byBiome ตาม implementation ของ VillagerType

ทำงานยังไง

เรียกต่อ: unwrapKey(), map(), orElse(). คืนค่า: holder.unwrapKey().map(BY_BIOME::get).orElse(PLAINS).

Parameters

  • Holder<Biome> holder

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

Holder<Biome> holder = ...;
VillagerType result = VillagerType.byBiome(holder);

net.minecraft.world.entity.npc.VillagerType#toString()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerType.java:59
  • Modifiers: public
  • Return: String

คืออะไร

ดำเนินการ toString ตาม implementation ของ VillagerType

ทำงานยังไง

คืนค่า: this.name.

Parameters

  • ไม่มี

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

VillagerType instance = ...;
String result = instance.toString();

net.minecraft.world.entity.npc.VillagerType#VillagerType(String)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/VillagerType.java:55
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

แก้ state: name.

Parameters

  • String string

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

VillagerType instance = new VillagerType("value");

WanderingTrader

  • Full name: net.minecraft.world.entity.npc.WanderingTrader
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/WanderingTrader.java
  • Type: class
  • Modifiers: public
  • Extends: AbstractVillager
  • Implements: Consumable.OverrideConsumeSound

net.minecraft.world.entity.npc.WanderingTrader#addAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:160
  • Modifiers: public
  • Return: void

คืออะไร

เพิ่ม Additional Save Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: putInt(), put(), writeBlockPos().

Parameters

  • CompoundTag compoundTag

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

WanderingTrader instance = ...;
CompoundTag compoundTag = ...;
instance.addAdditionalSaveData(compoundTag);

net.minecraft.world.entity.npc.WanderingTrader#aiStep()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:231
  • Modifiers: public
  • Return: void

คืออะไร

ดำเนินการ aiStep ตาม implementation ของ WanderingTrader

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), maybeDespawn().

Parameters

  • ไม่มี

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

WanderingTrader instance = ...;
instance.aiStep();

net.minecraft.world.entity.npc.WanderingTrader#getAmbientSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:193
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Ambient Sound

ทำงานยังไง

เรียกต่อ: isTrading(). คืนค่า: this.isTrading() ? SoundEvents.WANDERING_TRADER_TRADE : SoundEvents.WANDERING_TRADER_AMBIENT.

Parameters

  • ไม่มี

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

@Override
protected SoundEvent getAmbientSound() {
    return super.getAmbientSound();
}

net.minecraft.world.entity.npc.WanderingTrader#getBreedOffspring(ServerLevel,AgeableMob)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:97
  • Modifiers: public
  • Return: AgeableMob

คืออะไร

อ่านค่า Breed Offspring

ทำงานยังไง

คืนค่า: null.

Parameters

  • ServerLevel serverLevel
  • AgeableMob ageableMob

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

WanderingTrader instance = ...;
ServerLevel serverLevel = ...;
AgeableMob ageableMob = ...;
AgeableMob result = instance.getBreedOffspring(serverLevel, ageableMob);

net.minecraft.world.entity.npc.WanderingTrader#getConsumeSound(ItemStack)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:208
  • Modifiers: public
  • Return: SoundEvent

คืออะไร

อ่านค่า Consume Sound

ทำงานยังไง

เรียกต่อ: is(). คืนค่า: itemStack.is(Items.MILK_BUCKET) ? SoundEvents.WANDERING_TRADER_DRINK_MILK : SoundEvents.WANDERING_TRADER_DRINK_POTION.

Parameters

  • ItemStack itemStack

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

WanderingTrader instance = ...;
ItemStack itemStack = ...;
SoundEvent result = instance.getConsumeSound(itemStack);

net.minecraft.world.entity.npc.WanderingTrader#getDeathSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:203
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Death Sound

ทำงานยังไง

คืนค่า: SoundEvents.WANDERING_TRADER_DEATH.

Parameters

  • ไม่มี

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

@Override
protected SoundEvent getDeathSound() {
    return super.getDeathSound();
}

net.minecraft.world.entity.npc.WanderingTrader#getDespawnDelay()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:227
  • Modifiers: public
  • Return: int

คืออะไร

อ่านค่า Despawn Delay

ทำงานยังไง

คืนค่า: this.despawnDelay.

Parameters

  • ไม่มี

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

WanderingTrader instance = ...;
int result = instance.getDespawnDelay();

net.minecraft.world.entity.npc.WanderingTrader#getHurtSound(DamageSource)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:198
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Hurt Sound

ทำงานยังไง

คืนค่า: SoundEvents.WANDERING_TRADER_HURT.

Parameters

  • DamageSource damageSource

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

DamageSource damageSource = ...;
@Override
protected SoundEvent getHurtSound(DamageSource damageSource) {
    return super.getHurtSound(damageSource);
}

net.minecraft.world.entity.npc.WanderingTrader#getNotifyTradeSound()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:218
  • Modifiers: public
  • Return: SoundEvent

คืออะไร

อ่านค่า Notify Trade Sound

ทำงานยังไง

คืนค่า: SoundEvents.WANDERING_TRADER_YES.

Parameters

  • ไม่มี

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

WanderingTrader instance = ...;
SoundEvent result = instance.getNotifyTradeSound();

net.minecraft.world.entity.npc.WanderingTrader#getTradeUpdatedSound(boolean)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:213
  • Modifiers: protected
  • Return: SoundEvent

คืออะไร

อ่านค่า Trade Updated Sound

ทำงานยังไง

คืนค่า: bl ? SoundEvents.WANDERING_TRADER_YES : SoundEvents.WANDERING_TRADER_NO.

Parameters

  • boolean bl

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

@Override
protected SoundEvent getTradeUpdatedSound(boolean bl) {
    return super.getTradeUpdatedSound(bl);
}

net.minecraft.world.entity.npc.WanderingTrader#mobInteract(Player,InteractionHand)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:108
  • Modifiers: public
  • Return: InteractionResult

คืออะไร

ดำเนินการ mobInteract ตาม implementation ของ WanderingTrader

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: getItemInHand(), is(), isAlive(), isTrading(), isBaby(), awardStat(), level(), getOffers(). มีจุด return อย่างน้อย 3 จุด.

Parameters

  • Player player
  • InteractionHand interactionHand

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

WanderingTrader instance = ...;
Player player = ...;
InteractionHand interactionHand = ...;
InteractionResult result = instance.mobInteract(player, interactionHand);

net.minecraft.world.entity.npc.WanderingTrader#readAdditionalSaveData(CompoundTag)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:169
  • Modifiers: public
  • Return: void

คืออะไร

อ่าน Additional Save Data

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: despawnDelay, wanderTarget. เรียกต่อ: contains(), getInt(), readBlockPos(), ifPresent(), setAge(), max(), getAge().

Parameters

  • CompoundTag compoundTag

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

WanderingTrader instance = ...;
CompoundTag compoundTag = ...;
instance.readAdditionalSaveData(compoundTag);

net.minecraft.world.entity.npc.WanderingTrader#registerGoals()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:60
  • Modifiers: protected
  • Return: void

คืออะไร

ลงทะเบียน Goals

ทำงานยังไง

เรียกต่อ: addGoal(), createItemStack(), level(), isNight(), isInvisible(), isDay(), WanderToPositionGoal(). สร้างออบเจ็กต์: FloatGoal, UseItemGoal<>, ItemStack, TradeWithPlayerGoal.

Parameters

  • ไม่มี

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

@Override
protected void registerGoals() {
    super.registerGoals();
}

net.minecraft.world.entity.npc.WanderingTrader#removeWhenFarAway(double)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:180
  • Modifiers: public
  • Return: boolean

คืออะไร

ลบ When Far Away

ทำงานยังไง

คืนค่า: false.

Parameters

  • double d

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

WanderingTrader instance = ...;
boolean result = instance.removeWhenFarAway(0.0D);

net.minecraft.world.entity.npc.WanderingTrader#rewardTradeXp(MerchantOffer)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:185
  • Modifiers: protected
  • Return: void

คืออะไร

ดำเนินการ rewardTradeXp ตาม implementation ของ WanderingTrader

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: shouldRewardExp(), nextInt(), level(), addFreshEntity(), getX(), getY(), getZ(). สร้างออบเจ็กต์: ExperienceOrb.

Parameters

  • MerchantOffer merchantOffer

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

MerchantOffer merchantOffer = ...;
@Override
protected void rewardTradeXp(MerchantOffer merchantOffer) {
    super.rewardTradeXp(merchantOffer);
}

net.minecraft.world.entity.npc.WanderingTrader#setDespawnDelay(int)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:223
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Despawn Delay

ทำงานยังไง

แก้ state: despawnDelay.

Parameters

  • int i

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

WanderingTrader instance = ...;
instance.setDespawnDelay(0);

net.minecraft.world.entity.npc.WanderingTrader#setWanderTarget(BlockPos)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:245
  • Modifiers: public
  • Return: void

คืออะไร

กำหนดค่า Wander Target

ทำงานยังไง

แก้ state: wanderTarget.

Parameters

  • BlockPos blockPos

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

WanderingTrader instance = ...;
BlockPos blockPos = ...;
instance.setWanderTarget(blockPos);

net.minecraft.world.entity.npc.WanderingTrader#showProgressBar()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:103
  • Modifiers: public
  • Return: boolean

คืออะไร

ดำเนินการ showProgressBar ตาม implementation ของ WanderingTrader

ทำงานยังไง

คืนค่า: false.

Parameters

  • ไม่มี

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

WanderingTrader instance = ...;
boolean result = instance.showProgressBar();

net.minecraft.world.entity.npc.WanderingTrader#updateTrades()

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:131
  • Modifiers: protected
  • Return: void

คืออะไร

อัปเดต Trades

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: level(), enabledFeatures(), contains(), experimentalUpdateTrades(), get(), getOffers(), addOffersFromItemListings(), nextInt().

Parameters

  • ไม่มี

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

@Override
protected void updateTrades() {
    super.updateTrades();
}

net.minecraft.world.entity.npc.WanderingTrader#WanderingTrader(EntityType<? extends WanderingTrader>,Level)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTrader.java:56
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

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

Parameters

  • EntityType<? extends WanderingTrader> entityType
  • Level level

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

EntityType<? extends WanderingTrader> entityType = ...;
Level level = ...;
WanderingTrader instance = new WanderingTrader(entityType, level);

WanderingTraderSpawner

  • Full name: net.minecraft.world.entity.npc.WanderingTraderSpawner
  • Package: net.minecraft.world.entity.npc
  • Source: commonnet/minecraft/world/entity/npc/WanderingTraderSpawner.java
  • Type: class
  • Modifiers: public
  • Implements: CustomSpawner

net.minecraft.world.entity.npc.WanderingTraderSpawner#tick(ServerLevel,boolean,boolean)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTraderSpawner.java:52
  • Modifiers: public
  • Return: int

คืออะไร

ประมวลผล tick tick

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: tickDelay, spawnDelay, spawnChance. เรียกต่อ: getGameRules(), getBoolean(), setWanderingTraderSpawnDelay(), clamp(), setWanderingTraderSpawnChance(), nextInt(), spawn(). มีจุด return อย่างน้อย 7 จุด.

Parameters

  • ServerLevel serverLevel
  • boolean bl
  • boolean bl2

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

WanderingTraderSpawner instance = ...;
ServerLevel serverLevel = ...;
int result = instance.tick(serverLevel, true, true);

net.minecraft.world.entity.npc.WanderingTraderSpawner#WanderingTraderSpawner(ServerLevelData)

  • Origin: common
  • Source: net/minecraft/world/entity/npc/WanderingTraderSpawner.java:39
  • Modifiers: public
  • Kind: constructor

คืออะไร

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

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. แก้ state: serverLevelData, tickDelay, spawnDelay, spawnChance. เรียกต่อ: getWanderingTraderSpawnDelay(), getWanderingTraderSpawnChance(), setWanderingTraderSpawnDelay(), setWanderingTraderSpawnChance().

Parameters

  • ServerLevelData serverLevelData

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

ServerLevelData serverLevelData = ...;
WanderingTraderSpawner instance = new WanderingTraderSpawner(serverLevelData);