public class VillagerEntity extends MerchantEntity implements InteractionObserver, VillagerDataContainer
PassiveEntity.PassiveDataEntity.PositionUpdater| Modifier and Type | Field and 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 |
offersbreedingAge, forcedAge, happyTicksRemainingambientSoundChance, armorDropChances, experiencePoints, goalSelector, handDropChances, jumpControl, lookControl, moveControl, navigation, targetSelectoractiveItemStack, 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, upwardSpeedage, 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, yawDUMMY| Constructor and Description |
|---|
VillagerEntity(EntityType<? extends VillagerEntity> type,
World world) |
VillagerEntity(EntityType<? extends VillagerEntity> entityType,
World world,
VillagerType type) |
canBeLeashedBy, equip, fillRecipesFromPool, getActiveEyeHeight, getCurrentCustomer, getHeadRollingTimeLeft, getInventory, getMerchantWorld, getOffers, getTradingSound, getYesSound, hasCustomer, isLeveledMerchant, method_30951, moveToWorld, onSellingItem, playCelebrateSound, produceParticles, setExperienceFromServer, setHeadRollingTimeLeft, setOffersFromServer, tradegetBreedingAge, growUp, growUp, isBaby, onTrackedDataSet, setBaby, setBreedingAge, tickMovementcanSpawn, getPathfindingFavor, getPathfindingFavor, getRunFromLeashSpeed, isNavigating, updateForLeashLength, updateLeashattachLeash, 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, updateGoalControlsaddSoulSpeedBoostIfNeeded, 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, updateTrackedPositionAndAnglesaddPassenger, 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, wouldPoseNotCollideclone, finalize, getClass, notify, notifyAll, wait, wait, waitsendOffersprivate static final TrackedData<VillagerData> VILLAGER_DATA
private static final ImmutableList<MemoryModuleType<?>> MEMORY_MODULES
private static final ImmutableList<SensorType<? extends Sensor<? super VillagerEntity>>> SENSORS
public static final Map<MemoryModuleType<GlobalPos>,BiPredicate<VillagerEntity,PointOfInterestType>> POINTS_OF_INTEREST
private int levelUpTimer
private boolean levelingUp
@Nullable private PlayerEntity lastCustomer
private byte foodLevel
private final VillagerGossips gossip
private long gossipStartTime
private long lastGossipDecayTime
private int experience
private long lastRestockTime
private int restocksToday
private long lastRestockCheckTime
private boolean natural
public VillagerEntity(EntityType<? extends VillagerEntity> type, World world)
public VillagerEntity(EntityType<? extends VillagerEntity> entityType, World world, VillagerType type)
public Brain<VillagerEntity> getBrain()
getBrain in class LivingEntityprotected Brain.Profile<VillagerEntity> createBrainProfile()
createBrainProfile in class LivingEntityprotected Brain<?> deserializeBrain(com.mojang.serialization.Dynamic<?> dynamic)
deserializeBrain in class LivingEntitypublic void reinitializeBrain(ServerWorld world)
private void initBrain(Brain<VillagerEntity> brain)
protected void onGrowUp()
onGrowUp in class PassiveEntitypublic static DefaultAttributeContainer.Builder createVillagerAttributes()
public boolean isNatural()
public ActionResult interactMob(PlayerEntity player, Hand hand)
interactMob in class MobEntityprivate void sayNo()
private void beginTradeWith(PlayerEntity customer)
public void setCurrentCustomer(@Nullable PlayerEntity customer)
setCurrentCustomer in interface MerchantsetCurrentCustomer in class MerchantEntityprotected void resetCustomer()
resetCustomer in class MerchantEntityprivate void clearCurrentBonus()
public boolean canRefreshTrades()
canRefreshTrades in interface Merchantpublic void restock()
private boolean needRestock()
private boolean canRestock()
public boolean shouldRestock()
private void method_21723()
private void updatePricesOnDemand()
private void prepareRecipesFor(PlayerEntity player)
protected void initDataTracker()
initDataTracker in class MerchantEntitypublic void writeCustomDataToTag(CompoundTag tag)
writeCustomDataToTag in class MerchantEntitypublic void readCustomDataFromTag(CompoundTag tag)
readCustomDataFromTag in class MerchantEntitypublic boolean canImmediatelyDespawn(double distanceSquared)
canImmediatelyDespawn in class MobEntity@Nullable protected SoundEvent getAmbientSound()
getAmbientSound in class MobEntityprotected SoundEvent getHurtSound(DamageSource source)
getHurtSound in class LivingEntityprotected SoundEvent getDeathSound()
getDeathSound in class LivingEntitypublic void playWorkSound()
public void setVillagerData(VillagerData villagerData)
public VillagerData getVillagerData()
getVillagerData in interface VillagerDataContainerprotected void afterUsing(TradeOffer offer)
afterUsing in class MerchantEntitypublic void setAttacker(@Nullable LivingEntity attacker)
setAttacker in class LivingEntitypublic void onDeath(DamageSource source)
onDeath in class MerchantEntityprivate void method_30958()
private void notifyDeath(Entity killer)
public void releaseTicketFor(MemoryModuleType<GlobalPos> memoryModuleType)
public boolean isReadyToBreed()
isReadyToBreed in class PassiveEntityprivate boolean lacksFood()
private void consumeAvailableFood()
public int getReputation(PlayerEntity player)
private void depleteFood(int amount)
public void eatForBreeding()
public void setOffers(TradeOfferList offers)
private boolean canLevelUp()
private void levelUp()
protected Text getDefaultName()
getDefaultName in class Entity@Environment(value=CLIENT) public void handleStatus(byte status)
handleStatus in class MobEntity@Nullable public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable CompoundTag entityTag)
initialize in class MerchantEntitypublic VillagerEntity createChild(ServerWorld serverWorld, PassiveEntity passiveEntity)
createChild in class PassiveEntitypublic void onStruckByLightning(ServerWorld world, LightningEntity lightning)
onStruckByLightning in class Entityprotected void loot(ItemEntity item)
public boolean wantsToStartBreeding()
public boolean canBreed()
private int getAvailableFood()
public boolean hasSeedToPlant()
protected void fillRecipes()
fillRecipes in class MerchantEntitypublic void talkWithVillager(ServerWorld world, VillagerEntity villager, long time)
private void decayGossip()
public void summonGolem(ServerWorld world, long time, int int2)
public boolean canSummonGolem(long time)
@Nullable private IronGolemEntity spawnIronGolem(ServerWorld world)
@Nullable private BlockPos method_30023(BlockPos blockPos, double double2, double double3)
public void onInteractionWith(EntityInteraction interaction, Entity entity)
onInteractionWith in interface InteractionObserverpublic int getExperience()
getExperience in interface MerchantgetExperience in class MerchantEntitypublic void setExperience(int amount)
private void clearDailyRestockCount()
public VillagerGossips getGossip()
public void setGossipDataFromTag(Tag tag)
protected void sendAiDebugData()
sendAiDebugData in class MobEntitypublic void sleep(BlockPos pos)
sleep in class LivingEntitypublic void wakeUp()
wakeUp in class LivingEntityprivate boolean hasRecentlyWorkedAndSlept(long worldTime)