Package net.minecraft.world.entity.npc
Class Villager
- All Implemented Interfaces:
DataComponentGetter
,SyncedDataHolder
,Attackable
,EquipmentUser
,Leashable
,InventoryCarrier
,Npc
,VillagerDataHolder
,ReputationEventHandler
,Targeting
,Merchant
,EntityAccess
,UniquelyIdentifyable
,Nameable
,ScoreHolder
,IAttachmentHolder
,IEntityExtension
,ILivingEntityExtension
public class Villager
extends AbstractVillager
implements ReputationEventHandler, VillagerDataHolder
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.AgeableMob
AgeableMob.AgeableMobGroupData
Nested classes/interfaces inherited from class net.minecraft.world.entity.LivingEntity
LivingEntity.Fallsounds
Nested classes/interfaces inherited from class net.minecraft.world.entity.Entity
Entity.MoveFunction, Entity.MovementEmission, Entity.RemovalReason
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
Nested classes/interfaces inherited from interface net.minecraft.world.entity.Leashable
Leashable.LeashData
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
static final int
private boolean
private static final EntityDataAccessor
<VillagerData> private static final boolean
private static final byte
private static final int
private static final int
private static final int
private static final int
private int
private static final int
private static final int
private final GossipContainer
private static final int
private static final int
private boolean
private long
private long
private long
private long
private Player
private static final org.slf4j.Logger
private static final int
private static final com.google.common.collect.ImmutableList
<MemoryModuleType<?>> private int
static final Map
<MemoryModuleType<GlobalPos>, BiPredicate<Villager, Holder<PoiType>>> private static final com.google.common.collect.ImmutableList
<SensorType<? extends Sensor<? super Villager>>> static final float
private static final long
private static final int
private int
private int
Fields inherited from class net.minecraft.world.entity.npc.AbstractVillager
offers, VILLAGER_SLOT_OFFSET
Fields inherited from class net.minecraft.world.entity.AgeableMob
age, BABY_START_AGE, DEFAULT_AGE, DEFAULT_FORCED_AGE, forcedAge, forcedAgeTimer
Fields inherited from class net.minecraft.world.entity.PathfinderMob
DEFAULT_WALK_TARGET_VALUE
Fields inherited from class net.minecraft.world.entity.Mob
ambientSoundTime, goalSelector, jumpControl, lookControl, MAX_ENCHANTED_ARMOR_CHANCE, MAX_ENCHANTED_WEAPON_CHANCE, MAX_PICKUP_LOOT_CHANCE, MAX_WEARING_ARMOR_CHANCE, moveControl, navigation, PICKUP_REACH, preventConversionSpawns, RANDOM_SPAWN_BONUS_ID, targetSelector, UPDATE_GOAL_SELECTOR_EVERY_N_TICKS, xpReward
Fields inherited from class net.minecraft.world.entity.LivingEntity
ARMOR_SLOT_OFFSET, attackAnim, attackStrengthTicker, ATTRIBUTES_FIELD, autoSpinAttackDmg, autoSpinAttackItemStack, autoSpinAttackTicks, BASE_JUMP_POWER, BODY_ARMOR_OFFSET, brain, damageContainers, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathTime, DEFAULT_BABY_SCALE, DEFAULT_BASE_GRAVITY, elytraAnimationState, equipment, EQUIPMENT_SLOT_OFFSET, EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT, fallFlyTicks, hurtDuration, hurtTime, INPUT_FRICTION, interpolation, invulnerableDuration, jumping, lastHurt, lastHurtByPlayer, lastHurtByPlayerMemoryTime, lerpHeadSteps, lerpYHeadRot, LIVING_ENTITY_FLAG_IS_USING, LIVING_ENTITY_FLAG_OFF_HAND, LIVING_ENTITY_FLAG_SPIN_ATTACK, MIN_MOVEMENT_DISTANCE, noActionTime, oAttackAnim, PLAYER_HURT_EXPERIENCE_TIME, PLAYER_NOT_WEARING_DISGUISE_ITEM, PLAYER_NOT_WEARING_DISGUISE_ITEM_FOR_TARGET, removeArrowTime, removeStingerTime, SADDLE_OFFSET, SLEEPING_DIMENSIONS, SWING_DURATION, swinging, swingingArm, swingTime, useItem, useItemRemaining, walkAnimation, xxa, yBodyRot, yBodyRotO, yHeadRot, yHeadRotO, yya, zza
Fields inherited from class net.minecraft.world.entity.Entity
BASE_SAFE_FALL_DISTANCE, BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, CONTENTS_SLOT_INDEX, DATA_POSE, DATA_SHARED_FLAGS_ID, DEFAULT_BB_HEIGHT, DEFAULT_BB_WIDTH, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5, DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0, ENTITY_COUNTER, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, ID_TAG, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, minorHorizontalCollision, moveDist, noPhysics, PASSENGERS_TAG, portalProcess, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, verticalCollision, verticalCollisionBelow, wasEyeInWater, wasInPowderSnow, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOld
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
Fields inherited from interface net.minecraft.world.entity.npc.InventoryCarrier
TAG_INVENTORY
Fields inherited from interface net.minecraft.world.entity.Leashable
LEASH_ELASTIC_DIST, LEASH_TAG, LEASH_TOO_FAR_DIST
Fields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionVillager
(EntityType<? extends Villager> p_35381_, Level p_35382_) Villager
(EntityType<? extends Villager> p_35384_, Level p_35385_, Holder<VillagerType> p_397796_) Villager
(EntityType<? extends Villager> p_397440_, Level p_397835_, ResourceKey<VillagerType> p_397907_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdditionalSaveData
(CompoundTag p_35481_) protected void
private boolean
protected <T> boolean
applyImplicitComponent
(DataComponentType<T> p_397041_, T p_397334_) protected void
applyImplicitComponents
(DataComponentGetter p_397236_) boolean
protected Brain.Provider
<Villager> boolean
canBreed()
boolean
private void
private int
static AttributeSupplier.Builder
static VillagerData
protected void
customServerAiStep
(ServerLevel p_376753_) protected void
defineSynchedData
(SynchedEntityData.Builder p_326013_) void
die
(DamageSource p_35419_) private void
digestFood
(int p_35549_) void
private void
finalizeSpawn
(ServerLevelAccessor p_35439_, DifficultyInstance p_35440_, EntitySpawnReason p_363222_, SpawnGroupData p_35442_) <T> T
get
(DataComponentType<? extends T> p_397071_) protected SoundEvent
getBrain()
getBreedOffspring
(ServerLevel p_150012_, AgeableMob p_150013_) protected SoundEvent
protected SoundEvent
getHurtSound
(DamageSource p_35498_) int
getPlayerReputation
(Player p_35533_) protected Component
int
private boolean
golemSpawnConditionsMet
(long p_35462_) void
gossip
(ServerLevel p_35412_, Villager p_35413_, long p_35414_) void
handleEntityEvent
(byte p_35391_) boolean
boolean
private boolean
hungry()
private void
protected Brain
<?> makeBrain
(com.mojang.serialization.Dynamic<?> p_35445_) private void
mobInteract
(Player p_35472_, InteractionHand p_35473_) private boolean
void
onReputationEventFrom
(ReputationEventType p_35431_, Entity p_35432_) protected void
pickUpItem
(ServerLevel p_376425_, ItemEntity p_35467_) void
void
readAdditionalSaveData
(CompoundTag p_35451_) void
refreshBrain
(ServerLevel p_35484_) private void
registerBrainGoals
(Brain<Villager> p_35425_) private void
void
releasePoi
(MemoryModuleType<GlobalPos> p_35429_) boolean
removeWhenFarAway
(double p_35535_) private void
private void
private void
void
restock()
protected void
rewardTradeXp
(MerchantOffer p_35475_) protected void
void
setGossips
(GossipContainer p_405179_) void
setLastHurtByMob
(LivingEntity p_35423_) void
setOffers
(MerchantOffers p_35477_) void
setTradingPlayer
(Player p_35508_) private void
void
setVillagerData
(VillagerData p_35437_) void
setVillagerXp
(int p_35547_) private boolean
boolean
void
spawnGolemIfNeeded
(ServerLevel p_35398_, long p_35399_, int p_35400_) void
startSleeping
(BlockPos p_35479_) private void
startTrading
(Player p_35537_) void
protected void
private void
tellWitnessesThatIWasMurdered
(Entity p_35421_) void
thunderHit
(ServerLevel p_35409_, LightningBolt p_35410_) void
tick()
private void
private void
updateSpecialPrices
(Player p_35541_) protected void
boolean
boolean
wantsToPickUp
(ServerLevel p_376823_, ItemStack p_35543_) boolean
wantsToSpawnGolem
(long p_35393_) Methods inherited from class net.minecraft.world.entity.npc.AbstractVillager
addOffersFromItemListings, addParticlesAroundSelf, canBeLeashed, getInventory, getNotifyTradeSound, getOffers, getRopeHoldPosition, getSlot, getTradeUpdatedSound, getTradingPlayer, getUnhappyCounter, isClientSide, isTrading, notifyTrade, notifyTradeUpdated, overrideOffers, overrideXp, playCelebrateSound, setUnhappyCounter, showProgressBar, stillValid, teleport
Methods inherited from class net.minecraft.world.entity.AgeableMob
ageUp, ageUp, aiStep, getAge, getForcedAge, getForcedAgeTimer, getSpeedUpSecondsWhenFeeding, isBaby, onSyncedDataUpdated, setAge, setBaby
Methods inherited from class net.minecraft.world.entity.PathfinderMob
checkSpawnRules, closeRangeLeashBehaviour, followLeashSpeed, getWalkTargetValue, getWalkTargetValue, handleLeashAtDistance, isPanicking, isPathFinding, shouldStayCloseToLeashHolder
Methods inherited from class net.minecraft.world.entity.Mob
ate, baseTick, canAttackType, canDispenserEquipIntoSlot, canFireProjectileWeapon, canHoldItem, canPickUpLoot, canReplaceCurrentItem, canReplaceEqualItem, canSimulateMovement, checkDespawn, checkMobSpawnRules, checkSpawnObstruction, clampHeadRotationToBody, clearRestriction, convertTo, convertTo, createBodyControl, createEquipmentSlotContainer, createMobAttributes, createNavigation, doHurtTarget, dropCustomDeathLoot, dropFromLootTable, dropPreservedEquipment, dropPreservedEquipment, enchantSpawnedArmor, enchantSpawnedWeapon, equip, equip, equipItemIfPossible, getAmbientSoundInterval, getAttackBoundingBox, getBaseExperienceReward, getBodyArmorItem, getControllingPassenger, getDropChances, getEquipmentForSlot, getHeadRotSpeed, getJumpControl, getLeashData, getLookControl, getLootTable, getLootTableSeed, getMainArm, getMaxFallDistance, getMaxHeadXRot, getMaxHeadYRot, getMaxSpawnClusterSize, getMoveControl, getNavigation, getPathfindingMalus, getPickResult, getPickupReach, getPreferredWeaponType, getRestrictCenter, getRestrictRadius, getSensing, getSpawnType, getTarget, getTargetFromBrain, hasRestriction, interact, isAggressive, isEffectiveAi, isLeftHanded, isMaxGroupSizeReached, isNoAi, isPersistenceRequired, isSaddled, isSpawnCancelled, isSunBurnTick, isWearingBodyArmor, isWithinMeleeAttackRange, isWithinRestriction, isWithinRestriction, jumpInFluid, jumpInLiquid, leashTooFarBehaviour, lookAt, onAttributeUpdated, onLeashRemoved, onOffspringSpawnedFromEgg, onPathfindingDone, onPathfindingStart, playAmbientSound, playAttackSound, playHurtSound, populateDefaultEquipmentEnchantments, populateDefaultEquipmentSlots, registerGoals, removeAfterChangingDimensions, removeAllGoals, removeFreeWill, requiresCustomPersistence, restrictTo, serverAiStep, setAggressive, setBodyArmorItem, setCanPickUpLoot, setDropChance, setGuaranteedDrop, setItemSlotAndDropWhenKilled, setLeashData, setLeftHanded, setNoAi, setPathfindingMalus, setPersistenceRequired, setSpawnCancelled, setSpeed, setTarget, setXxa, setYya, setZza, shouldDespawnInPeaceful, shouldPassengersInheritMalus, spawnAnim, startRiding, stopInPlace, tickHeadTurn, updateControlFlags
Methods inherited from class net.minecraft.world.entity.LivingEntity
activeLocationDependentEnchantments, actuallyHurt, addEffect, addEffect, animateHurt, applyInput, applyItemBlocking, areAllEffectsAmbient, attackable, blockedByItem, blockUsingItem, calculateEntityAnimation, calculateFallDamage, canAttack, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canEquipWithDispenser, canFreeze, canGlide, canGlideUsing, canStandOnFluid, canUsePortal, canUseSlot, causeFallDamage, checkAutoSpinAttack, checkFallDamage, clearSleepingPos, completeUsingItem, createEquipment, createLivingAttributes, createWitherRose, decreaseAirSupply, doAutoAttackOnTouch, doesEmitEquipEvent, doHurtEquipment, doPush, drop, dropAllDeathLoot, dropEquipment, dropExperience, dropFromGiftLootTable, dropFromLootTable, dropFromShearingLootTable, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getAgeScale, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, getAttribute, getAttributeBaseValue, getAttributes, getAttributeValue, getBedOrientation, getBlockSpeedFactor, getCombatTracker, getComfortableFallDistance, getCurrentSwingDuration, getDamageAfterArmorAbsorb, getDamageAfterMagicAbsorb, getDefaultDimensions, getDefaultGravity, getDimensions, getDismountPoses, getEffect, getEffectBlendFactor, getEffectiveGravity, getEquipmentSlotForItem, getEquipSound, getExperienceReward, getFallFlyingTicks, getFallSounds, getFluidFallingAdjustedMovement, getFlyingSpeed, getHealth, getHitbox, getHurtDir, getInterpolation, getItemBlockingWith, getItemBySlot, getItemHeldByArm, getItemInHand, getJumpBoostPower, getJumpPower, getJumpPower, getKillCredit, getKnockback, getLastAttacker, getLastClimbablePos, getLastDamageSource, getLastHurtByMob, getLastHurtByMobTimestamp, getLastHurtByPlayer, getLastHurtByPlayerMemoryTime, getLastHurtMob, getLastHurtMobTimestamp, getLocalBoundsForPose, getLuck, getMainHandItem, getMaxAbsorption, getMaxHeadRotationRelativeToBody, getMaxHealth, getNoActionTime, getOffhandItem, getPassengerRidingPosition, getPreciseBodyRotation, getProjectile, getRelativePortalPosition, getRiddenInput, getRiddenSpeed, getScale, getSecondsToDisableBlocking, getSleepingPos, getSlotForHand, getSoundVolume, getSpeed, getStingerCount, getSwimAmount, getTicksUsingItem, getUsedItemHand, getUseItem, getUseItemRemainingTicks, getViewYRot, getVisibilityPercent, getVisualRotationYInDegrees, getVoicePitch, getWaterSlowDown, getWeaponItem, getYHeadRot, goDownInWater, handleDamageEvent, handleExtraItemsCreatedOnUse, hasEffect, hasInfiniteMaterials, hasItemInSlot, hasLandedInLiquid, hasLineOfSight, hasLineOfSight, heal, hurtArmor, hurtHelmet, hurtServer, igniteForTicks, increaseAirSupply, indicateDamage, internalSetAbsorptionAmount, isAffectedByFluids, isAffectedByPotions, isAlive, isAlwaysExperienceDropper, isAutoSpinAttack, isBlocking, isCurrentlyGlowing, isDeadOrDying, isEquippableInSlot, isFallFlying, isHolding, isHolding, isImmobile, isInvertedHealAndHarm, isInvulnerableTo, isInWall, isLookingAtMe, isPickable, isPushable, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadRotationStep, lerpHeadTo, lookAt, makePoofParticles, makeSound, maxUpStep, onBelowWorld, onChangedBlock, onClimbable, onEffectAdded, onEffectsRemoved, onEffectUpdated, onEnterCombat, onEquipItem, onEquippedItemBroken, onItemPickup, onLeaveCombat, playBlockFallSound, push, pushEntities, randomTeleport, recreateFromPacket, releaseUsingItem, remove, removeAllEffects, removeEffect, removeEffectNoUpdate, removeEffectParticles, removeFrost, resetForwardDirectionOfRelativePortalPosition, resolveMobResponsibleForDamage, resolvePlayerResponsibleForDamage, rideTick, sanitizeScale, sendEffectToPassengers, setAbsorptionAmount, setArrowCount, setDiscardFriction, setHealth, setItemInHand, setItemSlot, setJumping, setLastHurtByPlayer, setLastHurtByPlayer, setLastHurtMob, setLivingEntityFlag, setNoActionTime, setRecordPlayingNearby, setSleepingPos, setSprinting, setStingerCount, setYBodyRot, setYHeadRot, shouldDiscardFriction, shouldDropExperience, shouldDropLoot, shouldShowName, skipDropExperience, spawnItemParticles, startUsingItem, stopFallFlying, stopRiding, stopUsingItem, swing, swing, take, tickDeath, tickEffects, tickRidden, travel, triggerOnDeathMobEffects, tryAddFrost, updateEffectVisibility, updateFallFlying, updateInvisibilityStatus, updateSwingTime, updateUsingItem, updateWalkAnimation, wasExperienceConsumed, wouldNotSuffocateAtTargetPose
Methods inherited from class net.minecraft.world.entity.Entity
absSnapRotationTo, absSnapTo, absSnapTo, addDeltaMovement, addPassenger, addTag, adjustSpawnLocation, applyComponentsFromItemStack, applyEffectsFromBlocks, applyEffectsFromBlocks, applyGravity, applyImplicitComponentIfPresent, awardKillScore, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canCollideWith, canControlVehicle, canRide, canSpawnSprintParticle, canSprint, canTeleport, canTrample, captureDrops, captureDrops, castComponentValue, checkBelowWorld, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, clearFreeze, closerThan, closerThan, collideBoundingBox, considersEntityAsAlly, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStackForNameResolution, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doCheckFallDamage, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, forceSetRotation, fudgePositionAfterSizeChange, gameEvent, gameEvent, getAddEntityPacket, getAirSupply, getAttachments, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getCapability, getCapability, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControlledVehicle, getCustomName, getDefaultPassengerAttachmentPoint, getDeltaMovement, getDimensionChangingDelay, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getEyeHeight, getEyeHeight, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getGravity, getHandHoldingItemAngle, getId, getInBlockState, getIndirectPassengers, getInputVector, getKnownMovement, getLeashOffset, getLeashOffset, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxHeightFluidType, getMotionDirection, getMovementEmission, getName, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, getPassengers, getPassengersAndSelf, getPercentFrozen, getPersistentData, getPickRadius, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPrimaryStepSoundBlockPos, getRandom, getRandomX, getRandomY, getRandomZ, getRemainingFireTicks, getRemovalReason, getRootVehicle, getRotationVector, getScoreboardName, getSelfAndPassengers, getServer, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getUpVector, getUUID, getVehicle, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getX, getX, getXRot, getXRot, getY, getY, getYRot, getYRot, getZ, getZ, handleOnAboveBubbleColumn, handleOnInsideBubbleColumn, handlePortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPose, hurt, hurtClient, hurtOrSimulate, igniteForSeconds, ignoreExplosion, interactAt, is, isAddedToLevel, isAffectedByBlocks, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isClientAuthoritative, isColliding, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInLiquid, isInterpolating, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableToBase, isInWater, isInWaterOrRain, isLocalClientAuthoritative, isLocalInstanceAuthoritative, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, killedEntity, lavaHurt, lavaIgnite, lerpMotion, lerpPositionAndRotationStep, level, limitPistonMovement, load, makeBoundingBox, makeBoundingBox, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mayInteract, mirror, move, moveOrInterpolateTo, moveRelative, moveTowardsClosestSpace, nextStep, oldPosition, onAboveBubbleColumn, onAddedToLevel, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onPassengerTurned, onRemoval, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, processFlappingMovement, processPortalCooldown, propagateFallToPassengers, push, push, reapplyPosition, refreshDimensions, registryAccess, removeLatestMovementRecordingBatch, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, rotate, save, saveAsPassenger, saveWithoutId, sendBubbleColumnParticles, setAirSupply, setAsInsidePortal, setBoundingBox, setComponent, setCustomName, setCustomNameVisible, setData, setDeltaMovement, setDeltaMovement, setFluidTypeHeight, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setLevel, setLevelCallback, setNoGravity, setOldPos, setOldPosAndRot, setOldPosAndRot, setOldRot, setOnGround, setOnGroundWithMovement, setOnGroundWithMovement, setPortalCooldown, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYRot, shouldBeSaved, shouldBlockExplode, shouldPlayLavaHurtSound, shouldRender, shouldRenderAtSqrDistance, showVehicleHealth, skipAttackInteraction, snapTo, snapTo, snapTo, snapTo, snapTo, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startSeenByPlayer, stopSeenByPlayer, syncPacketPositionCodec, teleportRelative, teleportSetPosition, teleportTo, teleportTo, toString, touchingUnloadedChunk, trackingPosition, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSound
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachments
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.core.component.DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, has, has
Methods inherited from interface net.minecraft.world.entity.EquipmentUser
equip, equip, equip, getItemBySlot, resolveSlot, setItemSlot
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canTrample, captureDrops, captureDrops, copyAttachmentsFrom, getClassification, getEyeInFluidType, getFluidFallDistanceModifier, getFluidMotionScale, getFluidTypeHeight, getMaxHeightFluidType, getParts, getPersistentData, getSoundFromFluidType, hasCustomOutlineRendering, isAddedToLevel, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, onAddedToLevel, onRemovedFromLevel, revive, sendPairingData, shouldRiderSit
Methods inherited from interface net.neoforged.neoforge.common.extensions.ILivingEntityExtension
canDrownInFluidType, canSwimInFluidType, moveInFluid, onDamageTaken, self, sinkInFluid
Methods inherited from interface net.minecraft.world.entity.npc.InventoryCarrier
readInventoryFromTag, writeInventoryToTag
Methods inherited from interface net.minecraft.world.entity.Leashable
canHaveALeashAttachedToIt, dropLeash, elasticRangeLeashBehaviour, getLeashHolder, isLeashed, mayBeLeashed, readLeashData, removeLeash, setDelayedLeashHolderId, setLeashedTo, writeLeashData
Methods inherited from interface net.minecraft.world.item.trading.Merchant
openTradingScreen
Methods inherited from interface net.minecraft.world.scores.ScoreHolder
getFeedbackDisplayName
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DATA_VILLAGER_DATA
-
BREEDING_FOOD_THRESHOLD
public static final int BREEDING_FOOD_THRESHOLD- See Also:
-
FOOD_POINTS
-
TRADES_PER_LEVEL
private static final int TRADES_PER_LEVEL- See Also:
-
MAX_GOSSIP_TOPICS
private static final int MAX_GOSSIP_TOPICS- See Also:
-
GOSSIP_COOLDOWN
private static final int GOSSIP_COOLDOWN- See Also:
-
GOSSIP_DECAY_INTERVAL
private static final int GOSSIP_DECAY_INTERVAL- See Also:
-
HOW_FAR_AWAY_TO_TALK_TO_OTHER_VILLAGERS_ABOUT_GOLEMS
private static final int HOW_FAR_AWAY_TO_TALK_TO_OTHER_VILLAGERS_ABOUT_GOLEMS- See Also:
-
HOW_MANY_VILLAGERS_NEED_TO_AGREE_TO_SPAWN_A_GOLEM
private static final int HOW_MANY_VILLAGERS_NEED_TO_AGREE_TO_SPAWN_A_GOLEM- See Also:
-
TIME_SINCE_SLEEPING_FOR_GOLEM_SPAWNING
private static final long TIME_SINCE_SLEEPING_FOR_GOLEM_SPAWNING- See Also:
-
SPEED_MODIFIER
public static final float SPEED_MODIFIER- See Also:
-
DEFAULT_XP
private static final int DEFAULT_XP- See Also:
-
DEFAULT_FOOD_LEVEL
private static final byte DEFAULT_FOOD_LEVEL- See Also:
-
DEFAULT_LAST_RESTOCK
private static final int DEFAULT_LAST_RESTOCK- See Also:
-
DEFAULT_LAST_GOSSIP_DECAY
private static final int DEFAULT_LAST_GOSSIP_DECAY- See Also:
-
DEFAULT_RESTOCKS_TODAY
private static final int DEFAULT_RESTOCKS_TODAY- See Also:
-
DEFAULT_ASSIGN_PROFESSION_WHEN_SPAWNED
private static final boolean DEFAULT_ASSIGN_PROFESSION_WHEN_SPAWNED- See Also:
-
updateMerchantTimer
private int updateMerchantTimer -
increaseProfessionLevelOnUpdate
private boolean increaseProfessionLevelOnUpdate -
lastTradedPlayer
-
chasing
private boolean chasing -
foodLevel
private int foodLevel -
gossips
-
lastGossipTime
private long lastGossipTime -
lastGossipDecayTime
private long lastGossipDecayTime -
villagerXp
private int villagerXp -
lastRestockGameTime
private long lastRestockGameTime -
numberOfRestocksToday
private int numberOfRestocksToday -
lastRestockCheckDayTime
private long lastRestockCheckDayTime -
assignProfessionWhenSpawned
private boolean assignProfessionWhenSpawned -
MEMORY_TYPES
-
SENSOR_TYPES
private static final com.google.common.collect.ImmutableList<SensorType<? extends Sensor<? super Villager>>> SENSOR_TYPES -
POI_MEMORIES
public static final Map<MemoryModuleType<GlobalPos>,BiPredicate<Villager, POI_MEMORIESHolder<PoiType>>>
-
-
Constructor Details
-
Villager
-
Villager
public Villager(EntityType<? extends Villager> p_397440_, Level p_397835_, ResourceKey<VillagerType> p_397907_) -
Villager
public Villager(EntityType<? extends Villager> p_35384_, Level p_35385_, Holder<VillagerType> p_397796_)
-
-
Method Details
-
getBrain
- Overrides:
getBrain
in classLivingEntity
-
brainProvider
- Overrides:
brainProvider
in classLivingEntity
-
makeBrain
- Overrides:
makeBrain
in classLivingEntity
-
refreshBrain
-
registerBrainGoals
-
ageBoundaryReached
protected void ageBoundaryReached()- Overrides:
ageBoundaryReached
in classAgeableMob
-
createAttributes
-
assignProfessionWhenSpawned
public boolean assignProfessionWhenSpawned() -
customServerAiStep
- Overrides:
customServerAiStep
in classMob
-
tick
public void tick() -
mobInteract
- Overrides:
mobInteract
in classMob
-
setUnhappy
private void setUnhappy() -
startTrading
-
setTradingPlayer
- Specified by:
setTradingPlayer
in interfaceMerchant
- Overrides:
setTradingPlayer
in classAbstractVillager
-
stopTrading
protected void stopTrading()- Overrides:
stopTrading
in classAbstractVillager
-
resetSpecialPrices
private void resetSpecialPrices() -
canRestock
public boolean canRestock()- Specified by:
canRestock
in interfaceMerchant
-
restock
public void restock() -
resendOffersToTradingPlayer
private void resendOffersToTradingPlayer() -
needsToRestock
private boolean needsToRestock() -
allowedToRestock
private boolean allowedToRestock() -
shouldRestock
public boolean shouldRestock() -
catchUpDemand
private void catchUpDemand() -
updateDemand
private void updateDemand() -
updateSpecialPrices
-
defineSynchedData
- Overrides:
defineSynchedData
in classAbstractVillager
-
createDefaultVillagerData
-
addAdditionalSaveData
- Overrides:
addAdditionalSaveData
in classAbstractVillager
-
readAdditionalSaveData
- Overrides:
readAdditionalSaveData
in classAbstractVillager
-
removeWhenFarAway
public boolean removeWhenFarAway(double p_35535_) - Overrides:
removeWhenFarAway
in classMob
-
getAmbientSound
- Overrides:
getAmbientSound
in classMob
-
getHurtSound
- Overrides:
getHurtSound
in classLivingEntity
-
getDeathSound
- Overrides:
getDeathSound
in classLivingEntity
-
playWorkSound
public void playWorkSound() -
setVillagerData
- Specified by:
setVillagerData
in interfaceVillagerDataHolder
-
getVillagerData
- Specified by:
getVillagerData
in interfaceVillagerDataHolder
-
rewardTradeXp
- Specified by:
rewardTradeXp
in classAbstractVillager
-
setLastHurtByMob
- Overrides:
setLastHurtByMob
in classLivingEntity
-
die
- Overrides:
die
in classAbstractVillager
-
releaseAllPois
private void releaseAllPois() -
tellWitnessesThatIWasMurdered
-
releasePoi
-
canBreed
public boolean canBreed()- Overrides:
canBreed
in classAgeableMob
-
hungry
private boolean hungry() -
eatUntilFull
private void eatUntilFull() -
getPlayerReputation
-
digestFood
private void digestFood(int p_35549_) -
eatAndDigestFood
public void eatAndDigestFood() -
setOffers
-
shouldIncreaseLevel
private boolean shouldIncreaseLevel() -
increaseMerchantCareer
private void increaseMerchantCareer() -
getTypeName
- Overrides:
getTypeName
in classEntity
-
handleEntityEvent
public void handleEntityEvent(byte p_35391_) - Overrides:
handleEntityEvent
in classMob
-
finalizeSpawn
@Nullable public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_35439_, DifficultyInstance p_35440_, EntitySpawnReason p_363222_, @Nullable SpawnGroupData p_35442_) - Overrides:
finalizeSpawn
in classAbstractVillager
-
getBreedOffspring
- Specified by:
getBreedOffspring
in classAgeableMob
-
thunderHit
- Overrides:
thunderHit
in classEntity
-
pickUpItem
- Overrides:
pickUpItem
in classMob
-
wantsToPickUp
- Overrides:
wantsToPickUp
in classMob
-
hasExcessFood
public boolean hasExcessFood() -
wantsMoreFood
public boolean wantsMoreFood() -
countFoodPointsInInventory
private int countFoodPointsInInventory() -
hasFarmSeeds
public boolean hasFarmSeeds() -
updateTrades
protected void updateTrades()- Specified by:
updateTrades
in classAbstractVillager
-
gossip
-
maybeDecayGossip
private void maybeDecayGossip() -
spawnGolemIfNeeded
-
wantsToSpawnGolem
public boolean wantsToSpawnGolem(long p_35393_) -
onReputationEventFrom
- Specified by:
onReputationEventFrom
in interfaceReputationEventHandler
-
getVillagerXp
public int getVillagerXp()- Specified by:
getVillagerXp
in interfaceMerchant
- Overrides:
getVillagerXp
in classAbstractVillager
-
setVillagerXp
public void setVillagerXp(int p_35547_) -
resetNumberOfRestocks
private void resetNumberOfRestocks() -
getGossips
-
setGossips
-
sendDebugPackets
protected void sendDebugPackets()- Overrides:
sendDebugPackets
in classMob
-
startSleeping
- Overrides:
startSleeping
in classLivingEntity
-
stopSleeping
public void stopSleeping()- Overrides:
stopSleeping
in classLivingEntity
-
golemSpawnConditionsMet
private boolean golemSpawnConditionsMet(long p_35462_) -
get
- Specified by:
get
in interfaceDataComponentGetter
- Overrides:
get
in classEntity
-
applyImplicitComponents
- Overrides:
applyImplicitComponents
in classEntity
-
applyImplicitComponent
- Overrides:
applyImplicitComponent
in classEntity
-