Package net.minecraft.entity.passive
Class VillagerEntity
- All Implemented Interfaces:
InteractionObserver
,Npc
,CommandOutput
,Nameable
,Merchant
,VillagerDataContainer
public class VillagerEntity extends MerchantEntity implements InteractionObserver, VillagerDataContainer
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.entity.passive.PassiveEntity
PassiveEntity.PassiveData
Nested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.PositionUpdater
-
Field Summary
Fields Modifier and Type Field Description private int
experience
private byte
foodLevel
private static Set<Item>
GATHERABLE_ITEMS
private VillagerGossips
gossip
private long
gossipStartTime
static Map<Item,Integer>
ITEM_FOOD_VALUES
private PlayerEntity
lastCustomer
private long
lastGossipDecayTime
private long
lastRestockCheckTime
private long
lastRestockTime
private boolean
levelingUp
private int
levelUpTimer
private static ImmutableList<MemoryModuleType<?>>
MEMORY_MODULES
private boolean
natural
static Map<MemoryModuleType<GlobalPos>,BiPredicate<VillagerEntity,PointOfInterestType>>
POINTS_OF_INTEREST
private int
restocksToday
private static ImmutableList<SensorType<? extends Sensor<? super VillagerEntity>>>
SENSORS
private static TrackedData<VillagerData>
VILLAGER_DATA
Fields inherited from class net.minecraft.entity.passive.MerchantEntity
offers
Fields inherited from class net.minecraft.entity.passive.PassiveEntity
breedingAge, forcedAge, happyTicksRemaining
Fields inherited from class net.minecraft.entity.mob.MobEntity
ambientSoundChance, armorDropChances, experiencePoints, goalSelector, handDropChances, jumpControl, lookControl, moveControl, navigation, targetSelector
Fields inherited from class net.minecraft.entity.LivingEntity
activeItemStack, attackingPlayer, bodyTrackingIncrements, bodyYaw, brain, dead, deathTime, defaultMaxHealth, despawnCounter, field_6215, flyingSpeed, forwardSpeed, handSwinging, handSwingProgress, handSwingTicks, headTrackingIncrements, headYaw, hurtTime, itemUseTimeLeft, jumping, knockbackVelocity, lastAttackedTicks, lastDamageTaken, lastHandSwingProgress, lastLimbDistance, limbAngle, limbDistance, LIVING_FLAGS, lookDirection, maxHurtTime, playerHitTimer, preferredHand, prevBodyYaw, prevHeadYaw, prevLookDirection, prevStepBobbingAmount, randomLargeSeed, randomSmallSeed, riptideTicks, roll, scoreAmount, serverHeadYaw, serverPitch, serverX, serverY, serverYaw, serverZ, sidewaysSpeed, SLEEPING_DIMENSIONS, stepBobbingAmount, stuckArrowTimer, stuckStingerTimer, upwardSpeed
Fields inherited from class net.minecraft.entity.Entity
age, chunkX, chunkY, chunkZ, dataTracker, distanceTraveled, fallDistance, field_25599, firstUpdate, FLAGS, fluidHeight, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inNetherPortal, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, removed, ridingCooldown, stepHeight, submergedInWater, teleporting, timeUntilRegen, touchingWater, updateNeeded, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, world, yaw
Fields inherited from interface net.minecraft.server.command.CommandOutput
DUMMY
-
Constructor Summary
Constructors Constructor Description VillagerEntity(EntityType<? extends VillagerEntity> type, World world)
VillagerEntity(EntityType<? extends VillagerEntity> entityType, World world, VillagerType type)
-
Method Summary
Methods inherited from class net.minecraft.entity.passive.MerchantEntity
canBeLeashedBy, equip, fillRecipesFromPool, getActiveEyeHeight, getCurrentCustomer, getHeadRollingTimeLeft, getInventory, getMerchantWorld, getOffers, getTradingSound, getYesSound, hasCustomer, isLeveledMerchant, method_30951, moveToWorld, onSellingItem, playCelebrateSound, produceParticles, setExperienceFromServer, setHeadRollingTimeLeft, setOffersFromServer, trade
Methods inherited from class net.minecraft.entity.passive.PassiveEntity
getBreedingAge, growUp, growUp, isBaby, onTrackedDataSet, setBaby, setBreedingAge, tickMovement
Methods inherited from class net.minecraft.entity.mob.PathAwareEntity
canSpawn, getPathfindingFavor, getPathfindingFavor, getRunFromLeashSpeed, isNavigating, updateForLeashLength, updateLeash
Methods inherited from class net.minecraft.entity.mob.MobEntity
attachLeash, baseTick, canBeControlledByRider, canEquip, canEquipmentSlotContain, canMobSpawn, canMoveVoluntarily, cannotDespawn, canPickupItem, canPickUpLoot, canSpawn, canTarget, canTarget, canUseRangedWeapon, checkDespawn, createBodyControl, createMobAttributes, createNavigation, detachLeash, dropEquipment, dropLoot, equipLootStack, equipStack, getArmorItems, getBodyYawSpeed, getCurrentExperience, getDropChance, getEquipmentForSlot, getEquippedStack, getHoldingEntity, getItemsHand, getJumpControl, getLimitPerChunk, getLookControl, getLookPitchSpeed, getLookYawSpeed, getLootContextBuilder, getLootTable, getLootTableId, getMainArm, getMinAmbientSoundDelay, getMoveControl, getNavigation, getPathfindingPenalty, getPositionTarget, getPositionTargetRange, getPreferredEquipmentSlot, getSafeFallDistance, getTarget, getVisibilityCache, hasPositionTarget, initEquipment, initGoals, interact, isAffectedByDaylight, isAiDisabled, isAttacking, isDisallowedInPeaceful, isInWalkTargetRange, isInWalkTargetRange, isLeashed, isLeftHanded, isLogicalSideForUpdatingMovement, isPersistent, lookAtEntity, method_29243, method_29244, method_30076, method_30758, method_30759, movesIndependently, onEatingGrass, onPlayerSpawnedChild, playAmbientSound, playHurtSound, playSpawnEffects, prefersNewDamageableItem, prefersNewEquipment, setAiDisabled, setAttacking, setCanPickUpLoot, setEquipmentDropChance, setForwardSpeed, setHoldingEntityId, setLeftHanded, setMovementSpeed, setPathfindingPenalty, setPersistent, setPositionTarget, setSidewaysSpeed, setTarget, setUpwardSpeed, spawnsTooManyForEachTry, startRiding, swimUpward, tickNewAi, tryAttack, tryEquip, turnHead, updateDropChances, updateEnchantments, updateGoalControls
Methods inherited from class net.minecraft.entity.LivingEntity
addSoulSpeedBoostIfNeeded, addStatusEffect, animateDamage, applyArmorToDamage, applyDamage, applyEnchantmentsToDamage, applyMovementEffects, applyStatusEffect, attackLivingEntity, canBeRiddenInWater, canBreatheInWater, canDropLootAndXp, canHaveStatusEffect, canSee, canWalkOnFluid, clearActiveItem, clearPotionSwirls, clearSleepingPosition, clearStatusEffects, collides, computeFallDamage, consumeItem, containsOnlyAmbientEffects, createLivingAttributes, createSpawnPacket, damage, damageArmor, damageShield, destroy, displaySoulSpeedEffects, drop, dropInventory, dropXp, eatFood, endCombat, enterCombat, fall, getAbsorptionAmount, getActiveHand, getActiveItem, getActiveStatusEffects, getArmor, getArmorVisibility, getArrowType, getAttackDistanceScalingFactor, getAttacker, getAttacking, getAttributeBaseValue, getAttributeInstance, getAttributes, getAttributeValue, getBaseMovementSpeedMultiplier, getBlockState, getBoundingBox, getClimbingPos, getDamageTracker, getDespawnCounter, getDimensions, getDrinkSound, getEatSound, getEyeHeight, getFallSound, getGroup, getHandSwingProgress, getHeadYaw, getHealth, getItemUseTime, getItemUseTimeLeft, getJumpVelocity, getLastAttackedTime, getLastAttackTime, getLeaningPitch, getMainHandStack, getMaxHealth, getMovementSpeed, getNextAirOnLand, getNextAirUnderwater, getOffHandStack, getPoses, getPrimeAdversary, getRandom, getRecentDamageSource, getRoll, getScaleFactor, getSleepingDirection, getSleepingPosition, getSoundPitch, getSoundVolume, getStackInHand, getStatusEffect, getStatusEffects, getStingerCount, getStuckArrowCount, getVelocityMultiplier, getVisibilityBoundingBox, getYaw, handleFallDamage, hasStackEquipped, hasStatusEffect, heal, hurtByWater, isAffectedBySplashPotions, isAlive, isBlocking, isClimbing, isDead, isFallFlying, isHolding, isHolding, isHoldingOntoLadder, isImmobile, isInsideWall, isInSwimmingPose, isMobOrPlayer, isOnSoulSpeedBlock, isPushable, isSleeping, isTarget, isUndead, isUsingItem, isUsingRiptide, jump, kill, knockback, knockDownwards, lookAt, markEffectsDirty, method_26317, method_26318, method_29242, method_29499, method_29500, method_29920, method_30633, method_31079, onAttacking, onEquipStack, onKilledBy, onStatusEffectApplied, onStatusEffectRemoved, onStatusEffectUpgraded, playBlockFallSound, pushAway, pushAwayFrom, removeSoulSpeedBoost, removeStatusEffect, removeStatusEffectInternal, scheduleVelocityUpdate, sendEquipmentBreakStatus, sendPickup, sendToolBreakStatus, setAbsorptionAmount, setAttacking, setCurrentHand, setDespawnCounter, setHeadYaw, setHealth, setJumping, setLivingFlag, setNearbySongPlaying, setOnGround, setRiptideTicks, setSleepingPosition, setSprinting, setStackInHand, setStingerCount, setStuckArrowCount, setYaw, shouldAlwaysDropXp, shouldDisplaySoulSpeedEffects, shouldDropLoot, shouldRenderName, spawnConsumptionEffects, stopRiding, stopUsingItem, swingHand, swingHand, takeKnockback, takeShieldHit, teleport, tickCramming, tickHandSwing, tickRiding, tickRiptide, tickStatusEffects, travel, updatePostDeath, updatePotionVisibility, updateTrackedHeadRotation, updateTrackedPositionAndAngles
Methods inherited from class net.minecraft.entity.Entity
addPassenger, addScoreboardTag, addVelocity, adjustMovementForCollisions, adjustMovementForCollisions, adjustMovementForPiston, adjustMovementForSneaking, adjustSingleAxisMovementForCollisions, afterSpawn, applyMirror, applyRotation, bypassesLandingEffects, bypassesSteppingEffects, calculateBoundsForPose, calculateDimensions, calculateNextStepSoundDistance, canAddPassenger, canAvoidTraps, canBeSpectated, canClimb, canExplosionDestroyBlock, canFly, canStartRiding, canUsePortals, changeLookDirection, checkBlockCollision, collidesWith, copyFrom, copyPositionAndRotation, dealDamage, detach, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, extinguish, fromTag, getAir, getBlockPos, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getCommandSource, getCustomName, getDataTracker, getDefaultNetherPortalCooldown, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFlag, getFluidHeight, getHeight, getHeightOffset, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMaxNetherPortalTime, getMountedHeightOffset, getMovementDirection, getName, getOppositeRotationVector, getOppositeRotationVector, getParticleX, getParticleZ, getPassengerDismountOffset, getPassengerList, getPassengersDeep, getPermissionLevel, getPistonBehavior, getPitch, getPos, getPose, getPrimaryPassenger, getRandomBodyY, getRenderDistanceMultiplier, getRootVehicle, getRotationClient, getRotationVec, getRotationVecClient, getRotationVector, getRotationVector, getSavedEntityId, getScoreboardTags, getScoreboardTeam, getServer, getSoundCategory, getSplashSound, getStandingEyeHeight, getSwimSound, getTargetingMargin, getTeamColorValue, getTeleportTarget, getTrackedPosition, getType, getUuid, getUuidAsString, getVehicle, getVelocity, getVelocityAffectingPos, getWidth, getX, getY, getZ, handleAttack, hasCustomName, hashCode, hasNetherPortalCooldown, hasNoGravity, hasPassenger, hasPassengerDeep, hasPassengers, hasPassengerType, hasPermissionLevel, hasPlayerRider, hasVehicle, hasWings, interactAt, isAttackable, isChunkPosUpdateRequested, isCollidable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isFireImmune, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWaterOrBubbleColumn, isInSneakingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isOnFire, isOnGround, isPartOf, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_29239, method_29241, method_29919, method_30330, method_30632, method_30634, method_30950, method_31166, move, moveToBoundingBoxCenter, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onPlayerCollision, onStartedTrackingBy, onStoppedTrackingBy, onSwimmingStart, playFlySound, playSound, playStepSound, playSwimSound, populateCrashReport, pushOutOfBlocks, raycast, refreshPosition, refreshPositionAfterTeleport, refreshPositionAfterTeleport, refreshPositionAndAngles, refreshPositionAndAngles, remove, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetNetherPortalCooldown, resetPosition, saveSelfToTag, saveToTag, sendSystemMessage, setAir, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, setFireTicks, setFlag, setGlowing, setInNetherPortal, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setPos, setPose, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, setWorld, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldSetPositionOnLoad, shouldSpawnSprintingParticles, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, streamPassengersRecursively, teleport, teleportRequested, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateSwimming, updateTrackedPosition, updateTrackedPosition, updateVelocity, updateWaterState, wouldPoseNotCollide
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.village.Merchant
sendOffers
-
Field Details
-
VILLAGER_DATA
-
ITEM_FOOD_VALUES
-
GATHERABLE_ITEMS
-
MEMORY_MODULES
-
SENSORS
-
POINTS_OF_INTEREST
public static final Map<MemoryModuleType<GlobalPos>,BiPredicate<VillagerEntity,PointOfInterestType>> POINTS_OF_INTEREST -
levelUpTimer
private int levelUpTimer -
levelingUp
private boolean levelingUp -
lastCustomer
-
foodLevel
private byte foodLevel -
gossip
-
gossipStartTime
private long gossipStartTime -
lastGossipDecayTime
private long lastGossipDecayTime -
experience
private int experience -
lastRestockTime
private long lastRestockTime -
restocksToday
private int restocksToday -
lastRestockCheckTime
private long lastRestockCheckTime -
natural
private boolean natural
-
-
Constructor Details
-
VillagerEntity
-
VillagerEntity
public VillagerEntity(EntityType<? extends VillagerEntity> entityType, World world, VillagerType type)
-
-
Method Details
-
getBrain
- Overrides:
getBrain
in classLivingEntity
-
createBrainProfile
- Overrides:
createBrainProfile
in classLivingEntity
-
deserializeBrain
- Overrides:
deserializeBrain
in classLivingEntity
-
reinitializeBrain
-
initBrain
-
onGrowUp
protected void onGrowUp()- Overrides:
onGrowUp
in classPassiveEntity
-
createVillagerAttributes
-
isNatural
public boolean isNatural() -
mobTick
protected void mobTick() -
tick
public void tick() -
interactMob
- Overrides:
interactMob
in classMobEntity
-
sayNo
private void sayNo() -
beginTradeWith
-
setCurrentCustomer
- Specified by:
setCurrentCustomer
in interfaceMerchant
- Overrides:
setCurrentCustomer
in classMerchantEntity
-
resetCustomer
protected void resetCustomer()- Overrides:
resetCustomer
in classMerchantEntity
-
clearCurrentBonus
private void clearCurrentBonus() -
canRefreshTrades
public boolean canRefreshTrades()- Specified by:
canRefreshTrades
in interfaceMerchant
-
restock
public void restock() -
needRestock
private boolean needRestock() -
canRestock
private boolean canRestock() -
shouldRestock
public boolean shouldRestock() -
method_21723
private void method_21723() -
updatePricesOnDemand
private void updatePricesOnDemand() -
prepareRecipesFor
-
initDataTracker
protected void initDataTracker()- Overrides:
initDataTracker
in classMerchantEntity
-
writeCustomDataToTag
- Overrides:
writeCustomDataToTag
in classMerchantEntity
-
readCustomDataFromTag
- Overrides:
readCustomDataFromTag
in classMerchantEntity
-
canImmediatelyDespawn
public boolean canImmediatelyDespawn(double distanceSquared)- Overrides:
canImmediatelyDespawn
in classMobEntity
-
getAmbientSound
- Overrides:
getAmbientSound
in classMobEntity
-
getHurtSound
- Overrides:
getHurtSound
in classLivingEntity
-
getDeathSound
- Overrides:
getDeathSound
in classLivingEntity
-
playWorkSound
public void playWorkSound() -
setVillagerData
-
getVillagerData
- Specified by:
getVillagerData
in interfaceVillagerDataContainer
-
afterUsing
- Specified by:
afterUsing
in classMerchantEntity
-
setAttacker
- Overrides:
setAttacker
in classLivingEntity
-
onDeath
- Overrides:
onDeath
in classMerchantEntity
-
method_30958
private void method_30958() -
notifyDeath
-
releaseTicketFor
-
isReadyToBreed
public boolean isReadyToBreed()- Overrides:
isReadyToBreed
in classPassiveEntity
-
lacksFood
private boolean lacksFood() -
consumeAvailableFood
private void consumeAvailableFood() -
getReputation
-
depleteFood
private void depleteFood(int amount) -
eatForBreeding
public void eatForBreeding() -
setOffers
-
canLevelUp
private boolean canLevelUp() -
levelUp
private void levelUp() -
getDefaultName
- Overrides:
getDefaultName
in classEntity
-
handleStatus
@Environment(CLIENT) public void handleStatus(byte status)- Overrides:
handleStatus
in classMobEntity
-
initialize
@Nullable public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable CompoundTag entityTag)- Overrides:
initialize
in classMerchantEntity
-
createChild
- Specified by:
createChild
in classPassiveEntity
-
onStruckByLightning
- Overrides:
onStruckByLightning
in classEntity
-
loot
-
canGather
-
wantsToStartBreeding
public boolean wantsToStartBreeding() -
canBreed
public boolean canBreed() -
getAvailableFood
private int getAvailableFood() -
hasSeedToPlant
public boolean hasSeedToPlant() -
fillRecipes
protected void fillRecipes()- Specified by:
fillRecipes
in classMerchantEntity
-
talkWithVillager
-
decayGossip
private void decayGossip() -
summonGolem
-
canSummonGolem
public boolean canSummonGolem(long time) -
spawnIronGolem
-
method_30023
-
onInteractionWith
- Specified by:
onInteractionWith
in interfaceInteractionObserver
-
getExperience
public int getExperience()- Specified by:
getExperience
in interfaceMerchant
- Overrides:
getExperience
in classMerchantEntity
-
setExperience
public void setExperience(int amount) -
clearDailyRestockCount
private void clearDailyRestockCount() -
getGossip
-
setGossipDataFromTag
-
sendAiDebugData
protected void sendAiDebugData()- Overrides:
sendAiDebugData
in classMobEntity
-
sleep
- Overrides:
sleep
in classLivingEntity
-
wakeUp
public void wakeUp()- Overrides:
wakeUp
in classLivingEntity
-
hasRecentlyWorkedAndSlept
private boolean hasRecentlyWorkedAndSlept(long worldTime)
-