Class CavalryHorseEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.entity.Entity>
net.minecraft.world.entity.Entity
net.minecraft.world.entity.LivingEntity
net.minecraft.world.entity.Mob
net.minecraft.world.entity.PathfinderMob
net.minecraft.world.entity.AgeableMob
net.minecraft.world.entity.animal.Animal
net.minecraft.world.entity.animal.horse.AbstractHorse
net.minecraft.world.entity.animal.horse.Horse
com.minecolonies.core.entity.other.cavalry.CavalryHorseEntity
All Implemented Interfaces:
IManagedAnimal<CavalryHorseEntity>, ICitizenJobMount, net.minecraft.commands.CommandSource, net.minecraft.world.ContainerListener, net.minecraft.world.entity.Attackable, net.minecraft.world.entity.HasCustomInventoryScreen, 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.minecraftforge.common.capabilities.ICapabilityProvider, net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.entity.Entity>, net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>, net.minecraftforge.common.extensions.IForgeEntity, net.minecraftforge.common.extensions.IForgeLivingEntity, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class CavalryHorseEntity extends net.minecraft.world.entity.animal.horse.Horse implements IManagedAnimal<CavalryHorseEntity>, ICitizenJobMount
Cavalry Horse Entity class for Minecolonies. Extends the vanilla Horse entity with custom behavior for cavalry units.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.entity.animal.horse.Horse

    net.minecraft.world.entity.animal.horse.Horse.HorseGroupData

    Nested classes/interfaces inherited from class net.minecraft.world.entity.AgeableMob

    net.minecraft.world.entity.AgeableMob.AgeableMobGroupData

    Nested classes/interfaces inherited from class net.minecraft.world.entity.LivingEntity

    net.minecraft.world.entity.LivingEntity.Fallsounds

    Nested 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.RemovalReason

    Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
     
    static final float
     
    static final net.minecraft.network.syncher.EntityDataAccessor<Integer>
     
    static final net.minecraft.network.syncher.EntityDataAccessor<Integer>
     
    static final int
    The cooldown for logging when debugging.
    static final float
    The 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_ARMOR, INV_SLOT_SADDLE, inventory, INVENTORY_SLOT_OFFSET, isJumping, playerJumpPendingScale, sprintCounter, tailCounter, temper

    Fields inherited from class net.minecraft.world.entity.animal.Animal

    PARENT_AGE_AFTER_BREEDING

    Fields inherited from class net.minecraft.world.entity.AgeableMob

    age, BABY_START_AGE, forcedAge, forcedAgeTimer

    Fields inherited from class net.minecraft.world.entity.PathfinderMob

    DEFAULT_WALK_TARGET_VALUE

    Fields inherited from class net.minecraft.world.entity.Mob

    ambientSoundTime, armorDropChances, DEFAULT_EQUIPMENT_DROP_CHANCE, goalSelector, handDropChances, jumpControl, LEASH_TAG, 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, targetSelector, UPDATE_GOAL_SELECTOR_EVERY_N_TICKS, xpReward

    Fields inherited from class net.minecraft.world.entity.LivingEntity

    animStep, animStepO, ARMOR_SLOT_OFFSET, ARMOR_SLOTS, attackAnim, attackStrengthTicker, autoSpinAttackTicks, brain, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathScore, deathTime, DEFAULT_BASE_GRAVITY, DEFAULT_EYE_HEIGHT, EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT, fallFlyTicks, HAND_SLOTS, hurtDuration, hurtTime, invulnerableDuration, jumping, lastHurt, lastHurtByPlayer, lastHurtByPlayerTime, lerpHeadSteps, lerpSteps, lerpX, lerpXRot, lerpY, lerpYRot, lerpZ, LIVING_ENTITY_FLAG_IS_USING, LIVING_ENTITY_FLAG_OFF_HAND, LIVING_ENTITY_FLAG_SPIN_ATTACK, lyHeadRot, 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, zza

    Fields inherited from class net.minecraft.world.entity.Entity

    BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, BREATHING_DISTANCE_BELOW_EYES, 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, eyeHeight, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, ID_TAG, invulnerableTime, isInPowderSnow, isInsidePortal, level, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, minorHorizontalCollision, moveDist, noCulling, noPhysics, PASSENGERS_TAG, portalEntrancePos, portalTime, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, vehicle, verticalCollision, verticalCollisionBelow, walkDist, walkDistO, wasEyeInWater, wasInPowderSnow, wasOnFire, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOld

    Fields inherited from interface net.minecraft.commands.CommandSource

    NULL
  • Constructor Summary

    Constructors
    Constructor
    Description
    CavalryHorseEntity(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 Type
    Method
    Description
    void
    addAdditionalSaveData(net.minecraft.nbt.CompoundTag tag)
    Adds additional data to the CompoundTag that is specific to this entity type.
    protected void
    addPassenger(net.minecraft.world.entity.Entity passenger)
    Adds a passenger to the horse, dropping the leash and clearing the recent dismount cooldown.
    void
    This method is called by the entity every tick to update its state.
    boolean
    Replaces this horse's mount health modifier with the bonus granted by its colony's current research.
    boolean
    canMate(net.minecraft.world.entity.animal.Animal other)
    Allow breeding even when not tamed.
    boolean
    clearFor(@NotNull net.minecraft.world.entity.Entity reserver)
    Clears the reservation on the horse if it is reserved by the entity with the given UUID.
    void
    Clears the reservation on the horse.
    void
    Applies mount-specific settings to the pathing options copied from the mount's navigator.
    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.
    protected net.minecraft.world.entity.ai.navigation.PathNavigation
    createNavigation(net.minecraft.world.level.Level level)
    Creates a new PathNavigation for this horse entity, overriding the default vanilla horse navigation.
    protected void
    Defines the synced data for this entity.
    void
    dropLeash(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.
    int
    Get the colony associated with this managed animal.
    net.minecraft.network.syncher.EntityDataAccessor<Integer>
    Gets the accessor for the colony ID of this entity.
    float
    Returns the current combat cooldown of the horse.
    Returns the entity itself.
    long
    Gets the last time this horse was dismounted from, in game ticks.
    int
    Get the managed animal ID of this entity.
    double
    Gets the offset that passengers are riding at relative to the horse's y position.
    Returns the stable building of the horse if it exists.
    protected float
    getStandingEyeHeight(net.minecraft.world.entity.Pose pose, net.minecraft.world.entity.EntityDimensions dims)
    Adjusts the standing eye height based on the pose and dimensions given.
    boolean
    Whether the mount recently collided horizontally while following its rider's path.
    boolean
    Whether the horse collided in the last 10 ticks
    boolean
    Check if the horse has a valid cavalry rider.
    boolean
    Returns true if the horse is reserved by any entity, false otherwise.
    boolean
    Checks if the horse has a trainer entity (i.e.
    boolean
    hurt(net.minecraft.world.damagesource.DamageSource damageSource, float damageAmount)
    Applies damage to this entity.
    protected boolean
    isHorizontalCollisionMinor(net.minecraft.world.phys.Vec3 vec3)
    A minor horizontal collision is one that occurs when the horse has moved into a solid block.
    boolean
    Checks if the horse is currently within the boundaries of its stable building.
    boolean
    Returns whether the horse is ready for combat.
    void
    Logs all active goals for this horse, including both the wrapped goal selector goals and the target selector goals.
    boolean
    Checks whether this horse's mount health modifier differs from its colony's current research bonus.
    void
    onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> dataAccessor)
    Called when the entity's data is updated from the server.
    void
    prepareForCombat(float combatReadiness)
    Prepares the horse for combat by reducing its combat cooldown by the specified amount of combat readiness.
    void
    readAdditionalSaveData(net.minecraft.nbt.CompoundTag tag)
    Reads additional data from the given CompoundTag that is specific to this entity type.
    void
    Registers the goals for this entity.
    protected void
    removePassenger(net.minecraft.world.entity.Entity passenger)
    Called when a passenger is removed from this horse.
    void
    reserve(@NotNull net.minecraft.world.entity.Entity reserver)
    Reserves the horse for the given entity.
    @Nullable UUID
    Retrieves the UUID of the entity that has reserved the horse, or null if no one has reserved it.
    void
    Sets the animal data associated with this horse.
    void
    setColonyId(int colonyId)
    Set the colony associated with this managed animal.
    void
    setLeashedTo(net.minecraft.world.entity.Entity entity, boolean sendPacket)
    Sets the entity that this horse is leashed to.
    void
    setManagedAnimalId(int managedAnimalId)
    Set the unique ID of this managed animal.
    boolean
    Whether this entity should be saved to disk.
    void
    Called every tick to update the horse.

    Methods inherited from class net.minecraft.world.entity.animal.horse.Horse

    canWearArmor, containerChanged, finalizeSpawn, getAmbientSound, getAngrySound, getArmor, getBreedOffspring, getDeathSound, getEatingSound, getHurtSound, getMarkings, getVariant, isArmor, mobInteract, playGallopSound, randomizeAttributes, setVariant, updateContainerEquipment

    Methods inherited from class net.minecraft.world.entity.animal.horse.AbstractHorse

    addBehaviourGoals, calculateFallDamage, canEatGrass, canJump, canParent, canPerformRearing, causeFallDamage, createBaseHorseAttributes, createInventory, doPlayerRide, dropEquipment, equipArmor, equipSaddle, executeRidersJump, fedFood, followMommy, generateJumpStrength, generateMaxHealth, generateSpeed, getAmbientSoundInterval, getAmbientStandInterval, getAmbientStandSound, getCapability, getControllingPassenger, getCustomJump, getDismountLocationForPassenger, getEatAnim, getFlag, getInventorySize, getMaxSpawnClusterSize, getMaxTemper, getMouthAnim, getOwnerUUID, getRiddenInput, getRiddenRotation, getRiddenSpeed, getSlot, getSoundVolume, getStandAnim, getTemper, handleEating, handleEntityEvent, handleStartJump, handleStopJump, hasInventoryChanged, invalidateCaps, isBred, isEating, isFood, isImmobile, isJumping, isPushable, isSaddleable, isSaddled, isStanding, isTamed, isWearingArmor, makeMad, modifyTemper, onClimbable, onLeashDistance, onPlayerJump, openCustomInventoryScreen, playJumpSound, playStepSound, positionRider, setBred, setEating, setFlag, setIsJumping, setOffspringAttributes, setOwnerUUID, setStanding, setTamed, setTemper, spawnTamingParticles, standIfPossible, tameWithName, tickRidden

    Methods inherited from class net.minecraft.world.entity.animal.Animal

    canFallInLove, checkAnimalSpawnRules, customServerAiStep, finalizeSpawnChildFromBreeding, getExperienceReward, getInLoveTime, getLoveCause, getMyRidingOffset, getWalkTargetValue, isBrightEnoughToSpawn, isInLove, removeWhenFarAway, resetLove, setInLove, setInLoveTime, spawnChildFromBreeding, usePlayerItem

    Methods inherited from class net.minecraft.world.entity.AgeableMob

    ageBoundaryReached, ageUp, ageUp, canBreed, getAge, getSpeedUpSecondsWhenFeeding, isBaby, setAge, setBaby

    Methods inherited from class net.minecraft.world.entity.PathfinderMob

    checkSpawnRules, followLeashSpeed, getWalkTargetValue, isPathFinding, shouldStayCloseToLeashHolder, tickLeash

    Methods inherited from class net.minecraft.world.entity.Mob

    ate, baseTick, canAttackType, canBeLeashed, canFireProjectileWeapon, canHoldItem, canPickUpLoot, canReplaceCurrentItem, canReplaceEqualItem, canTakeItem, checkAndHandleImportantInteractions, checkDespawn, checkMobSpawnRules, checkSpawnObstruction, clearRestriction, convertTo, createBodyControl, createMobAttributes, doHurtTarget, dropCustomDeathLoot, dropFromLootTable, enchantSpawnedArmor, enchantSpawnedWeapon, equipItemIfPossible, getArmorSlots, getDefaultLootTable, getEquipmentDropChance, getEquipmentForSlot, getHandSlots, getHeadRotSpeed, getItemBySlot, getJumpControl, getLeashHolder, getLookControl, getLootTable, getLootTableSeed, getMainArm, getMaxFallDistance, getMaxHeadXRot, getMaxHeadYRot, getMeleeAttackRangeSqr, getMoveControl, getNavigation, getPathfindingMalus, getPerceivedTargetDistanceSquareForMeleeAttack, getPickResult, getPickupReach, getRestrictCenter, getRestrictRadius, getSensing, getSpawnType, getTarget, hasRestriction, interact, isAggressive, isEffectiveAi, isLeashed, isLeftHanded, isMaxGroupSizeReached, isNoAi, isPersistenceRequired, isSpawnCancelled, isSunBurnTick, isWithinMeleeAttackRange, isWithinRestriction, isWithinRestriction, jumpInFluid, jumpInLiquid, lookAt, onOffspringSpawnedFromEgg, onPathfindingDone, onPathfindingStart, pickUpItem, playAmbientSound, playHurtSound, populateDefaultEquipmentEnchantments, populateDefaultEquipmentSlots, removeAfterChangingDimensions, removeAllGoals, removeFreeWill, requiresCustomPersistence, restrictTo, sendDebugPackets, serverAiStep, setAggressive, setCanPickUpLoot, setDelayedLeashHolderId, setDropChance, setGuaranteedDrop, setItemSlot, setItemSlotAndDropWhenKilled, setLeftHanded, setNoAi, setPathfindingMalus, setPersistenceRequired, setSpawnCancelled, setSpeed, setTarget, setXxa, setYya, setZza, shouldDespawnInPeaceful, shouldPassengersInheritMalus, spawnAnim, startRiding, tickHeadTurn, updateControlFlags, wantsToPickUp

    Methods inherited from class net.minecraft.world.entity.LivingEntity

    actuallyHurt, addEffect, addEffect, animateHurt, areAllEffectsAmbient, attackable, blockedByShield, blockUsingShield, brainProvider, broadcastBreakEvent, broadcastBreakEvent, calculateEntityAnimation, canAttack, canAttack, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canChangeDimensions, canDisableShield, canFreeze, canSpawnSoulSpeedParticle, canStandOnFluid, checkAutoSpinAttack, checkBedExists, checkFallDamage, clearSleepingPos, completeUsingItem, createLivingAttributes, createWitherRose, curePotionEffects, decreaseAirSupply, detectEquipmentUpdates, die, doAutoAttackOnTouch, doesEmitEquipEvent, doPush, dropAllDeathLoot, dropExperience, eat, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, getAttribute, getAttributeBaseValue, getAttributeBaseValue, getAttributes, getAttributeValue, getAttributeValue, getBedOrientation, getBlockSpeedFactor, getBoundingBoxForCulling, getBrain, getCombatTracker, getDamageAfterArmorAbsorb, getDamageAfterMagicAbsorb, getDimensions, getDismountPoses, getDrinkingSound, getEatingSound, getEffect, getEquipmentSlotForItem, getEyeHeight, getFallFlyingTicks, getFallSounds, getFluidFallingAdjustedMovement, getFlyingSpeed, getHealth, getHurtDir, getItemInHand, getJumpBoostPower, getJumpPower, getKillCredit, getLastAttacker, getLastClimbablePos, getLastDamageSource, getLastHurtByMob, getLastHurtByMobTimestamp, getLastHurtMob, getLastHurtMobTimestamp, getLocalBoundsForPose, getMainHandItem, getMaxHealth, getMeleeAttackReferencePosition, getMobType, getNoActionTime, getOffhandItem, getProjectile, getRandom, getRelativePortalPosition, getScale, getSleepingPos, getSpeed, getStingerCount, getSwimAmount, getTicksUsingItem, getUsedItemHand, getUseItem, getUseItemRemainingTicks, getViewYRot, getVisibilityPercent, getVisualRotationYInDegrees, getVoicePitch, getWaterSlowDown, getYHeadRot, goDownInWater, handleDamageEvent, handleRelativeFrictionAndCalculateMovement, hasEffect, hasItemInSlot, hasLineOfSight, heal, hurtArmor, hurtCurrentlyUsedShield, hurtHelmet, increaseAirSupply, indicateDamage, isAffectedByFluids, isAffectedByPotions, isAlive, isAlwaysExperienceDropper, isAutoSpinAttack, isBlocking, isCurrentlyGlowing, isDamageSourceBlocked, isDeadOrDying, isFallFlying, isHolding, isHolding, isInvertedHealAndHarm, isInWall, isPickable, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadTo, lerpTo, lookAt, makeBrain, maxUpStep, onBelowWorld, onChangedBlock, onEffectAdded, onEffectRemoved, onEffectUpdated, onEnterCombat, onEquipItem, onItemPickup, onLeaveCombat, onSoulSpeedBlock, playBlockFallSound, push, pushEntities, randomTeleport, recreateFromPacket, releaseUsingItem, remove, removeAllEffects, removeEffect, removeEffectNoUpdate, removeEffectParticles, removeFrost, removeSoulSpeed, resetForwardDirectionOfRelativePortalPosition, reviveCaps, rideTick, sendEffectToPassengers, setAbsorptionAmount, setArrowCount, setDiscardFriction, setHealth, setItemInHand, setJumping, setLastHurtByMob, setLastHurtByPlayer, setLastHurtMob, setLivingEntityFlag, setNoActionTime, setRecordPlayingNearby, setSleepingPos, setSprinting, setStingerCount, setYBodyRot, setYHeadRot, shouldDiscardFriction, shouldDropExperience, shouldDropLoot, shouldRemoveSoulSpeed, shouldRiderFaceForward, shouldShowName, skipDropExperience, spawnSoulSpeedParticle, startSleeping, startUsingItem, stopRiding, stopSleeping, stopUsingItem, swing, swing, take, tickDeath, tickEffects, travel, triggerItemUseEffects, tryAddFrost, tryAddSoulSpeed, updateEffectVisibility, updateFallFlying, updateInvisibilityStatus, updateSwimAmount, updateSwingTime, updateUsingItem, updateWalkAnimation, verifyEquippedItem, wasExperienceConsumed

    Methods inherited from class net.minecraft.world.entity.Entity

    absMoveTo, absMoveTo, acceptsFailure, acceptsSuccess, addDeltaMovement, addTag, awardKillScore, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canCollideWith, canEnterPose, canRide, canSpawnSprintParticle, canSprint, canTrample, canUpdate, canUpdate, captureDrops, captureDrops, changeDimension, changeDimension, checkBelowWorld, checkInsideBlocks, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, collide, collideBoundingBox, copyPosition, couldAcceptPassenger, createCommandSourceStack, createHoverEvent, damageSources, dampensVibrations, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doEnchantDamageEffects, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, findDimensionEntryPoint, fireImmune, fixupDimensions, gameEvent, gameEvent, getAddEntityPacket, getAirSupply, getAllSlots, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getBoundingBoxForPose, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControlledVehicle, getCustomName, getDeltaMovement, getDimensionChangingDelay, getDirection, getDisplayName, getEncodeId, getEntityData, getExitPortal, getEyeHeight, getEyeHeight, getEyeHeightAccess, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFeetBlockState, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getHandHoldingItemAngle, getId, getIndirectPassengers, getLeashOffset, getLeashOffset, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxHeightFluidType, getMotionDirection, getMovementEmission, getName, getNameTagOffsetY, getOnPos, getOnPos, getOnPosLegacy, getPassengers, getPassengersAndSelf, getPercentFrozen, getPermissionLevel, getPersistentData, getPickRadius, getPistonPushReaction, getPortalCooldown, getPortalWaitTime, getPose, getPosition, getPositionCodec, getPrimaryStepSoundBlockPos, 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, getViewScale, getViewVector, getViewXRot, getX, getX, getXRot, getY, getY, getYRot, getZ, getZ, handleInsidePortal, handleNetherPortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPermissions, hasPose, ignoreExplosion, interactAt, is, isAddedToWorld, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, 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, level, limitPistonMovement, load, makeBoundingBox, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mayInteract, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onAddedToWorld, onClientRemoval, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, onRemovedFromWorld, onSyncedDataUpdated, pick, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playSwimSound, position, positionRider, processFlappingMovement, processPortalCooldown, push, reapplyPosition, refreshDimensions, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, rotate, save, saveAsPassenger, saveWithoutId, sendSystemMessage, setAirSupply, setBoundingBox, setCustomName, setCustomNameVisible, setDeltaMovement, setDeltaMovement, setFluidTypeHeight, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setLevel, setLevelCallback, setMaxUpStep, setNoGravity, setOldPosAndRot, setOnGround, setOnGroundWithKnownMovement, setPortalCooldown, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, setSecondsOnFire, 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, teleportToWithTicket, thunderHit, toString, touchingUnloadedChunk, trackingPosition, tryCheckInsideBlocks, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateFluidOnEyes, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSound

    Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, serializeCaps

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.commands.CommandSource

    alwaysAccepts

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeEntity

    canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canTrample, canUpdate, canUpdate, captureDrops, captureDrops, deserializeNBT, getClassification, getEyeInFluidType, getFluidFallDistanceModifier, getFluidMotionScale, getFluidTypeHeight, getMaxHeightFluidType, getParts, getPersistentData, getPickedResult, getSoundFromFluidType, getStepHeight, hasCustomOutlineRendering, isAddedToWorld, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, onAddedToWorld, onRemovedFromWorld, revive, serializeNBT, shouldRiderSit

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeLivingEntity

    canDrownInFluidType, canSwimInFluidType, moveInFluid, self, sinkInFluid

    Methods inherited from interface com.minecolonies.api.colony.managers.interfaces.IManagedAnimal

    getOffsetTicks

    Methods inherited from interface net.minecraft.world.entity.OwnableEntity

    getOwner, level

    Methods inherited from interface net.minecraft.world.entity.PlayerRideableJumping

    getJumpCooldown

    Methods inherited from interface net.minecraft.world.entity.Saddleable

    getSaddleSoundEvent
  • Field Details

    • DATA_COLONY_ID

      public static final net.minecraft.network.syncher.EntityDataAccessor<Integer> 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_W
      The 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_INTERVAL
      The 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 type
      level - The level the entity is in
  • Method Details

    • configureMountedPathing

      public void configureMountedPathing(PathingOptions options)
      Description copied from interface: ICitizenJobMount
      Applies mount-specific settings to the pathing options copied from the mount's navigator.
      Specified by:
      configureMountedPathing in interface ICitizenJobMount
      Parameters:
      options - the pathing options for the mounted path job
    • hadHorizontalCollision

      public boolean hadHorizontalCollision()
      Description copied from interface: ICitizenJobMount
      Whether the mount recently collided horizontally while following its rider's path.
      Specified by:
      hadHorizontalCollision in interface ICitizenJobMount
      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:
      registerGoals in class net.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.
      Overrides:
      onSyncedDataUpdated in class net.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:
      aiStep in class net.minecraft.world.entity.animal.horse.AbstractHorse
    • defineSynchedData

      protected void defineSynchedData()
      Defines the synced data for this entity.
      Overrides:
      defineSynchedData in class net.minecraft.world.entity.animal.horse.Horse
    • getColonyIdAccessor

      public net.minecraft.network.syncher.EntityDataAccessor<Integer> getColonyIdAccessor()
      Gets the accessor for the colony ID of this entity.
      Specified by:
      getColonyIdAccessor in interface IManagedAnimal<CavalryHorseEntity>
      Returns:
      the accessor for the colony ID
    • getColonyId

      public int getColonyId()
      Description copied from interface: IManagedAnimal
      Get the colony associated with this managed animal.
      Specified by:
      getColonyId in interface IManagedAnimal<CavalryHorseEntity>
    • setColonyId

      public void setColonyId(int colonyId)
      Description copied from interface: IManagedAnimal
      Set the colony associated with this managed animal.
      Specified by:
      setColonyId in interface IManagedAnimal<CavalryHorseEntity>
    • getAnimalIdAccessor

      public net.minecraft.network.syncher.EntityDataAccessor<Integer> getAnimalIdAccessor()
      Gets the accessor for the animal ID of this entity.
      Specified by:
      getAnimalIdAccessor in interface IManagedAnimal<CavalryHorseEntity>
      Returns:
      the accessor for the animal ID
    • getManagedAnimalId

      public int getManagedAnimalId()
      Get the managed animal ID of this entity.
      Specified by:
      getManagedAnimalId in interface IManagedAnimal<CavalryHorseEntity>
      Returns:
      the managed animal ID
    • setManagedAnimalId

      public void setManagedAnimalId(int managedAnimalId)
      Description copied from interface: IManagedAnimal
      Set the unique ID of this managed animal.
      Specified by:
      setManagedAnimalId in interface IManagedAnimal<CavalryHorseEntity>
    • 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.
    • getStandingEyeHeight

      protected float getStandingEyeHeight(@Nonnull net.minecraft.world.entity.Pose pose, @Nonnull net.minecraft.world.entity.EntityDimensions dims)
      Adjusts the standing eye height based on the pose and dimensions given. For cavalry horses, this height is the same as the standard horse height, since the width change doesn’t affect the eye height.
      Overrides:
      getStandingEyeHeight in class net.minecraft.world.entity.animal.horse.AbstractHorse
      Parameters:
      pose - the pose of the horse
      dims - the dimensions of the horse
      Returns:
      the adjusted eye height
    • 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:
      addPassenger in class net.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:
      removePassenger in class net.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.
      Overrides:
      setLeashedTo in class net.minecraft.world.entity.Mob
      Parameters:
      entity - the entity to leash to
      sendPacket - 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.
      Overrides:
      dropLeash in class net.minecraft.world.entity.Mob
      Parameters:
      broadcastPacket - whether to send a packet to clients
      dropLeadItem - whether to drop the lead item
    • getPassengersRidingOffset

      public double getPassengersRidingOffset()
      Gets the offset that passengers are riding at relative to the horse's y position. In this case, we lower the seat by 0.35 units to make the rider's feet line up with the saddle. This is important for the cavalry horse model.
      Overrides:
      getPassengersRidingOffset in class net.minecraft.world.entity.Entity
      Returns:
      the double value of the y offset
    • 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
    • createNavigation

      protected net.minecraft.world.entity.ai.navigation.PathNavigation createNavigation(@Nonnull net.minecraft.world.level.Level level)
      Creates a new PathNavigation for this horse entity, overriding the default vanilla horse navigation. This allows the horse to navigate the world in a way that is more suitable for guards.
      Overrides:
      createNavigation in class net.minecraft.world.entity.Mob
      Parameters:
      level - the level to spawn the new entity in
      Returns:
      the new PathNavigation for this horse entity
    • canMate

      public boolean canMate(@Nonnull net.minecraft.world.entity.animal.Animal other)
      Allow breeding even when not tamed. Keep vanilla species rules.
      Overrides:
      canMate in class net.minecraft.world.entity.animal.horse.Horse
    • tick

      public void tick()
      Called every tick to update the horse.
      Overrides:
      tick in class net.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 in
      vanilla - 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:
      shouldBeSaved in interface net.minecraft.world.level.entity.EntityAccess
      Overrides:
      shouldBeSaved in class net.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:
      hurt in class net.minecraft.world.entity.animal.horse.AbstractHorse
      Parameters:
      damageSource - the source of the damage
      damageAmount - 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:
      addAdditionalSaveData in class net.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:
      readAdditionalSaveData in class net.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:
      isHorizontalCollisionMinor in class net.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

      @Nullable public @Nullable UUID reservedBy()
      Retrieves the UUID of the entity that has reserved the horse, or null if no one has reserved it.
      Parameters:
      horse - the horse to query
      Returns:
      the UUID of the reserver, or null if no one has reserved it
    • hasReservation

      public boolean hasReservation()
      Returns true if the horse is reserved by any entity, false otherwise.
      Parameters:
      horse - the horse to check
      Returns:
      true if the horse is reserved, false otherwise
    • getStableBuilding

      public IBuilding 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

      public IAnimalData getAnimalData()
      Returns the animal data associated with this horse.
      Specified by:
      getAnimalData in interface IManagedAnimal<CavalryHorseEntity>
      Returns:
      the animal data associated with this horse.
    • getAnimalDataView

      public IAnimalDataView getAnimalDataView()
      Returns the animal data view associated with this horse.
      Specified by:
      getAnimalDataView in interface IManagedAnimal<CavalryHorseEntity>
      Returns:
      the animal data view associated with this horse.
    • setAnimalData

      public void setAnimalData(IAnimalData data)
      Sets the animal data associated with this horse.
      Specified by:
      setAnimalData in interface IManagedAnimal<CavalryHorseEntity>
      Parameters:
      data - The animal data associated with this horse.
    • getEntity

      public CavalryHorseEntity 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:
      getEntity in interface IManagedAnimal<CavalryHorseEntity>
      Returns:
      the horse entity associated with the managed animal.