Package net.minecraft.entity.passive
Class VillagerEntity
- All Implemented Interfaces:
class_5568,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.PassiveDataNested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.PositionUpdater, Entity.RemovalReason -
Field Summary
Fields Modifier and Type Field Description private intexperienceprivate bytefoodLevelprivate static Set<Item>GATHERABLE_ITEMSprivate VillagerGossipsgossipprivate longgossipStartTimestatic Map<Item,Integer>ITEM_FOOD_VALUESprivate PlayerEntitylastCustomerprivate longlastGossipDecayTimeprivate longlastRestockCheckTimeprivate longlastRestockTimeprivate booleanlevelingUpprivate intlevelUpTimerprivate static ImmutableList<MemoryModuleType<?>>MEMORY_MODULESprivate booleannaturalstatic Map<MemoryModuleType<GlobalPos>,BiPredicate<VillagerEntity,PointOfInterestType>>POINTS_OF_INTERESTprivate intrestocksTodayprivate static ImmutableList<SensorType<? extends Sensor<? super VillagerEntity>>>SENSORSprivate static TrackedData<VillagerData>VILLAGER_DATAFields inherited from class net.minecraft.entity.passive.MerchantEntity
offersFields inherited from class net.minecraft.entity.passive.PassiveEntity
breedingAge, forcedAge, happyTicksRemainingFields inherited from class net.minecraft.entity.mob.MobEntity
ambientSoundChance, armorDropChances, experiencePoints, goalSelector, handDropChances, jumpControl, lookControl, moveControl, navigation, targetSelectorFields 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, upwardSpeedFields inherited from class net.minecraft.entity.Entity
age, dataTracker, distanceTraveled, fallDistance, field_25599, firstUpdate, FLAGS, fluidHeight, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inNetherPortal, inPowderSnow, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, ridingCooldown, stepHeight, submergedInWater, timeUntilRegen, touchingWater, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, world, yawFields 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, fillRecipesFromPool, getActiveEyeHeight, getCurrentCustomer, getHeadRollingTimeLeft, getInventory, getMerchantWorld, getOffers, getTradingSound, getYesSound, hasCustomer, isLeveledMerchant, method_30951, method_32318, moveToWorld, onSellingItem, playCelebrateSound, produceParticles, setExperienceFromServer, setHeadRollingTimeLeft, setOffersFromServer, tradeMethods inherited from class net.minecraft.entity.passive.PassiveEntity
getBreedingAge, growUp, growUp, isBaby, onTrackedDataSet, setBaby, setBreedingAge, tickMovementMethods inherited from class net.minecraft.entity.mob.PathAwareEntity
canSpawn, getPathfindingFavor, getPathfindingFavor, getRunFromLeashSpeed, isNavigating, updateForLeashLength, updateLeashMethods inherited from class net.minecraft.entity.mob.MobEntity
attachLeash, baseTick, canBeControlledByRider, canEquip, 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, getPickBlockStack, getPositionTarget, getPositionTargetRange, 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, method_33191, 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, updateGoalControlsMethods inherited from class net.minecraft.entity.LivingEntity
addSoulSpeedBoostIfNeeded, addStatusEffect, animateDamage, applyArmorToDamage, applyDamage, applyEnchantmentsToDamage, applyMovementEffects, applyStatusEffect, attackLivingEntity, canBeRiddenInWater, canBreatheInWater, canDropLootAndXp, canFreeze, 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_29500, method_30633, method_31079, method_32324, method_32325, method_32326, method_33190, 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, shouldSwimInFluids, spawnConsumptionEffects, stopRiding, stopUsingItem, swingHand, swingHand, takeKnockback, takeShieldHit, teleport, tickCramming, tickHandSwing, tickRiding, tickRiptide, tickStatusEffects, travel, triggerItemPickedUpByEntityCriteria, updatePostDeath, updatePotionVisibility, updateTrackedHeadRotation, updateTrackedPositionAndAnglesMethods 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, discard, dismountVehicle, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, emitGameEvent, entityDataRequiresOperator, equals, extinguish, fromTag, getAir, getBlockPos, getBlockX, getBlockY, getBlockZ, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getChunkPos, getCommandSource, getCustomName, getDataTracker, getDefaultNetherPortalCooldown, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFirstPassenger, getFlag, getFluidHeight, getFreezingScale, getFrozenTicks, getHeight, getHeightOffset, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMaxNetherPortalTime, getMinFreezeDamageTicks, 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, isCollidable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isFireImmune, isFreezing, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWaterOrBubbleColumn, isInSneakingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isOnFire, isOnGround, isPartOf, isPlayer, isRemoved, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_29241, method_29919, method_30330, method_30632, method_30634, method_30950, method_31166, method_31473, method_31744, method_31746, method_31748, method_32875, method_32877, method_33189, move, moveToBoundingBoxCenter, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onPlayerCollision, onSpawnPacket, 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, setFrozenTicks, setGlowing, setInNetherPortal, setInPowderSnow, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setPos, setPose, setRemoved, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldSetPositionOnLoad, shouldSpawnSprintingParticles, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, streamPassengersRecursively, teleport, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, unsetRemoved, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateSwimming, updateTrackedPosition, updateTrackedPosition, updateVelocity, updateWaterState, wouldPoseNotCollideMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
getBrainin classLivingEntity
-
createBrainProfile
- Overrides:
createBrainProfilein classLivingEntity
-
deserializeBrain
- Overrides:
deserializeBrainin classLivingEntity
-
reinitializeBrain
-
initBrain
-
onGrowUp
protected void onGrowUp()- Overrides:
onGrowUpin classPassiveEntity
-
createVillagerAttributes
-
isNatural
public boolean isNatural() -
mobTick
protected void mobTick() -
tick
public void tick() -
interactMob
- Overrides:
interactMobin classMobEntity
-
sayNo
private void sayNo() -
beginTradeWith
-
setCurrentCustomer
- Specified by:
setCurrentCustomerin interfaceMerchant- Overrides:
setCurrentCustomerin classMerchantEntity
-
resetCustomer
protected void resetCustomer()- Overrides:
resetCustomerin classMerchantEntity
-
clearCurrentBonus
private void clearCurrentBonus() -
canRefreshTrades
public boolean canRefreshTrades()- Specified by:
canRefreshTradesin interfaceMerchant
-
restock
public void restock() -
needRestock
private boolean needRestock() -
canRestock
private boolean canRestock() -
shouldRestock
public boolean shouldRestock() -
restockAndUpdatePricesOnDemand
private void restockAndUpdatePricesOnDemand() -
updatePricesOnDemand
private void updatePricesOnDemand() -
prepareRecipesFor
-
initDataTracker
protected void initDataTracker()- Overrides:
initDataTrackerin classMerchantEntity
-
writeCustomDataToTag
- Overrides:
writeCustomDataToTagin classMerchantEntity
-
readCustomDataFromTag
- Overrides:
readCustomDataFromTagin classMerchantEntity
-
canImmediatelyDespawn
public boolean canImmediatelyDespawn(double distanceSquared)- Overrides:
canImmediatelyDespawnin classMobEntity
-
getAmbientSound
- Overrides:
getAmbientSoundin classMobEntity
-
getHurtSound
- Overrides:
getHurtSoundin classLivingEntity
-
getDeathSound
- Overrides:
getDeathSoundin classLivingEntity
-
playWorkSound
public void playWorkSound() -
setVillagerData
-
getVillagerData
- Specified by:
getVillagerDatain interfaceVillagerDataContainer
-
afterUsing
- Specified by:
afterUsingin classMerchantEntity
-
setAttacker
- Overrides:
setAttackerin classLivingEntity
-
onDeath
- Overrides:
onDeathin classMerchantEntity
-
releaseAllTickets
private void releaseAllTickets() -
notifyDeath
-
releaseTicketFor
-
isReadyToBreed
public boolean isReadyToBreed()- Overrides:
isReadyToBreedin 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:
getDefaultNamein classEntity
-
handleStatus
@Environment(CLIENT) public void handleStatus(byte status)- Overrides:
handleStatusin classMobEntity
-
initialize
@Nullable public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable CompoundTag entityTag)- Overrides:
initializein classMerchantEntity
-
createChild
- Specified by:
createChildin classPassiveEntity
-
onStruckByLightning
- Overrides:
onStruckByLightningin 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:
fillRecipesin classMerchantEntity
-
talkWithVillager
-
decayGossip
private void decayGossip() -
summonGolem
-
canSummonGolem
public boolean canSummonGolem(long time) -
spawnIronGolem
-
getHighestOpenPositionOnOffset
-
onInteractionWith
- Specified by:
onInteractionWithin interfaceInteractionObserver
-
getExperience
public int getExperience()- Specified by:
getExperiencein interfaceMerchant- Overrides:
getExperiencein classMerchantEntity
-
setExperience
public void setExperience(int amount) -
clearDailyRestockCount
private void clearDailyRestockCount() -
getGossip
-
setGossipDataFromTag
-
sendAiDebugData
protected void sendAiDebugData()- Overrides:
sendAiDebugDatain classMobEntity
-
sleep
- Overrides:
sleepin classLivingEntity
-
wakeUp
public void wakeUp()- Overrides:
wakeUpin classLivingEntity
-
hasRecentlyWorkedAndSlept
private boolean hasRecentlyWorkedAndSlept(long worldTime)
-