net.minecraft.entity.passive

public class VillagerEntity

extends MerchantEntity implements VillagerDataContainer, InteractionObserver

All mapped superinterfaces:

Nameable, EntityLike, UniquelyIdentifiable, ScoreHolder, DataTracked, ComponentsAccess, HeldItemContext, StackReferenceGetter, DebugTrackable, EntryConvertible, Attackable, ServerWaypoint, Waypoint, Targeter, EquipmentHolder, Leashable, Npc, Merchant, InventoryOwner, VillagerDataContainer, InteractionObserver

net.minecraft.world.entity.npc.villager.Villager
net.minecraft.class_1646
net.minecraft.entity.passive.VillagerEntity

Field summary

Modifier and TypeField
private static final org.slf4j.Logger
LOGGER
field_36335
LOGGER
private static final TrackedData<VillagerData>
DATA_VILLAGER_DATA
field_7445
VILLAGER_DATA
private static final TrackedData<Boolean>
DATA_VILLAGER_DATA_FINALIZED
field_1_625
VILLAGER_DATA_FINALIZED
public static final int
BREEDING_FOOD_THRESHOLD
field_30602
field_30602
public static final Map<Item, Integer>
FOOD_POINTS
field_18526
ITEM_FOOD_VALUES
private static final int
MAX_GOSSIP_TOPICS
field_30605
field_30605
private static final int
GOSSIP_COOLDOWN
field_30606
field_30606
private static final int
GOSSIP_DECAY_INTERVAL
field_30607
field_30607
private static final int
HOW_FAR_AWAY_TO_TALK_TO_OTHER_VILLAGERS_ABOUT_GOLEMS
field_30609
field_30609
private static final int
HOW_MANY_VILLAGERS_NEED_TO_AGREE_TO_SPAWN_A_GOLEM
field_30610
field_30610
private static final long
TIME_SINCE_SLEEPING_FOR_GOLEM_SPAWNING
field_30611
field_30611
public static final float
SPEED_MODIFIER
field_30603
field_30603
private static final int
DEFAULT_XP
field_57709
field_57709
private static final byte
DEFAULT_FOOD_LEVEL
field_57710
field_57710
private static final int
DEFAULT_LAST_RESTOCK
field_57711
field_57711
private static final int
DEFAULT_LAST_GOSSIP_DECAY
field_57712
field_57712
private static final int
DEFAULT_RESTOCKS_TODAY
field_57713
field_57713
private static final boolean
DEFAULT_ASSIGN_PROFESSION_WHEN_SPAWNED
field_57714
DEFAULT_NATURAL
private static final EntityDimensions
BABY_DIMENSIONS
field_1_1851
BABY_DIMENSIONS
private int
updateMerchantTimer
field_18528
levelUpTimer
private boolean
increaseProfessionLevelOnUpdate
field_18529
levelingUp
private PlayerEntity
lastTradedPlayer
field_18530
lastCustomer
private int
foodLevel
field_18533
foodLevel
private final VillagerGossips
gossips
field_18534
gossip
private long
lastGossipTime
field_18535
gossipStartTime
private long
lastGossipDecayTime
field_19357
lastGossipDecayTime
private int
villagerXp
field_18536
experience
private long
lastRestockGameTime
field_18537
lastRestockTime
private int
numberOfRestocksToday
field_19427
restocksToday
private long
lastRestockCheckDay
field_20332
lastRestockCheckTime
private boolean
assignProfessionWhenSpawned
field_25167
natural
private static final Brain$Profile<VillagerEntity>
BRAIN_PROVIDER
field_1_1197
PROFILE
public static final Map<MemoryModuleType<GlobalPos>, BiPredicate<VillagerEntity, RegistryEntry<PointOfInterestType>>>
POI_MEMORIES
field_18851
POINTS_OF_INTEREST

Constructor summary

ModifierConstructor
public (EntityType<? extends VillagerEntity> entityType, World level)

Method summary

