Class CavalryHorseEntity
- All Implemented Interfaces:
IManagedAnimal<CavalryHorseEntity>,ICitizenJobMount,net.minecraft.commands.CommandSource,net.minecraft.network.syncher.SyncedDataHolder,net.minecraft.world.ContainerListener,net.minecraft.world.entity.Attackable,net.minecraft.world.entity.EquipmentUser,net.minecraft.world.entity.HasCustomInventoryScreen,net.minecraft.world.entity.Leashable,net.minecraft.world.entity.OwnableEntity,net.minecraft.world.entity.PlayerRideable,net.minecraft.world.entity.PlayerRideableJumping,net.minecraft.world.entity.Saddleable,net.minecraft.world.entity.Targeting,net.minecraft.world.entity.VariantHolder<net.minecraft.world.entity.animal.horse.Variant>,net.minecraft.world.level.entity.EntityAccess,net.minecraft.world.Nameable,net.minecraft.world.scores.ScoreHolder,net.neoforged.neoforge.attachment.IAttachmentHolder,net.neoforged.neoforge.common.extensions.IEntityExtension,net.neoforged.neoforge.common.extensions.ILivingEntityExtension,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.animal.horse.Horse
net.minecraft.world.entity.animal.horse.Horse.HorseGroupDataNested classes/interfaces inherited from class net.minecraft.world.entity.AgeableMob
net.minecraft.world.entity.AgeableMob.AgeableMobGroupDataNested classes/interfaces inherited from class net.minecraft.world.entity.LivingEntity
net.minecraft.world.entity.LivingEntity.FallsoundsNested classes/interfaces inherited from class net.minecraft.world.entity.Entity
net.minecraft.world.entity.Entity.MoveFunction, net.minecraft.world.entity.Entity.MovementEmission, net.minecraft.world.entity.Entity.RemovalReasonNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.AttachmentHolder.AsFieldNested classes/interfaces inherited from interface net.minecraft.world.entity.Leashable
net.minecraft.world.entity.Leashable.LeashData -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final floatstatic final net.minecraft.network.syncher.EntityDataAccessor<Integer> static final net.minecraft.network.syncher.EntityDataAccessor<Integer> static final intThe cooldown for logging when debugging.static final floatThe base width and height of the horse entity.Fields inherited from class net.minecraft.world.entity.animal.horse.AbstractHorse
allowStandSliding, BREEDING_CROSS_FACTOR, canGallop, CHEST_SLOT_OFFSET, EQUIPMENT_SLOT_OFFSET, gallopSoundCounter, INV_BASE_COUNT, INV_SLOT_SADDLE, inventory, INVENTORY_SLOT_OFFSET, isJumping, playerJumpPendingScale, sprintCounter, tailCounter, temperFields inherited from class net.minecraft.world.entity.animal.Animal
PARENT_AGE_AFTER_BREEDINGFields inherited from class net.minecraft.world.entity.AgeableMob
age, BABY_START_AGE, forcedAge, forcedAgeTimerFields inherited from class net.minecraft.world.entity.PathfinderMob
DEFAULT_WALK_TARGET_VALUEFields inherited from class net.minecraft.world.entity.Mob
ambientSoundTime, armorDropChances, armorItems, bodyArmorDropChance, DEFAULT_EQUIPMENT_DROP_CHANCE, goalSelector, handDropChances, jumpControl, lookControl, MAX_ENCHANTED_ARMOR_CHANCE, MAX_ENCHANTED_WEAPON_CHANCE, MAX_PICKUP_LOOT_CHANCE, MAX_WEARING_ARMOR_CHANCE, moveControl, navigation, PICKUP_REACH, PRESERVE_ITEM_DROP_CHANCE, PRESERVE_ITEM_DROP_CHANCE_THRESHOLD, RANDOM_SPAWN_BONUS_ID, targetSelector, UPDATE_GOAL_SELECTOR_EVERY_N_TICKS, xpRewardFields inherited from class net.minecraft.world.entity.LivingEntity
animStep, animStepO, appliedScale, ARMOR_SLOT_OFFSET, ARMOR_SLOTS, attackAnim, attackStrengthTicker, ATTRIBUTES_FIELD, autoSpinAttackDmg, autoSpinAttackItemStack, autoSpinAttackTicks, BASE_JUMP_POWER, BODY_ARMOR_OFFSET, brain, damageContainers, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathScore, deathTime, DEFAULT_BABY_SCALE, DEFAULT_BASE_GRAVITY, EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT, fallFlyTicks, HAND_SLOTS, hurtDuration, hurtTime, invulnerableDuration, jumping, lastHurt, lastHurtByPlayer, lastHurtByPlayerTime, lerpHeadSteps, lerpSteps, lerpX, lerpXRot, lerpY, lerpYHeadRot, lerpYRot, lerpZ, LIVING_ENTITY_FLAG_IS_USING, LIVING_ENTITY_FLAG_OFF_HAND, LIVING_ENTITY_FLAG_SPIN_ATTACK, MIN_MOVEMENT_DISTANCE, noActionTime, oAttackAnim, oRun, PLAYER_HURT_EXPERIENCE_TIME, removeArrowTime, removeStingerTime, rotA, rotOffs, run, SLEEPING_DIMENSIONS, SWING_DURATION, swinging, swingingArm, swingTime, timeOffs, USE_ITEM_INTERVAL, useItem, useItemRemaining, walkAnimation, xxa, yBodyRot, yBodyRotO, yHeadRot, yHeadRotO, yya, zzaFields 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, dimensions, 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, noCulling, noPhysics, PASSENGERS_TAG, portalProcess, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, verticalCollision, verticalCollisionBelow, walkDist, walkDistO, wasEyeInWater, wasInPowderSnow, wasOnFire, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOldFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.commands.CommandSource
NULLFields inherited from interface net.minecraft.world.entity.Leashable
LEASH_ELASTIC_DIST, LEASH_TAG, LEASH_TOO_FAR_DISTFields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionCavalryHorseEntity(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.animal.horse.Horse> type, net.minecraft.world.level.Level level) Constructor for CavalryHorseEntity. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalSaveData(net.minecraft.nbt.CompoundTag tag) Adds additional data to the CompoundTag that is specific to this entity type.protected voidaddPassenger(net.minecraft.world.entity.Entity passenger) Adds a passenger to the horse, dropping the leash and clearing the recent dismount cooldown.voidaiStep()This method is called by the entity every tick to update its state.booleanReplaces this horse's mount health modifier with the bonus granted by its colony's current research.booleancanMate(net.minecraft.world.entity.animal.Animal other) Allow breeding even when not tamed.booleanclearFor(@NotNull net.minecraft.world.entity.Entity reserver) Clears the reservation on the horse if it is reserved by the entity with the given UUID.voidClears the reservation on the horse.voidconfigureMountedPathing(PathingOptions options) Applies mount-specific settings to the pathing options copied from the mount's navigator.static CavalryHorseEntitycreateFromVanilla(IColony colony, net.minecraft.world.level.Level level, net.minecraft.world.entity.animal.horse.AbstractHorse vanilla) Creates a new CavalryHorseEntity from a vanilla AbstractHorse, attempting to preserve as much information as possible.protected net.minecraft.world.entity.ai.navigation.PathNavigationcreateNavigation(net.minecraft.world.level.Level level) Creates a new PathNavigation for this horse entity, overriding the default vanilla horse navigation.protected voiddefineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) Defines the synced data for this entity.voiddropLeash(boolean broadcastPacket, boolean dropLeadItem) Drops the leash for this horse, optionally sending a packet to clients and dropping the lead item.Returns the animal data associated with this horse.Returns the animal data view associated with this horse.net.minecraft.network.syncher.EntityDataAccessor<Integer> Gets the accessor for the animal ID of this entity.intGet the colony associated with this managed animal.net.minecraft.network.syncher.EntityDataAccessor<Integer> Gets the accessor for the colony ID of this entity.floatReturns the current combat cooldown of the horse.Returns the entity itself.longGets the last time this horse was dismounted from, in game ticks.intGet the managed animal ID of this entity.protected net.minecraft.world.phys.Vec3getPassengerAttachmentPoint(net.minecraft.world.entity.Entity passenger, net.minecraft.world.entity.EntityDimensions dims, float partialTick) Returns the attachment point for the given passenger entity, taking into account the entity dimensions and the partial tick.Returns the stable building of the horse if it exists.booleanWhether the mount recently collided horizontally while following its rider's path.booleanWhether the horse collided in the last 10 ticksbooleanCheck if the horse has a valid cavalry rider.booleanChecks if the horse has a reservation by another entity.booleanChecks if the horse has a trainer entity (i.e.booleanhurt(net.minecraft.world.damagesource.DamageSource damageSource, float damageAmount) Applies damage to this entity.protected booleanisHorizontalCollisionMinor(net.minecraft.world.phys.Vec3 vec3) A minor horizontal collision is one that occurs when the horse has moved into a solid block.booleanChecks if the horse is currently within the boundaries of its stable building.booleanReturns whether the horse is ready for combat.voidLogs all active goals for this horse, including both the wrapped goal selector goals and the target selector goals.booleanChecks whether this horse's mount health modifier differs from its colony's current research bonus.voidonSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> dataAccessor) Called when the entity's data is updated from the server.voidprepareForCombat(float combatReadiness) Prepares the horse for combat by reducing its combat cooldown by the specified amount of combat readiness.voidreadAdditionalSaveData(net.minecraft.nbt.CompoundTag tag) Reads additional data from the given CompoundTag that is specific to this entity type.voidRegisters the goals for this entity.protected voidremovePassenger(net.minecraft.world.entity.Entity passenger) Called when a passenger is removed from this horse.voidreserve(@NotNull net.minecraft.world.entity.Entity reserver) Reserves the horse for the given entity.@Nullable UUIDReturns the UUID of the entity that has reserved this horse, or null if it is not reserved.voidsetAnimalData(IAnimalData data) Sets the animal data associated with this horse.voidsetColonyId(int colonyId) Set the colony associated with this managed animal.voidsetLeashedTo(net.minecraft.world.entity.Entity entity, boolean sendPacket) Sets the entity that this horse is leashed to.voidsetManagedAnimalId(int managedAnimalId) Set the managed animal ID of this entity.booleanWhether this entity should be saved to disk.voidtick()Called every tick to update the horse.Methods inherited from class net.minecraft.world.entity.animal.horse.Horse
canUseSlot, containerChanged, finalizeSpawn, getAmbientSound, getAngrySound, getBreedOffspring, getDeathSound, getDefaultDimensions, getEatingSound, getHurtSound, getMarkings, getVariant, isBodyArmorItem, mobInteract, playGallopSound, randomizeAttributes, setVariantMethods inherited from class net.minecraft.world.entity.animal.horse.AbstractHorse
addBehaviourGoals, canEatGrass, canJump, canParent, canPerformRearing, causeFallDamage, createBaseHorseAttributes, createInventory, doPlayerRide, dropEquipment, equipBodyArmor, equipSaddle, executeRidersJump, fedFood, followMommy, generateJumpStrength, generateMaxHealth, generateSpeed, getAmbientSoundInterval, getAmbientStandInterval, getAmbientStandSound, getBodyArmorAccess, getControllingPassenger, getDismountLocationForPassenger, getEatAnim, getFlag, getInventory, getInventoryColumns, getInventorySize, getInventorySize, getMaxSpawnClusterSize, getMaxTemper, getMouthAnim, getOwnerUUID, getRiddenInput, getRiddenRotation, getRiddenSpeed, getSlot, getSoundVolume, getStandAnim, getTemper, handleEating, handleEntityEvent, handleLeashAtDistance, handleStartJump, handleStopJump, hasInventoryChanged, isBred, isEating, isFood, isImmobile, isJumping, isPushable, isSaddleable, isSaddled, isStanding, isTamed, makeMad, modifyTemper, onClimbable, onPlayerJump, openCustomInventoryScreen, playJumpSound, playStepSound, positionRider, setBred, setEating, setFlag, setIsJumping, setOffspringAttributes, setOwnerUUID, setStanding, setTamed, setTemper, spawnTamingParticles, standIfPossible, syncSaddleToClients, tameWithName, tickRiddenMethods inherited from class net.minecraft.world.entity.animal.Animal
actuallyHurt, canFallInLove, checkAnimalSpawnRules, customServerAiStep, finalizeSpawnChildFromBreeding, getBaseExperienceReward, getInLoveTime, getLoveCause, getWalkTargetValue, isBrightEnoughToSpawn, isInLove, removeWhenFarAway, resetLove, setInLove, setInLoveTime, spawnChildFromBreeding, usePlayerItemMethods inherited from class net.minecraft.world.entity.AgeableMob
ageBoundaryReached, ageUp, ageUp, canBreed, getAge, getSpeedUpSecondsWhenFeeding, isBaby, setAge, setBabyMethods inherited from class net.minecraft.world.entity.PathfinderMob
checkSpawnRules, closeRangeLeashBehaviour, followLeashSpeed, getWalkTargetValue, isPanicking, isPathFinding, shouldStayCloseToLeashHolderMethods inherited from class net.minecraft.world.entity.Mob
ate, baseTick, canAttackType, canBeLeashed, canFireProjectileWeapon, canHoldItem, canPickUpLoot, canReplaceCurrentItem, canReplaceEqualItem, canTakeItem, checkAndHandleImportantInteractions, checkDespawn, checkMobSpawnRules, checkSpawnObstruction, clampHeadRotationToBody, clearRestriction, convertTo, createBodyControl, createMobAttributes, doHurtTarget, dropCustomDeathLoot, dropFromLootTable, dropPreservedEquipment, dropPreservedEquipment, enchantSpawnedArmor, enchantSpawnedWeapon, equip, equip, equipItemIfPossible, getArmorAndBodyArmorSlots, getArmorSlots, getAttackBoundingBox, getBodyArmorItem, getDefaultLootTable, getEquipmentDropChance, getEquipmentForSlot, getHandSlots, getHeadRotSpeed, getItemBySlot, getJumpControl, getLeashData, getLookControl, getLootTable, getLootTableSeed, getMainArm, getMaxFallDistance, getMaxHeadXRot, getMaxHeadYRot, getMoveControl, getNavigation, getPathfindingMalus, getPickResult, getPickupReach, getRestrictCenter, getRestrictRadius, getSensing, getSpawnType, getTarget, getTargetFromBrain, hasRestriction, interact, isAggressive, isEffectiveAi, isLeftHanded, isMaxGroupSizeReached, isNoAi, isPersistenceRequired, isSpawnCancelled, isSunBurnTick, isWearingBodyArmor, isWithinMeleeAttackRange, isWithinRestriction, isWithinRestriction, jumpInFluid, jumpInLiquid, leashTooFarBehaviour, lookAt, onOffspringSpawnedFromEgg, onPathfindingDone, onPathfindingStart, pickUpItem, playAmbientSound, playAttackSound, playHurtSound, populateDefaultEquipmentEnchantments, populateDefaultEquipmentSlots, removeAfterChangingDimensions, removeAllGoals, removeFreeWill, requiresCustomPersistence, restrictTo, sendDebugPackets, serverAiStep, setAggressive, setBodyArmorItem, setCanPickUpLoot, setDropChance, setGuaranteedDrop, setItemSlot, setItemSlotAndDropWhenKilled, setLeashData, setLeftHanded, setNoAi, setPathfindingMalus, setPersistenceRequired, setSpawnCancelled, setSpeed, setTarget, setXxa, setYya, setZza, shouldDespawnInPeaceful, shouldPassengersInheritMalus, spawnAnim, startRiding, stopInPlace, tickHeadTurn, updateControlFlags, wantsToPickUpMethods inherited from class net.minecraft.world.entity.LivingEntity
activeLocationDependentEnchantments, addEffect, addEffect, animateHurt, areAllEffectsAmbient, attackable, blockedByShield, blockUsingShield, brainProvider, calculateEntityAnimation, calculateFallDamage, canAttack, canAttack, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canDisableShield, canFreeze, canStandOnFluid, canUsePortal, checkAutoSpinAttack, checkBedExists, checkFallDamage, clearSleepingPos, completeUsingItem, createLivingAttributes, createWitherRose, decreaseAirSupply, detectEquipmentUpdates, die, doAutoAttackOnTouch, doesEmitEquipEvent, doHurtEquipment, doPush, dropAllDeathLoot, dropExperience, eat, eat, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getAgeScale, getAllSlots, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, getAttribute, getAttributeBaseValue, getAttributes, getAttributeValue, getBedOrientation, getBlockSpeedFactor, getBoundingBoxForCulling, getBrain, getCombatTracker, getComfortableFallDistance, getCurrentSwingDuration, getDamageAfterArmorAbsorb, getDamageAfterMagicAbsorb, getDefaultGravity, getDimensions, getDismountPoses, getDrinkingSound, getEatingSound, getEffect, getEquipmentSlotForItem, getExperienceReward, getFallFlyingTicks, getFallSounds, getFluidFallingAdjustedMovement, getFlyingSpeed, getHealth, getHitbox, getHurtDir, getItemInHand, getJumpBoostPower, getJumpPower, getJumpPower, getKillCredit, getKnockback, getLastAttacker, getLastClimbablePos, getLastDamageSource, getLastHurtByMob, getLastHurtByMobTimestamp, getLastHurtMob, getLastHurtMobTimestamp, getLocalBoundsForPose, getMainHandItem, getMaxAbsorption, getMaxHeadRotationRelativeToBody, getMaxHealth, getNoActionTime, getOffhandItem, getPassengerRidingPosition, getPreciseBodyRotation, getProjectile, getRelativePortalPosition, getScale, getSleepingPos, getSlotForHand, getSpeed, getStingerCount, getSwimAmount, getTicksUsingItem, getUsedItemHand, getUseItem, getUseItemRemainingTicks, getViewYRot, getVisibilityPercent, getVisualRotationYInDegrees, getVoicePitch, getWaterSlowDown, getWeaponItem, getYHeadRot, goDownInWater, handleDamageEvent, handleRelativeFrictionAndCalculateMovement, hasEffect, hasInfiniteMaterials, hasItemInSlot, hasLandedInLiquid, hasLineOfSight, heal, hurtArmor, hurtCurrentlyUsedShield, hurtHelmet, igniteForTicks, increaseAirSupply, indicateDamage, internalSetAbsorptionAmount, isAffectedByFluids, isAffectedByPotions, isAlive, isAlwaysExperienceDropper, isAutoSpinAttack, isBlocking, isCurrentlyGlowing, isDamageSourceBlocked, isDeadOrDying, isFallFlying, isHolding, isHolding, isInvertedHealAndHarm, isInvulnerableTo, isInWall, isPickable, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadRotationStep, lerpHeadTo, lerpTargetX, lerpTargetXRot, lerpTargetY, lerpTargetYRot, lerpTargetZ, lerpTo, lookAt, makeBrain, makeSound, maxUpStep, onBelowWorld, onChangedBlock, onEffectAdded, onEffectRemoved, onEffectUpdated, onEnterCombat, onEquipItem, onEquippedItemBroken, onItemPickup, onLeaveCombat, playBlockFallSound, push, pushEntities, randomTeleport, recreateFromPacket, releaseUsingItem, remove, removeAllEffects, removeEffect, removeEffectNoUpdate, removeEffectParticles, removeEffectsCuredBy, removeFrost, resetForwardDirectionOfRelativePortalPosition, rideTick, sanitizeScale, sendEffectToPassengers, setAbsorptionAmount, setArrowCount, setDiscardFriction, setHealth, setItemInHand, setJumping, setLastHurtByMob, setLastHurtByPlayer, setLastHurtMob, setLivingEntityFlag, setNoActionTime, setRecordPlayingNearby, setSleepingPos, setSprinting, setStingerCount, setYBodyRot, setYHeadRot, shouldDiscardFriction, shouldDropExperience, shouldDropLoot, shouldRiderFaceForward, shouldShowName, skipDropExperience, startSleeping, startUsingItem, stopRiding, stopSleeping, stopUsingItem, swing, swing, take, tickDeath, tickEffects, travel, triggerItemUseEffects, triggerOnDeathMobEffects, tryAddFrost, updateEffectVisibility, updateFallFlying, updateInvisibilityStatus, updateSwimAmount, updateSwingTime, updateUsingItem, updateWalkAnimation, verifyEquippedItem, wasExperienceConsumed, wouldNotSuffocateAtTargetPoseMethods inherited from class net.minecraft.world.entity.Entity
absMoveTo, absMoveTo, absRotateTo, acceptsFailure, acceptsSuccess, addDeltaMovement, addTag, adjustSpawnLocation, applyGravity, awardKillScore, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canChangeDimensions, canCollideWith, canControlVehicle, canRide, canSpawnSprintParticle, canSprint, canTrample, captureDrops, captureDrops, changeDimension, checkBelowWorld, checkInsideBlocks, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, collideBoundingBox, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStack, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, 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, getDisplayName, getEncodeId, getEntityData, getEyeHeight, getEyeHeight, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getGravity, getHandHoldingItemAngle, getId, getInBlockState, getIndirectPassengers, getKnownMovement, getLeashOffset, getLeashOffset, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxHeightFluidType, getMotionDirection, getMovementEmission, getName, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengers, getPassengersAndSelf, getPercentFrozen, getPermissionLevel, getPersistentData, getPickRadius, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPrimaryStepSoundBlockPos, getRandom, getRandomX, getRandomY, getRandomZ, getRemainingFireTicks, getRemovalReason, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getServer, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getTypeName, getUpVector, getUUID, getVehicle, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getX, getX, getXRot, getY, getY, getYRot, getZ, getZ, handlePortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPermissions, hasPose, igniteForSeconds, ignoreExplosion, interactAt, is, isAddedToLevel, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInLiquid, isInvisible, isInvisibleTo, isInvulnerable, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, killedEntity, lavaHurt, lerpMotion, lerpPositionAndRotationStep, level, limitPistonMovement, load, makeBoundingBox, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mayInteract, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onAddedToLevel, onClientRemoval, onExplosionHit, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, onRemovedFromLevel, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playSwimSound, position, positionRider, processFlappingMovement, processPortalCooldown, push, push, reapplyPosition, refreshDimensions, registryAccess, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, rotate, save, saveAsPassenger, saveWithoutId, sendSystemMessage, setAirSupply, setAsInsidePortal, setBoundingBox, setCustomName, setCustomNameVisible, setData, setDeltaMovement, setDeltaMovement, setFluidTypeHeight, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setLevel, setLevelCallback, setNoGravity, setOldPosAndRot, setOnGround, setOnGroundWithMovement, setPortalCooldown, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYRot, shouldBlockExplode, shouldInformAdmins, shouldRender, shouldRenderAtSqrDistance, showVehicleHealth, skipAttackInteraction, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startSeenByPlayer, stopSeenByPlayer, syncPacketPositionCodec, teleportRelative, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, tryCheckInsideBlocks, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateFluidOnEyes, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSoundMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingData, hasAttachments, hasData, removeData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.commands.CommandSource
alwaysAcceptsMethods inherited from interface net.minecraft.world.entity.EquipmentUser
equip, equip, equip, resolveSlotMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IEntityExtension
canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canTrample, captureDrops, captureDrops, copyAttachmentsFrom, deserializeNBT, getClassification, getEyeInFluidType, getFluidFallDistanceModifier, getFluidMotionScale, getFluidTypeHeight, getMaxHeightFluidType, getParts, getPersistentData, getPickedResult, getSoundFromFluidType, hasCustomOutlineRendering, isAddedToLevel, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, onAddedToLevel, onRemovedFromLevel, revive, sendPairingData, serializeNBT, shouldRiderSitMethods inherited from interface net.neoforged.neoforge.common.extensions.ILivingEntityExtension
canDrownInFluidType, canSwimInFluidType, moveInFluid, onDamageTaken, self, sinkInFluidMethods inherited from interface com.minecolonies.api.colony.managers.interfaces.IManagedAnimal
getOffsetTicksMethods inherited from interface net.minecraft.world.entity.Leashable
canHaveALeashAttachedToIt, elasticRangeLeashBehaviour, getLeashHolder, isLeashed, mayBeLeashed, readLeashData, setDelayedLeashHolderId, writeLeashDataMethods inherited from interface net.minecraft.world.entity.OwnableEntity
getOwner, levelMethods inherited from interface net.minecraft.world.entity.PlayerRideableJumping
getJumpCooldownMethods inherited from interface net.minecraft.world.entity.Saddleable
getSaddleSoundEventMethods inherited from interface net.minecraft.world.scores.ScoreHolder
getFeedbackDisplayName
-
Field Details
-
DATA_COLONY_ID
-
DATA_MANAGED_ANIMAL_ID
public static final net.minecraft.network.syncher.EntityDataAccessor<Integer> DATA_MANAGED_ANIMAL_ID -
SLIM_W
public static final float SLIM_WThe base width and height of the horse entity. Note that the width is deliberately slim to allow 1-wide pathing for cavalry units. Base height matches vanilla horse height.- See Also:
-
BASE_H
public static final float BASE_H- See Also:
-
LOG_COOLDOWN_INTERVAL
public static final int LOG_COOLDOWN_INTERVALThe cooldown for logging when debugging.- See Also:
-
COMBAT_READINESS_THRESHOLD
public static final float COMBAT_READINESS_THRESHOLD- See Also:
-
-
Constructor Details
-
CavalryHorseEntity
public CavalryHorseEntity(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.animal.horse.Horse> type, net.minecraft.world.level.Level level) Constructor for CavalryHorseEntity.- Parameters:
type- The entity typelevel- The level the entity is in
-
-
Method Details
-
configureMountedPathing
Description copied from interface:ICitizenJobMountApplies mount-specific settings to the pathing options copied from the mount's navigator.- Specified by:
configureMountedPathingin interfaceICitizenJobMount- Parameters:
options- the pathing options for the mounted path job
-
hadHorizontalCollision
public boolean hadHorizontalCollision()Description copied from interface:ICitizenJobMountWhether the mount recently collided horizontally while following its rider's path.- Specified by:
hadHorizontalCollisionin interfaceICitizenJobMount- Returns:
- true if the mount recently collided horizontally
-
registerGoals
public void registerGoals()Registers the goals for this entity.This sets the float goal, follow parent goal, breed goal, validate stable goal, return to stable goal, water avoiding random stroll goal, look at player goal, and random look around goal. If the entity can perform rearing, it also sets the random stand goal.
- Overrides:
registerGoalsin classnet.minecraft.world.entity.animal.horse.AbstractHorse
-
onSyncedDataUpdated
public void onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> dataAccessor) Called when the entity's data is updated from the server. If the entity has a citizen colony handler, it calls the handler's onSyncDataUpdate method. If the entity is on the client side and the data accessor is DATA_STYLE, it checks if the entity's style is in the list of valid styles and if not, it sets the style to the first valid style in the list.- Specified by:
onSyncedDataUpdatedin interfacenet.minecraft.network.syncher.SyncedDataHolder- Overrides:
onSyncedDataUpdatedin classnet.minecraft.world.entity.AgeableMob- Parameters:
dataAccessor- The data accessor which contains the updated data.
-
aiStep
public void aiStep()This method is called by the entity every tick to update its state. It handles registration of the entity to the closest colony if it was summoned into the world via an ops command. It also handles updating the client side of the managed animal data and the animal colony handler.- Overrides:
aiStepin classnet.minecraft.world.entity.animal.horse.AbstractHorse
-
defineSynchedData
protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) Defines the synced data for this entity.- Overrides:
defineSynchedDatain classnet.minecraft.world.entity.animal.horse.Horse
-
getColonyIdAccessor
Gets the accessor for the colony ID of this entity.- Specified by:
getColonyIdAccessorin interfaceIManagedAnimal<CavalryHorseEntity>- Returns:
- the accessor for the colony ID
-
getColonyId
public int getColonyId()Description copied from interface:IManagedAnimalGet the colony associated with this managed animal.- Specified by:
getColonyIdin interfaceIManagedAnimal<CavalryHorseEntity>
-
setColonyId
public void setColonyId(int colonyId) Description copied from interface:IManagedAnimalSet the colony associated with this managed animal.- Specified by:
setColonyIdin interfaceIManagedAnimal<CavalryHorseEntity>
-
getAnimalIdAccessor
Gets the accessor for the animal ID of this entity.- Specified by:
getAnimalIdAccessorin interfaceIManagedAnimal<CavalryHorseEntity>- Returns:
- the accessor for the animal ID
-
getManagedAnimalId
public int getManagedAnimalId()Get the managed animal ID of this entity.- Specified by:
getManagedAnimalIdin interfaceIManagedAnimal<CavalryHorseEntity>- Returns:
- the managed animal ID
-
setManagedAnimalId
public void setManagedAnimalId(int managedAnimalId) Set the managed animal ID of this entity. This method is also called whenever the entity is registered to a new colony.- Specified by:
setManagedAnimalIdin interfaceIManagedAnimal<CavalryHorseEntity>- Parameters:
managedAnimalId- the managed animal ID to set
-
hasCavalryRider
public boolean hasCavalryRider()Check if the horse has a valid cavalry rider. The rider must be an instance of EntityCitizen and have a valid job handler. The job handler must also be an instance of JobCavalry.- Returns:
- true if the horse has a valid cavalry rider, false otherwise.
-
hasTrainer
public boolean hasTrainer()Checks if the horse has a trainer entity (i.e. an entity which is leashing the horse) and if that entity is a citizen. This is used to determine if the horse should be slim (using the vanilla width/height) or can be wide (using the custom width/height).- Returns:
- true if the horse has a trainer citizen, false otherwise.
-
addPassenger
protected void addPassenger(@Nonnull net.minecraft.world.entity.Entity passenger) Adds a passenger to the horse, dropping the leash and clearing the recent dismount cooldown.- Overrides:
addPassengerin classnet.minecraft.world.entity.Entity- Parameters:
passenger- the passenger to add
-
removePassenger
protected void removePassenger(@Nonnull net.minecraft.world.entity.Entity passenger) Called when a passenger is removed from this horse.- Overrides:
removePassengerin classnet.minecraft.world.entity.Entity- Parameters:
passenger- the passenger being removed
-
setLeashedTo
public void setLeashedTo(@Nonnull net.minecraft.world.entity.Entity entity, boolean sendPacket) Sets the entity that this horse is leashed to.- Specified by:
setLeashedToin interfacenet.minecraft.world.entity.Leashable- Parameters:
entity- the entity to leash tosendPacket- whether to send a packet to clients
-
dropLeash
public void dropLeash(boolean broadcastPacket, boolean dropLeadItem) Drops the leash for this horse, optionally sending a packet to clients and dropping the lead item.- Specified by:
dropLeashin interfacenet.minecraft.world.entity.Leashable- Overrides:
dropLeashin classnet.minecraft.world.entity.Mob- Parameters:
broadcastPacket- whether to send a packet to clientsdropLeadItem- whether to drop the lead item
-
getPassengerAttachmentPoint
protected net.minecraft.world.phys.Vec3 getPassengerAttachmentPoint(@Nonnull net.minecraft.world.entity.Entity passenger, @Nonnull net.minecraft.world.entity.EntityDimensions dims, float partialTick) Returns the attachment point for the given passenger entity, taking into account the entity dimensions and the partial tick. This method is overridden to lower the attachment point bySEATING_OFFSETto line up with the saddle visuals.- Overrides:
getPassengerAttachmentPointin classnet.minecraft.world.entity.animal.horse.AbstractHorse- Parameters:
passenger- the passenger entitydims- the entity dimensionspartialTick- the partial tick- Returns:
- the attachment point
-
getLastDismountTime
public long getLastDismountTime()Gets the last time this horse was dismounted from, in game ticks.- Returns:
- the last time this horse was dismounted from, in game ticks
-
canMate
public boolean canMate(@Nonnull net.minecraft.world.entity.animal.Animal other) Allow breeding even when not tamed. Keep vanilla species rules.- Overrides:
canMatein classnet.minecraft.world.entity.animal.horse.Horse
-
tick
public void tick()Called every tick to update the horse.- Overrides:
tickin classnet.minecraft.world.entity.animal.horse.AbstractHorse
-
logActiveGoals
public void logActiveGoals()Logs all active goals for this horse, including both the wrapped goal selector goals and the target selector goals. This is useful for debugging purposes. This function will only be executed every LOG_COOLDOWN_INTERVAL ticks. -
createFromVanilla
public static CavalryHorseEntity createFromVanilla(IColony colony, net.minecraft.world.level.Level level, net.minecraft.world.entity.animal.horse.AbstractHorse vanilla) Creates a new CavalryHorseEntity from a vanilla AbstractHorse, attempting to preserve as much information as possible.- Parameters:
level- the level to spawn the new entity invanilla- the vanilla horse to convert- Returns:
- the new CavalryHorseEntity, or null if the conversion failed
-
needsHealthTraining
public boolean needsHealthTraining()Checks whether this horse's mount health modifier differs from its colony's current research bonus.- Returns:
- true when the Stablemaster needs to apply or update the mount health training
-
applyHealthTraining
public boolean applyHealthTraining()Replaces this horse's mount health modifier with the bonus granted by its colony's current research. The horse retains its current health so that any newly gained capacity is restored through normal feeding.- Returns:
- true when the modifier was changed, false when no update could be applied or was necessary
-
shouldBeSaved
public boolean shouldBeSaved()Whether this entity should be saved to disk.As CavalryHorse entities are always saved to disk, this method always returns true.
- Specified by:
shouldBeSavedin interfacenet.minecraft.world.level.entity.EntityAccess- Overrides:
shouldBeSavedin classnet.minecraft.world.entity.Entity
-
hurt
public boolean hurt(@Nonnull net.minecraft.world.damagesource.DamageSource damageSource, float damageAmount) Applies damage to this entity. A portion of that damage is also applied to the combat cooldown counter.- Overrides:
hurtin classnet.minecraft.world.entity.animal.horse.AbstractHorse- Parameters:
damageSource- the source of the damagedamageAmount- the amount of damage to apply- Returns:
- true if the damage was applied, false otherwise
-
addAdditionalSaveData
public void addAdditionalSaveData(@Nonnull net.minecraft.nbt.CompoundTag tag) Adds additional data to the CompoundTag that is specific to this entity type. This data is saved to disk and can be read back in when the entity is loaded. The data added is as follows: - stablePos: The position of the stable block, or null if not set. - stableDim: The dimension of the stable block, or null if not set.- Overrides:
addAdditionalSaveDatain classnet.minecraft.world.entity.animal.horse.Horse
-
readAdditionalSaveData
public void readAdditionalSaveData(@Nonnull net.minecraft.nbt.CompoundTag tag) Reads additional data from the given CompoundTag that is specific to this entity type.This method is called when the entity is loaded from disk, and the data read is used to initialize the entity.
The data that is read is as follows: - TAG_COLONY_ID: The id of the colony that the entity is associated with. - TAG_MANAGED_ANIMALID: The id of the managed animal data that is associated with the entity.
If the TAG_MANAGED_ANIMALID is not present, then a new managed animal data is created and associated with the entity. Other persisted data is managed through the associated IAnimalData.
- Overrides:
readAdditionalSaveDatain classnet.minecraft.world.entity.animal.horse.Horse
-
prepareForCombat
public void prepareForCombat(float combatReadiness) Prepares the horse for combat by reducing its combat cooldown by the specified amount of combat readiness. This amount is subtracted from the horse's current combat cooldown.- Parameters:
combatReadiness- the amount of combat readiness to subtract from the horse's combat cooldown.
-
isReadyForCombat
public boolean isReadyForCombat()Returns whether the horse is ready for combat. This is calculated by seeing if the combat cooldown is less than or equal to the readiness threshold relative to the maximum health of the horse.- Returns:
- true if the horse is ready for combat, false otherwise.
-
getCombatCooldown
public float getCombatCooldown()Returns the current combat cooldown of the horse. This is the amount of time until the horse is ready for combat. A higher value means the horse is currently less ready for combat.- Returns:
- the current combat cooldown of the horse
-
isHorizontalCollisionMinor
protected boolean isHorizontalCollisionMinor(@Nonnull net.minecraft.world.phys.Vec3 vec3) A minor horizontal collision is one that occurs when the horse has moved into a solid block. This is different from a major collision, which is when the horse has moved into another entity. This method is overridden to set the lastHorizontalCollision field to the current game time when a minor collision occurs.- Overrides:
isHorizontalCollisionMinorin classnet.minecraft.world.entity.Entity- Parameters:
vec3- the movement vector of the horse- Returns:
- true if the horse moved into a solid block, false otherwise
-
hadHorizontalCollission
public boolean hadHorizontalCollission()Whether the horse collided in the last 10 ticks- Returns:
-
reserve
public void reserve(@NotNull @NotNull net.minecraft.world.entity.Entity reserver) Reserves the horse for the given entity. When the horse is reserved, it will not be able to be mounted or interacted with by other entities until the reservation is cleared.- Parameters:
reserver- the entity to reserve the horse for
-
clearReservation
public void clearReservation()Clears the reservation on the horse. When the reservation is cleared, the horse can once again be mounted and interacted with by other entities. -
clearFor
public boolean clearFor(@NotNull @NotNull net.minecraft.world.entity.Entity reserver) Clears the reservation on the horse if it is reserved by the entity with the given UUID.- Parameters:
reserver- the entity to check against- Returns:
- true if the reservation was cleared, false otherwise
-
reservedBy
Returns the UUID of the entity that has reserved this horse, or null if it is not reserved.- Returns:
- the UUID of the entity that has reserved this horse, or null if it is not reserved.
-
hasReservation
public boolean hasReservation()Checks if the horse has a reservation by another entity. If the horse has a reservation, it will not be available as a cavalry mountn to other entities until the reservation is cleared.- Returns:
- true if the horse has a reservation, false otherwise
-
getStableBuilding
Returns the stable building of the horse if it exists. If the horse does not have a stable block position, or if the block position is not a stable building, this method returns null.- Returns:
- the stable building of the horse, or null if the horse does not have one.
-
isInStable
public boolean isInStable()Checks if the horse is currently within the boundaries of its stable building.If the horse does not have a stable, returns false.
If the horse is currently within the boundaries of its stable building, returns true. Otherwise, returns false.
- Returns:
- true if the horse is within its stable building, false otherwise
-
getAnimalData
Returns the animal data associated with this horse.- Specified by:
getAnimalDatain interfaceIManagedAnimal<CavalryHorseEntity>- Returns:
- the animal data associated with this horse.
-
getAnimalDataView
Returns the animal data view associated with this horse.- Specified by:
getAnimalDataViewin interfaceIManagedAnimal<CavalryHorseEntity>- Returns:
- the animal data view associated with this horse.
-
setAnimalData
Sets the animal data associated with this horse.- Specified by:
setAnimalDatain interfaceIManagedAnimal<CavalryHorseEntity>- Parameters:
data- The animal data associated with this horse.
-
getEntity
Returns the entity itself. This is used in the IManagedAnimal interface to get the entity associated with the managed animal.This method is used to get the entity associated with the managed animal, which in this case is the horse entity.
- Specified by:
getEntityin interfaceIManagedAnimal<CavalryHorseEntity>- Returns:
- the horse entity associated with the managed animal.
-