public class VillagerEntity extends AbstractTraderEntity 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 |
levellingUp |
private int |
levelUpTimer |
private static ImmutableList<MemoryModuleType<?>> |
MEMORY_MODULES |
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, defaultMaximumHealth, despawnCounter, field_20347, 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, pushCooldown, randomLargeSeed, randomSmallSeed, roll, scoreAmount, serverHeadYaw, serverPitch, serverX, serverY, serverYaw, serverZ, sidewaysSpeed, SLEEPING_DIMENSIONS, stepBobbingAmount, stuckArrowTimer, upwardSpeedage, chunkX, chunkY, chunkZ, dataTracker, dimension, distanceTraveled, fallDistance, firstUpdate, FLAGS, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inLava, inNetherPortal, lastNetherPortalDirection, lastNetherPortalDirectionVector, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalCooldown, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, removed, ridingCooldown, stepHeight, submergedInWater, teleporting, timeUntilRegen, touchingWater, trackedX, trackedY, trackedZ, updateNeeded, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, waterHeight, world, yawDUMMY| Constructor and Description |
|---|
VillagerEntity(EntityType<? extends VillagerEntity> type,
World world) |
VillagerEntity(EntityType<? extends VillagerEntity> entityType,
World world,
VillagerType type) |
canBeLeashedBy, changeDimension, equip, fillRecipesFromPool, getActiveEyeHeight, getCurrentCustomer, getHeadRollingTimeLeft, getInventory, getOffers, getTraderWorld, getTradingSound, getYesSound, hasCustomer, isLevelledTrader, onSellingItem, playCelebrateSound, produceParticles, setExperienceFromServer, setHeadRollingTimeLeft, setOffersFromServer, tradegetBreedingAge, growUp, growUp, isBaby, onTrackedDataSet, setBaby, setBreedingAge, tickMovementcanSpawn, getPathfindingFavor, getPathfindingFavor, getRunFromLeashSpeed, isNavigating, updateForLeashLength, updateLeashattachLeash, baseTick, canBeControlledByRider, canEquipmentSlotContain, canMobSpawn, canMoveVoluntarily, cannotDespawn, canPickUp, canPickupItem, canPickUpLoot, canSpawn, canTarget, canTarget, 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, isAiDisabled, isAttacking, isBetterItemFor, isDisallowedInPeaceful, isInDaylight, isInWalkTargetRange, isInWalkTargetRange, isLeashed, isLeftHanded, isLogicalSideForUpdatingMovement, isPersistent, lookAtEntity, method_20417, method_25938, method_25939, movesIndependently, onEatingGrass, onPlayerSpawnedChild, playAmbientSound, playHurtSound, playSpawnEffects, setAiDisabled, setAttacking, setCanPickUpLoot, setEquipmentDropChance, setForwardSpeed, setHoldingEntityId, setLeftHanded, setMovementSpeed, setPathfindingPenalty, setPersistent, setPositionTarget, setSidewaysSpeed, setTarget, setUpwardSpeed, spawnsTooManyForEachTry, startRiding, swimUpward, tickNewAi, tryAttack, tryEquip, turnHead, updateEnchantmentsaddStatusEffect, animateDamage, applyArmorToDamage, applyDamage, applyEnchantmentsToDamage, applyFrostWalker, attackLivingEntity, attemptSprintingParticles, canBeRiddenInWater, canBreatheInWater, canDropLootAndXp, canHaveStatusEffect, canSee, canWalkOnLava, clearActiveItem, clearPotionSwirls, clearSleepingPosition, clearStatusEffects, collides, computeFallDamage, consumeItem, containsOnlyAmbientEffects, createLivingAttributes, createSpawnPacket, damage, damageArmor, damageShield, destroy, drop, dropInventory, dropXp, eatFood, endCombat, enterCombat, fall, getAbsorptionAmount, getActiveHand, getActiveItem, getActiveStatusEffects, getArmor, getArmorVisibility, getArrowType, getAttackDistanceScalingFactor, getAttacker, getAttacking, getAttribute, getAttributeInstance, getAttributes, getBaseMovementSpeedMultiplier, getBlockState, getDamageTracker, getDespawnCounter, getDimensions, getDrinkSound, getEatSound, getEyeHeight, getFallSound, getGroup, getHandSwingProgress, getHeadYaw, getHealth, getItemUseTime, getItemUseTimeLeft, getJumpVelocity, getLastAttackedTime, getLastAttackTime, getLeaningPitch, getMainHandStack, getMaximumHealth, getMovementSpeed, getNextAirOnLand, getNextAirUnderwater, getOffHandStack, getPoses, getPrimeAdversary, getRandom, getRecentDamageSource, getRoll, getScaleFactor, getSleepingDirection, getSleepingPosition, getSoundPitch, getSoundVolume, getStackInHand, getStatusEffect, getStatusEffects, getStingerCount, getStuckArrowCount, getVelocityMultiplier, getYaw, handleFallDamage, hasStackEquipped, hasStatusEffect, heal, isAffectedBySplashPotions, isAlive, isBlocking, isClimbing, isFallFlying, isHolding, isHolding, isHoldingOntoLadder, isImmobile, isInsideWall, isInSwimmingPose, isMobOrPlayer, isPushable, isSleeping, isTarget, isUndead, isUsingItem, isUsingRiptide, jump, kill, knockback, knockDownwards, lookAt, markEffectsDirty, method_24832, method_24833, method_25937, method_26081, method_26082, method_26317, method_26318, method_26826, method_27071, onAttacking, onEquipStack, onKilledBy, onStatusEffectApplied, onStatusEffectRemoved, onStatusEffectUpgraded, playBlockFallSound, push, pushAway, pushAwayFrom, removeStatusEffect, removeStatusEffectInternal, scheduleVelocityUpdate, sendEquipmentBreakStatus, sendPickup, sendToolBreakStatus, setAbsorptionAmount, setCurrentHand, setDespawnCounter, setHeadYaw, setHealth, setJumping, setLivingFlag, setNearbySongPlaying, setOnGround, setPushCooldown, setSleepingPosition, setSprinting, setStackInHand, setStingerCount, setStuckArrowCount, setYaw, shouldAlwaysDropXp, shouldRenderName, spawnConsumptionEffects, stopRiding, stopUsingItem, swingHand, swingHand, takeKnockback, takeShieldHit, teleport, tickCramming, tickHandSwing, tickRiding, 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, copyFrom, copyPositionAndRotation, dealDamage, detach, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, extinguish, fromTag, getAir, getBlockPos, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getCollisionBox, getCommandSource, getCustomName, getDataTracker, getDefaultNetherPortalCooldown, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFlag, getHardCollisionBox, getHeight, getHeightOffset, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getLastNetherPortalDirection, getLastNetherPortalDirectionVector, getMaxAir, getMaxNetherPortalTime, getMountedHeightOffset, getMovementDirection, getName, getOppositeRotationVector, getOppositeRotationVector, getParticleX, getParticleZ, 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, getType, getUuid, getUuidAsString, getVehicle, getVelocity, getVelocityAffectingPos, getVisibilityBoundingBox, getWaterHeight, getWidth, getX, getY, getZ, handleAttack, hasCustomName, hashCode, hasNoGravity, hasPassenger, hasPassengerDeep, hasPassengers, hasPassengerType, hasPermissionLevel, hasPlayerRider, hasVehicle, hasWings, interactAt, isAttackable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isFireImmune, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWaterOrBubbleColumn, isInSneakingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isOnFire, isOnGround, isPartOf, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_24826, method_24829, move, moveToBoundingBoxCenter, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onPlayerCollision, onStartedTrackingBy, onStoppedTrackingBy, onSwimmingStart, playFlySound, playSound, playStepSound, playSwimSound, populateCrashReport, positAfterTeleport, pushOutOfBlocks, rayTrace, refreshPosition, refreshPositionAndAngles, refreshPositionAndAngles, remove, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetPosition, saveSelfToTag, saveToTag, sendSystemMessage, setAir, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, setFireTicks, setFlag, setGlowing, setInLava, setInNetherPortal, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setPos, setPose, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, setWorld, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldSetPositionOnLoad, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, streamPassengersRecursively, teleport, teleportRequested, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerPosition, updatePassengerPosition, updatePosition, updatePositionAndAngles, updatePositionsRecursively, updateSwimming, 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 levellingUp
@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
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<?> deserializeBrain(com.mojang.datafixers.Dynamic<?> data)
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 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 TradersetCurrentCustomer in class AbstractTraderEntityprotected void resetCustomer()
resetCustomer in class AbstractTraderEntityprivate void clearCurrentBonus()
public boolean canRefreshTrades()
canRefreshTrades in interface Traderpublic 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 AbstractTraderEntitypublic void writeCustomDataToTag(CompoundTag tag)
writeCustomDataToTag in class AbstractTraderEntitypublic void readCustomDataFromTag(CompoundTag tag)
readCustomDataFromTag in class AbstractTraderEntitypublic 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 AbstractTraderEntitypublic void setAttacker(@Nullable LivingEntity attacker)
setAttacker in class LivingEntitypublic void onDeath(DamageSource source)
onDeath in class AbstractTraderEntityprivate 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(TraderOfferList 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(IWorld world, LocalDifficulty difficulty, SpawnType spawnType, @Nullable EntityData entityData, @Nullable CompoundTag entityTag)
initialize in class AbstractTraderEntitypublic VillagerEntity createChild(PassiveEntity passiveEntity)
createChild in class PassiveEntitypublic void onStruckByLightning(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 AbstractTraderEntitypublic void talkWithVillager(VillagerEntity villagerEntity, long time)
private void decayGossip()
public void summonGolem(long time,
int requiredVillagerCount)
private void setGolemLastSeenTime(long time)
private boolean hasSeenGolemRecently(long currentTime)
public boolean canSummonGolem(long time)
@Nullable private IronGolemEntity spawnIronGolem()
public void onInteractionWith(EntityInteraction interaction, Entity entity)
onInteractionWith in interface InteractionObserverpublic int getExperience()
getExperience in interface TradergetExperience in class AbstractTraderEntitypublic void setExperience(int amount)
private void clearDailyRestockCount()
public VillagerGossips getGossip()
public void method_21650(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)