Modifier and TypeMethod
public Brain<VillagerEntity>
getBrain()
method_18868()
getBrain()
protected Brain<VillagerEntity>
makeBrain(Brain$Packed packedBrain)
method_18867(class_4095$class_1_142 arg0)
deserializeBrain(Brain$State arg0)
public void
refreshBrain(ServerLevel level)
method_19179(class_3218 arg0)
reinitializeBrain(ServerWorld world)
private void
registerBrainGoals(Brain<Villager> brain)
method_19174(class_4095<class_1646> arg0)
initBrain(Brain<VillagerEntity> brain)
protected void
ageBoundaryReached()
method_5619()
onGrowUp()
public static DefaultAttributeContainer$Builder
createAttributes()
method_26955()
createVillagerAttributes()
public boolean
assignProfessionWhenSpawned()
method_29279()
isNatural()
protected void
customServerAiStep(ServerLevel level)
method_5958(class_3218 arg0)
mobTick(ServerWorld arg0)
public void
tick()
method_5773()
tick()
public ActionResult
mobInteract(Player player, InteractionHand hand)
method_5992(class_1657 arg0, class_1268 arg1)
interactMob(PlayerEntity arg0, Hand arg1)
private void
setUnhappy()
method_20264()
sayNo()
private void
startTrading(Player player)
method_19191(class_1657 arg0)
beginTradeWith(PlayerEntity customer)
public void
setTradingPlayer(Player player)
method_8259(class_1657 arg0)
setCustomer(PlayerEntity arg0)
protected void
stopTrading()
method_19181()
resetCustomer()
private void
resetSpecialPrices()
method_19187()
clearSpecialPrices()
public EntityDimensions
getDefaultDimensions(Pose pose)
method_55694(class_4050 arg0)
getBaseDimensions(EntityPose arg0)
public boolean
canRestock()
method_20708()
canRefreshTrades()
public void
restock()
method_19182()
restock()
private void
resendOffersToTradingPlayer()
method_49695()
sendOffersToCustomer()
private boolean
needsToRestock()
method_20823()
needsRestock()
private boolean
allowedToRestock()
method_20824()
canRestock()
public boolean
shouldRestock(ServerLevel level)
method_20822(class_3218 arg0)
shouldRestock(ServerWorld world)
private void
catchUpDemand()
method_21723()
restockAndUpdateDemandBonus()
private void
updateDemand()
method_21724()
updateDemandBonus()
private void
updateSpecialPrices(Player player)
method_19192(class_1657 arg0)
prepareOffersFor(PlayerEntity player)
protected void
defineSynchedData(SynchedEntityData$Builder entityData)
method_5693(class_2945$class_9222 arg0)
initDataTracker(DataTracker$Builder arg0)
public static VillagerData
createDefaultVillagerData()
method_67359()
createVillagerData()
protected void
addAdditionalSaveData(ValueOutput output)
method_5652(class_11372 arg0)
writeCustomData(WriteView arg0)
protected void
readAdditionalSaveData(ValueInput input)
method_5749(class_11368 arg0)
readCustomData(ReadView arg0)
public boolean
removeWhenFarAway(double distSqr)
method_5974(double arg0)
canImmediatelyDespawn(double arg0)
protected SoundEvent
getAmbientSound()
method_5994()
getAmbientSound()
protected SoundEvent
getHurtSound(DamageSource source)
method_6011(class_1282 arg0)
getHurtSound(DamageSource arg0)
protected SoundEvent
getDeathSound()
method_6002()
getDeathSound()
public void
playWorkSound()
method_19183()
playWorkSound()
public void
setVillagerData(VillagerData data)
method_7195(class_3850 arg0)
setVillagerData(VillagerData arg0)
public boolean
getVillagerDataFinalized()
method_1_5274()
isVillagerDataFinalized()
public void
setVillagerDataFinalized(boolean villagerDataFinalized)
method_1_5275(boolean arg0)
setVillagerDataFinalized(boolean arg0)
public VillagerData
getVillagerData()
method_7231()
getVillagerData()
protected void
rewardTradeXp(MerchantOffer offer)
method_18008(class_1914 arg0)
afterUsing(TradeOffer arg0)
public void
setLastHurtByMob(LivingEntity hurtBy)
method_6015(class_1309 arg0)
setAttacker(LivingEntity arg0)
public void
die(DamageSource source)
method_6078(class_1282 arg0)
onDeath(DamageSource arg0)
private void
releaseAllPois()
method_30958()
releaseAllTickets()
private void
tellWitnessesThatIWasMurdered(Entity murderer)
method_20690(class_1297 arg0)
notifyDeath(Entity killer)
public void
releasePoi(MemoryModuleType<GlobalPos> memoryType)
method_19176(class_4140<class_4208> arg0)
releaseTicketFor(MemoryModuleType<GlobalPos> pos)
public boolean
canBreed()
method_19184()
isReadyToBreed()
private boolean
hungry()
method_20698()
canEatFood()
private void
eatUntilFull()
method_19185()
consumeAvailableFood()
public int
getPlayerReputation(Player player)
method_20594(class_1657 arg0)
getReputation(PlayerEntity player)
private void
digestFood(int amount)
method_19193(int arg0)
depleteFood(int amount)
public void
eatAndDigestFood()
method_20697()
eatForBreeding()
public void
setOffers(MerchantOffers offers)
method_16917(class_1916 arg0)
setOffers(TradeOfferList offers)
private boolean
shouldIncreaseLevel()
method_19188()
canLevelUp()
private void
increaseMerchantCareer(ServerLevel level)
method_16918(class_3218 arg0)
levelUp(ServerWorld world)
protected Text
getTypeName()
method_23315()
getDefaultName()
public void
handleEntityEvent(byte id)
method_5711(byte arg0)
handleStatus(byte arg0)
public EntityData
finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, SpawnGroupData groupData)
method_5943(class_5425 arg0, class_1266 arg1, class_3730 arg2, class_1315 arg3)
initialize(ServerWorldAccess arg0, LocalDifficulty arg1, SpawnReason arg2, EntityData arg3)
public VillagerEntity
getBreedOffspring(ServerLevel level, AgeableMob partner)
method_5613(class_3218 arg0, class_1296 arg1)
createChild(ServerWorld arg0, PassiveEntity arg1)
public void
thunderHit(ServerLevel level, LightningBolt lightningBolt)
method_5800(class_3218 arg0, class_1538 arg1)
onStruckByLightning(ServerWorld arg0, LightningEntity arg1)
protected void
pickUpItem(ServerLevel level, ItemEntity entity)
method_5949(class_3218 arg0, class_1542 arg1)
loot(ServerWorld arg0, ItemEntity arg1)
public boolean
wantsToPickUp(ServerLevel level, ItemStack itemStack)
method_20820(class_3218 arg0, class_1799 arg1)
canGather(ServerWorld arg0, ItemStack arg1)
public boolean
hasExcessFood()
method_7234()
canShareFoodForBreeding()
public boolean
wantsMoreFood()
method_7239()
needsFoodForBreeding()
private int
countFoodPointsInInventory()
method_19189()
getAvailableFood()
public boolean
hasFarmSeeds()
method_19623()
hasSeedToPlant()
protected void
updateTrades(ServerLevel level)
method_7237(class_3218 arg0)
fillRecipes(ServerWorld arg0)
public void
gossip(ServerLevel level, Villager target, long timestamp)
method_19177(class_3218 arg0, class_1646 arg1, long arg2)
talkWithVillager(ServerWorld world, VillagerEntity villager, long time)
private void
maybeDecayGossip()
method_20696()
decayGossip()
public void
spawnGolemIfNeeded(ServerLevel level, long timestamp, int villagersNeededToAgree)
method_20688(class_3218 arg0, long arg1, int arg2)
summonGolem(ServerWorld world, long time, int requiredCount)
public boolean
wantsToSpawnGolem(long timestamp)
method_20687(long arg0)
canSummonGolem(long time)
public void
onReputationEventFrom(ReputationEventType type, Entity source)
method_18870(class_4151 arg0, class_1297 arg1)
onInteractionWith(EntityInteraction arg0, Entity arg1)
public int
getVillagerXp()
method_19269()
getExperience()
public void
setVillagerXp(int value)
method_19625(int arg0)
setExperience(int experience)
private void
resetNumberOfRestocks()
method_20821()
clearDailyRestockCount()
public VillagerGossips
getGossips()
method_21651()
getGossip()
public void
setGossips(GossipContainer gossips)
method_21650(class_4136 arg0)
readGossipData(VillagerGossips gossips)
public void
stopSleeping()
method_18400()
wakeUp()
private boolean
golemSpawnConditionsMet(long gameTime)
method_20741(long arg0)
hasRecentlySlept(long worldTime)
public <T> T
get(DataComponentType<? extends T> type)
method_58694(class_9331<? extends T> arg0)
get(ComponentType<? extends T> arg0)
protected void
applyImplicitComponents(DataComponentGetter components)
method_66649(class_9473 arg0)
copyComponentsFrom(ComponentsAccess arg0)
protected <T> boolean
applyImplicitComponent(DataComponentType<T> type, T value)
method_66654(class_9331<T> arg0, T arg1)
setApplicableComponent(ComponentType<T> arg0, T arg1)
public PassiveEntity
getBreedOffspring(ServerLevel level, AgeableMob partner)
method_5613(class_3218 arg0, class_1296 arg1)
createChild(ServerWorld arg0, PassiveEntity arg1)
private static boolean
lambda$golemSpawnConditionsMet$0(long arg0, Long arg1)
method_63012(long arg0, Long arg1)
method_63012(long arg0, Long lastSlept)
private static boolean
lambda$spawnGolemIfNeeded$0(long arg0, Villager arg1)
method_20693(long arg0, class_1646 arg1)
method_20693(long arg0, VillagerEntity villager)
private static boolean
lambda$hasFarmSeeds$0(ItemStack arg0)
method_51304(class_1799 arg0)
method_51304(ItemStack stack)
private static int
lambda$countFoodPointsInInventory$0(SimpleContainer arg0, Map$Entry arg1)
method_19172(class_1277 arg0, Map$Entry arg1)
method_19172(SimpleInventory arg0, Map$Entry item)
private void
lambda$thunderHit$0(ServerLevel arg0, Witch arg1)
method_63666(class_3218 arg0, class_1640 arg1)
method_63666(ServerWorld arg0, WitchEntity witch)
private static boolean
lambda$getPlayerReputation$0(GossipType arg0)
method_20593(class_4139 arg0)
method_20593(VillagerGossipType gossipType)
private void
lambda$releasePoi$0(MinecraftServer arg0, MemoryModuleType arg1, GlobalPos arg2)
method_19178(MinecraftServer arg0, class_4140 arg1, class_4208 arg2)
method_19178(MinecraftServer arg0, MemoryModuleType arg1, GlobalPos posx)
private static void
lambda$tellWitnessesThatIWasMurdered$0(ServerLevel arg0, Entity arg1, LivingEntity arg2)
method_20699(class_3218 arg0, class_1297 arg1, class_1309 arg2)
method_20699(ServerWorld arg0, Entity arg1, LivingEntity observer)
private static Integer
lambda$shouldRestock$0(ServerLevel arg0, Holder$Reference arg1)
method_1_1020(class_3218 arg0, class_6880$class_6883 arg1)
method_1_1020(ServerWorld arg0, RegistryEntry$Reference day)
private static boolean
lambda$static$4(Villager arg0, Holder arg1)
method_19520(class_1646 arg0, class_6880 arg1)
method_19520(VillagerEntity villager, RegistryEntry poi)
private static boolean
lambda$static$3(Villager arg0, Holder arg1)
method_29278(class_1646 arg0, class_6880 arg1)
method_29278(VillagerEntity villager, RegistryEntry poi)
private static boolean
lambda$static$2(Villager arg0, Holder arg1)
method_19521(class_1646 arg0, class_6880 arg1)
method_19521(VillagerEntity villager, RegistryEntry poi)
private static boolean
lambda$static$1(Villager arg0, Holder arg1)
method_19522(class_1646 arg0, class_6880 arg1)
method_19522(VillagerEntity villager, RegistryEntry poi)
private static List
lambda$static$0(Villager arg0)
method_1_1401(class_1646 arg0)
method_1_1401(VillagerEntity villager)