Class NPCTrainer

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
com.pixelmonmod.pixelmon.entities.npcs.NPCEntity
com.pixelmonmod.pixelmon.entities.npcs.NPCTrainer
All Implemented Interfaces:
net.minecraft.commands.CommandSource, net.minecraft.world.entity.Attackable, net.minecraft.world.entity.npc.Npc, net.minecraft.world.entity.Targeting, 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 NPCTrainer extends NPCEntity
An NPC Trainer who can be battled.
  • Nested Class Summary

    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
    The battle the Trainer is in.
     
    boolean
    Whether players can engage this NPC or not.
    Commands to execute when the Player forfeits.
    The Trainer's messages at the start and end of battle.
    boolean
    Whether the Trainer is a gym leader.
    Commands to execute when the NPC Trainer loses.
    The Trainer's messages at the start and end of battle.
    The players battled by the NPC Trainer and when they were last battled.
    int
    The base pokemonLevel of the Trainer's Pokémon.
    Commands to execute when the Player begins a battle with an NPC.
    boolean
    Whether to use randomly generated fields for the Trainer's messages.
    boolean
    Whether to use randomly generated fields for the Trainer's messages.
    boolean
    Whether to use randomly generated fields for the Trainer's messages.
    boolean
    Whether to use randomly generated fields for the Trainer's messages.
    Commands to execute when the NPC Trainer wins.
    The Trainer's messages at the start and end of battle.
    int
    The base amount of money won upon defeating the Trainer.

    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_HEALTH_ID, DATA_LIVING_ENTITY_FLAGS, dead, DEATH_DURATION, deathScore, deathTime, DEFAULT_BASE_GRAVITY, DEFAULT_EYE_HEIGHT, EQUIPMENT_SLOT_OFFSET, 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, noJumpDelay, 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, onGround, PASSENGERS_TAG, portalEntrancePos, portalTime, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, verticalCollision, verticalCollisionBelow, walkDist, walkDistO, wasEyeInWater, wasInPowderSnow, wasOnFire, wasTouchingWater, xo, xOld, xRot, xRotO, yo, yOld, yRot, yRotO, zo, zOld

    Fields inherited from interface net.minecraft.commands.CommandSource

    NULL
  • Constructor Summary

    Constructors
    Constructor
    Description
    NPCTrainer(net.minecraft.world.entity.EntityType<NPCTrainer> type, net.minecraft.world.level.Level par1World)
    Sets up the Trainer and its data watcher attributes.
    NPCTrainer(net.minecraft.world.level.Level world)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
     
    Works out and sets which generation this Trainer is for.
    boolean
    canStartBattle(net.minecraft.world.entity.player.Player opponent, boolean printMessages)
    Checks if the NPC can start a new battle.
    net.minecraft.world.InteractionResult
    checkAndHandleImportantInteractions(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
     
    protected void
    Keeps track of when to despawn the NPC.
    void
     
    protected void
     
    Gets the Trainer's battle AI mode.
    Gets the NPC's battle controller.
    Gets the Trainer's battle type.
    Gets the boss tier of the NPC.
    getChat(String langCode)
    Gets the Trainer's translated dialogue.
    Gets the text that displays above the NPC.
    Gets the Trainer's encounter mode.
    int
    Gets the Trainer's engage distance in blocks for if they're in an engage AI mode
    net.minecraft.world.entity.Mob
    Gets the NPC entity.
    getGreeting(String langCode)
    Gets the translated Trainer's greeting.
    Gets the translated Trainer's loss message.
     
    getName(String langCode)
    Gets the translated Trainer's name.
    Gets the ID of the next available Pokémon that the NPC can send out.
     
    Gets the NPC's Pokémon party.
    Gets the subtitle for the text that displays above the NPC.
    int
    Gets the Trainer's displayed pokemonLevel.
    Gets the translated Trainer's victory message.
    int
    Gets the amount of PokeDollars given to the player if they win
    net.minecraft.world.item.ItemStack[]
    Gets the winnings from the NPC Trainer.
    void
    Heals the NPC's Pokémon.
    void
    init(BaseTrainer trainer)
    Initializes the Trainer's fields.
    void
    Initializes the NPC's AI.
    void
    Initializes the NPC's AI to stand still.
    boolean
    interactWithNPC(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
    Handles a player interacting with the NPC.
    boolean
     
    boolean
     
    void
    Loads the Trainer's Pokémon.
    void
    Handles events when the NPC loses a battle.
    void
    onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> key)
     
    void
    push(double par1, double par3, double par5)
     
    void
    randomisePokemon(net.minecraft.world.entity.player.Player player)
    Generates a new party for the Trainer.
    void
    readAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
     
    releasePokemon(UUID newPokemonUUID)
    Sends out one of the NPC's Pokémon.
    void
    Restores the trainer's pokemon friendship pokemonLevel to full (for benefit of moves requiring high levels of friendship)
    void
    setAttackTargetPix(net.minecraft.world.entity.LivingEntity entity)
    Sets an entity for the NPC to target.
    void
    Sets the Trainer's battle AI mode.
    void
    Sets the NPC's battle controller.
    void
    Sets the boss tier for the Trainer.
    void
    Sets the Trainer's encounter mode.
    void
    setEngageDistance(int engageDistance)
    Sets the Trainer's engage distance in blocks for if they're in an engage AI mode
    void
     
    void
     
    void
    setPokemonLevel(int pokemonLevel)
     
    void
    Sets the rotation of the Trainer.
    void
    setTrainerType(BaseTrainer model, net.minecraft.world.entity.player.Player player)
    Sets the Trainer's model.
    void
    startBattle(BattleParticipant battleParticipant)
    Starts a battle with the NPC.
    void
     
    void
     
    void
    Updates the Trainer's data.
    void
    updateDrops(net.minecraft.world.item.ItemStack[] drops)
    Updates the winnings from the NPC Trainer.
    void
    Updates the Trainer's pokemonLevel based on average pokemonLevel of his/her party Pokémon.
    void
    Handles events when the NPC wins a battle.

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

    followLeashSpeed, getWalkTargetValue, getWalkTargetValue, isPanicking, isPathFinding, onLeashDistance, shouldStayCloseToLeashHolder

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

    aiStep, ate, baseTick, canAttackType, canFireProjectileWeapon, canHoldItem, canPickUpLoot, canReplaceCurrentItem, canReplaceEqualItem, canTakeItem, checkDespawn, checkMobSpawnRules, checkSpawnObstruction, clearRestriction, convertTo, createBodyControl, createMobAttributes, createNavigation, doHurtTarget, dropCustomDeathLoot, dropFromLootTable, dropLeash, enchantSpawnedArmor, enchantSpawnedWeapon, equipItemIfPossible, finalizeSpawn, getAmbientSound, getAmbientSoundInterval, getArmorSlots, getAttackBoundingBox, getControllingPassenger, getDefaultLootTable, getEquipmentDropChance, getEquipmentForSlot, getExperienceReward, getHandSlots, getHeadRotSpeed, getItemBySlot, getJumpControl, getLeashHolder, getLookControl, getLootTable, getLootTableSeed, getMainArm, getMaxFallDistance, getMaxHeadXRot, getMaxHeadYRot, getMoveControl, getNavigation, getPathfindingMalus, getPickResult, getPickupReach, getRestrictCenter, getRestrictRadius, getSensing, getSpawnType, getTarget, handleEntityEvent, hasRestriction, interact, isAggressive, isEffectiveAi, isLeashed, isLeftHanded, isMaxGroupSizeReached, isNoAi, isPersistenceRequired, isSpawnCancelled, isSunBurnTick, isWithinMeleeAttackRange, isWithinRestriction, isWithinRestriction, jumpInFluid, jumpInLiquid, lookAt, mobInteract, onOffspringSpawnedFromEgg, onPathfindingDone, onPathfindingStart, playAmbientSound, playHurtSound, populateDefaultEquipmentEnchantments, populateDefaultEquipmentSlots, registerGoals, removeAfterChangingDimensions, removeAllGoals, removeFreeWill, requiresCustomPersistence, restrictTo, sendDebugPackets, serverAiStep, setAggressive, setBaby, setCanPickUpLoot, setDelayedLeashHolderId, setDropChance, setGuaranteedDrop, setItemSlot, setItemSlotAndDropWhenKilled, setLeashedTo, 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, calculateFallDamage, canAttack, canAttack, canBeAffected, canBeSeenAsEnemy, canBeSeenByAnyone, canBreatheUnderwater, canChangeDimensions, canDisableShield, canFreeze, canSpawnSoulSpeedParticle, canStandOnFluid, causeFallDamage, checkAutoSpinAttack, checkFallDamage, clearSleepingPos, completeUsingItem, createLivingAttributes, createWitherRose, curePotionEffects, decreaseAirSupply, die, doAutoAttackOnTouch, doesEmitEquipEvent, doPush, dropAllDeathLoot, dropEquipment, dropExperience, eat, equipmentHasChanged, forceAddEffect, getAbsorptionAmount, getActiveEffects, getActiveEffectsMap, getArmorCoverPercentage, getArmorValue, getArrowCount, getAttackAnim, getAttribute, getAttributeBaseValue, getAttributeBaseValue, getAttributes, getAttributeValue, getAttributeValue, getBedOrientation, getBlockSpeedFactor, getBoundingBoxForCulling, getBrain, getCapability, getCombatTracker, getDamageAfterArmorAbsorb, getDamageAfterMagicAbsorb, getDeathSound, getDimensions, getDismountPoses, getDrinkingSound, getEatingSound, getEffect, getEquipmentSlotForItem, getEyeHeight, getFallDamageSound, getFallFlyingTicks, getFallSounds, getFluidFallingAdjustedMovement, getFlyingSpeed, getHealth, getHitbox, getHurtDir, getHurtSound, getItemInHand, getJumpBoostPower, getJumpPower, getKillCredit, getLastAttacker, getLastClimbablePos, getLastDamageSource, getLastHurtByMob, getLastHurtByMobTimestamp, getLastHurtMob, getLastHurtMobTimestamp, getLocalBoundsForPose, getMainHandItem, getMaxAbsorption, getMaxHealth, getMobType, getMyRidingOffset, getNoActionTime, getOffhandItem, getPassengerRidingPosition, getProjectile, getRandom, getRelativePortalPosition, getRiddenInput, getRiddenSpeed, getScale, getSleepingPos, getSlot, getSoundVolume, getSpeed, getStandingEyeHeight, getStingerCount, getSwimAmount, getTicksUsingItem, getUsedItemHand, getUseItem, getUseItemRemainingTicks, getViewYRot, getVisibilityPercent, getVisualRotationYInDegrees, getVoicePitch, getWaterSlowDown, getYHeadRot, goDownInWater, handleDamageEvent, handleRelativeFrictionAndCalculateMovement, hasEffect, hasItemInSlot, hasLineOfSight, heal, hurtArmor, hurtCurrentlyUsedShield, hurtHelmet, increaseAirSupply, indicateDamage, internalSetAbsorptionAmount, invalidateCaps, isAffectedByFluids, isAffectedByPotions, isAlive, isAlwaysExperienceDropper, isAutoSpinAttack, isBaby, isBlocking, isCurrentlyGlowing, isDamageSourceBlocked, isDeadOrDying, isFallFlying, isHolding, isHolding, isImmobile, isInvertedHealAndHarm, isInWall, isSensitiveToWater, isSleeping, isSuppressingSlidingDownLadder, isUsingItem, isVisuallySwimming, jumpFromGround, kill, knockback, lerpHeadRotationStep, lerpHeadTo, lerpTargetX, lerpTargetXRot, lerpTargetY, lerpTargetYRot, lerpTargetZ, lerpTo, lookAt, makeBrain, maxUpStep, onBelowWorld, onChangedBlock, onClimbable, 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, tickRidden, travel, travelRidden, triggerItemUseEffects, tryAddFrost, tryAddSoulSpeed, updateEffectVisibility, updateFallFlying, updateInvisibilityStatus, updateSwingTime, updateUsingItem, updateWalkAnimation, verifyEquippedItem, wasExperienceConsumed, wouldNotSuffocateAtTargetPose

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

    absMoveTo, absMoveTo, acceptsFailure, acceptsSuccess, addDeltaMovement, addPassenger, addTag, awardKillScore, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canCollideWith, canControlVehicle, canRide, canSpawnSprintParticle, canSprint, canTrample, canUpdate, canUpdate, captureDrops, captureDrops, changeDimension, changeDimension, checkBelowWorld, checkInsideBlocks, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, 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, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControlledVehicle, getCustomName, getDeltaMovement, getDimensionChangingDelay, getDimensionsForge, getDirection, getDismountLocationForPassenger, 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, getNameTagOffsetY, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, 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, is, isAddedToWorld, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInLiquid, 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, lerpPositionAndRotationStep, 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, playStepSound, playSwimSound, position, positionRider, positionRider, processFlappingMovement, processPortalCooldown, reapplyPosition, refreshDimensions, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, ridingOffset, rotate, 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, shouldBeSaved, 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, updateFluidHeightAndDoFluidPushing, 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, getEyeHeightForge, 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, shouldUpdateFluidWhileBoating

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

    canDrownInFluidType, canSwimInFluidType, moveInFluid, self, sinkInFluid
  • Field Details

    • usingDefaultName

      public boolean usingDefaultName
      Whether to use randomly generated fields for the Trainer's messages.
    • usingDefaultGreeting

      public boolean usingDefaultGreeting
      Whether to use randomly generated fields for the Trainer's messages.
    • usingDefaultWin

      public boolean usingDefaultWin
      Whether to use randomly generated fields for the Trainer's messages.
    • usingDefaultLose

      public boolean usingDefaultLose
      Whether to use randomly generated fields for the Trainer's messages.
    • greeting

      public String greeting
      The Trainer's messages at the start and end of battle.
    • winMessage

      public String winMessage
      The Trainer's messages at the start and end of battle.
    • loseMessage

      public String loseMessage
      The Trainer's messages at the start and end of battle.
    • winMoney

      public int winMoney
      The base amount of money won upon defeating the Trainer.
    • pokemonLevel

      public int pokemonLevel
      The base pokemonLevel of the Trainer's Pokémon.
    • isGymLeader

      public boolean isGymLeader
      Whether the Trainer is a gym leader.
    • canEngage

      public transient boolean canEngage
      Whether players can engage this NPC or not. This is not persistent. Don't treat it as such.
    • playerEncounters

      public HashMap<UUID,Long> playerEncounters
      The players battled by the NPC Trainer and when they were last battled.
    • winCommands

      public ArrayList<String> winCommands
      Commands to execute when the NPC Trainer wins.
    • loseCommands

      public ArrayList<String> loseCommands
      Commands to execute when the NPC Trainer loses.
    • forfeitCommands

      public ArrayList<String> forfeitCommands
      Commands to execute when the Player forfeits.
    • preBattleCommands

      public ArrayList<String> preBattleCommands
      Commands to execute when the Player begins a battle with an NPC.
    • battleRules

      public BattleRules battleRules
    • battleController

      public BattleController battleController
      The battle the Trainer is in.
  • Constructor Details

    • NPCTrainer

      public NPCTrainer(net.minecraft.world.entity.EntityType<NPCTrainer> type, net.minecraft.world.level.Level par1World)
      Sets up the Trainer and its data watcher attributes.
    • NPCTrainer

      public NPCTrainer(net.minecraft.world.level.Level world)
  • Method Details

    • defineSynchedData

      protected void defineSynchedData()
      Overrides:
      defineSynchedData in class NPCEntity
    • init

      public void init(BaseTrainer trainer)
      Initializes the Trainer's fields.
      Parameters:
      trainer - The type of Trainer to initialize.
    • getName

      public String getName(String langCode)
      Gets the translated Trainer's name.
      Parameters:
      langCode - The langCode for translation.
    • clearGreetings

      public void clearGreetings()
    • getGreeting

      public String getGreeting(String langCode)
      Gets the translated Trainer's greeting.
      Parameters:
      langCode - The langCode for translation.
    • getWinMessage

      public String getWinMessage(String langCode)
      Gets the translated Trainer's victory message.
      Parameters:
      langCode - The langCode for translation.
    • getLoseMessage

      public String getLoseMessage(String langCode)
      Gets the translated Trainer's loss message.
      Parameters:
      langCode - The langCode for translation.
    • getChat

      public TrainerChat getChat(String langCode)
      Gets the Trainer's translated dialogue.
      Parameters:
      langCode - The langCode for translation.
    • getWinMoney

      public int getWinMoney()
      Gets the amount of PokeDollars given to the player if they win
    • setEncounterMode

      public void setEncounterMode(EnumEncounterMode mode)
      Sets the Trainer's encounter mode.
      Parameters:
      mode - The new encounter mode.
    • setMegaItem

      public void setMegaItem(EnumMegaItemsUnlocked megaItem)
    • setOldGenMode

      public void setOldGenMode(EnumOldGenMode mode)
    • getEncounterMode

      public EnumEncounterMode getEncounterMode()
      Gets the Trainer's encounter mode.
      Returns:
      The Trainer's encounter mode.
    • getMegaItem

      public EnumMegaItemsUnlocked getMegaItem()
    • getOldGen

      public EnumOldGenMode getOldGen()
    • setEngageDistance

      public void setEngageDistance(int engageDistance)
      Sets the Trainer's engage distance in blocks for if they're in an engage AI mode
      Parameters:
      engageDistance - The distance in blocks for the trainer to engage the nearby players
    • getEngageDistance

      public int getEngageDistance()
      Gets the Trainer's engage distance in blocks for if they're in an engage AI mode
      Returns:
      The engage distance in blocks
    • setTrainerType

      public void setTrainerType(BaseTrainer model, net.minecraft.world.entity.player.Player player)
      Sets the Trainer's model.
      Parameters:
      model - The new BaseTrainer.
      player - The player editing the NPC Trainer.
    • tickLeash

      public void tickLeash()
      Overrides:
      tickLeash in class net.minecraft.world.entity.PathfinderMob
    • push

      public void push(double par1, double par3, double par5)
      Overrides:
      push in class net.minecraft.world.entity.Entity
    • isPickable

      public boolean isPickable()
      Overrides:
      isPickable in class net.minecraft.world.entity.LivingEntity
    • isPushable

      public boolean isPushable()
      Overrides:
      isPushable in class NPCEntity
    • tick

      public void tick()
      Overrides:
      tick in class NPCEntity
    • checkForRarityDespawn

      protected void checkForRarityDespawn()
      Description copied from class: NPCEntity
      Keeps track of when to despawn the NPC.
      Overrides:
      checkForRarityDespawn in class NPCEntity
    • releasePokemon

      public PixelmonEntity releasePokemon(UUID newPokemonUUID)
      Sends out one of the NPC's Pokémon.
      Returns:
      The Pokémon that was sent out.
    • loadPokemon

      public void loadPokemon(ArrayList<Pokemon> pokemonList)
      Loads the Trainer's Pokémon.
    • startBattle

      public void startBattle(BattleParticipant battleParticipant)
      Starts a battle with the NPC.
      Parameters:
      battleParticipant - The NPC's opponent in battle.
    • calculateGen

      public Quadstate calculateGen()
      Works out and sets which generation this Trainer is for.
    • loseBattle

      public void loseBattle(ArrayList<BattleParticipant> opponents)
      Handles events when the NPC loses a battle.
      Parameters:
      opponents - The winning opponents in the battle.
    • winBattle

      public void winBattle(ArrayList<BattleParticipant> opponents)
      Handles events when the NPC wins a battle.
      Parameters:
      opponents - The losing opponents in the battle.
    • healAllPokemon

      public void healAllPokemon()
      Heals the NPC's Pokémon.
    • restoreAllFriendship

      public void restoreAllFriendship()
      Restores the trainer's pokemon friendship pokemonLevel to full (for benefit of moves requiring high levels of friendship)
    • getNextPokemonUUID

      public UUID getNextPokemonUUID()
      Gets the ID of the next available Pokémon that the NPC can send out.
      Returns:
      The ID of the next available Pokémon that the NPC can send out, or {-1, -1} if there aren't any.
    • getTrainerLevel

      public int getTrainerLevel()
      Gets the Trainer's displayed pokemonLevel.
      Returns:
      The Trainer's displayed pokemonLevel.
    • interactWithNPC

      public boolean interactWithNPC(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Description copied from class: NPCEntity
      Handles a player interacting with the NPC.
      Overrides:
      interactWithNPC in class NPCEntity
      Parameters:
      player - The player interacting with the NPC.
      Returns:
      False
    • checkAndHandleImportantInteractions

      public net.minecraft.world.InteractionResult checkAndHandleImportantInteractions(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Overrides:
      checkAndHandleImportantInteractions in class net.minecraft.world.entity.Mob
    • addAdditionalSaveData

      public void addAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
      Overrides:
      addAdditionalSaveData in class NPCEntity
    • canStartBattle

      public boolean canStartBattle(net.minecraft.world.entity.player.Player opponent, boolean printMessages)
      Checks if the NPC can start a new battle.
      Parameters:
      opponent - The player about to battle the NPC.
      printMessages - Whether to display error messages if the battle cannot be started.
      Returns:
      Whether the NPC can start a new battle.
    • readAdditionalSaveData

      public void readAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
      Overrides:
      readAdditionalSaveData in class NPCEntity
    • randomisePokemon

      public void randomisePokemon(net.minecraft.world.entity.player.Player player)
      Generates a new party for the Trainer.
      Parameters:
      player - The player editing the Trainer.
    • getBossTier

      public BossTier getBossTier()
      Description copied from class: NPCEntity
      Gets the boss tier of the NPC.
      Overrides:
      getBossTier in class NPCEntity
      Returns:
      The boss tier of the NPC.
    • setBossTier

      public void setBossTier(BossTier tier)
      Sets the boss tier for the Trainer.
      Parameters:
      tier - The new boss tier for the Trainer.
    • getBattleAIMode

      public BattleAIMode getBattleAIMode()
      Gets the Trainer's battle AI mode.
      Returns:
      The Trainer's battle AI mode.
    • setBattleAIMode

      public void setBattleAIMode(BattleAIMode mode)
      Sets the Trainer's battle AI mode.
      Parameters:
      mode - The new battle AI mode.
    • getBattleType

      public BattleType getBattleType()
      Gets the Trainer's battle type.
      Returns:
      The Trainer's battle type.
    • updateTrainerLevel

      public void updateTrainerLevel()
      Updates the Trainer's pokemonLevel based on average pokemonLevel of his/her party Pokémon.
    • initDefaultAI

      public void initDefaultAI()
      Description copied from class: NPCEntity
      Initializes the NPC's AI to stand still.
      Overrides:
      initDefaultAI in class NPCEntity
    • initAI

      public void initAI()
      Description copied from class: NPCEntity
      Initializes the NPC's AI.
      Overrides:
      initAI in class NPCEntity
    • update

      public void update(SetTrainerData p)
      Updates the Trainer's data.
      Parameters:
      p - The updated Trainer data.
    • setStartRotationYaw

      public void setStartRotationYaw(float f)
      Sets the rotation of the Trainer.
      Parameters:
      f - The new rotation.
    • getDisplayText

      public String getDisplayText()
      Description copied from class: NPCEntity
      Gets the text that displays above the NPC.
      Specified by:
      getDisplayText in class NPCEntity
      Returns:
      The text that displays above the NPC.
    • getSubTitleText

      public String getSubTitleText()
      Description copied from class: NPCEntity
      Gets the subtitle for the text that displays above the NPC.
      Overrides:
      getSubTitleText in class NPCEntity
      Returns:
      The subtitle for the text that displays above the NPC.
    • setBattleController

      public void setBattleController(BattleController battleController)
      Sets the NPC's battle controller.
      Parameters:
      battleController - The NPC's battle controller.
    • getBattleController

      public BattleController getBattleController()
      Gets the NPC's battle controller.
      Returns:
      The NPC's battle controller.
    • getPokemonStorage

      public TrainerPartyStorage getPokemonStorage()
      Gets the NPC's Pokémon party.
      Returns:
      The NPC's Pokémon party.
    • getEntity

      public net.minecraft.world.entity.Mob getEntity()
      Gets the NPC entity.
      Returns:
      The NPC entity.
    • setAttackTargetPix

      public void setAttackTargetPix(net.minecraft.world.entity.LivingEntity entity)
      Sets an entity for the NPC to target.
      Parameters:
      entity - The entity to target.
    • updateDrops

      public void updateDrops(net.minecraft.world.item.ItemStack[] drops)
      Updates the winnings from the NPC Trainer.
      Parameters:
      drops - The updated NPC Trainer winnings.
    • getWinnings

      public net.minecraft.world.item.ItemStack[] getWinnings()
      Gets the winnings from the NPC Trainer.
      Returns:
      The winnings from the NPC Trainer.
    • setPokemonLevel

      public void setPokemonLevel(int pokemonLevel)
    • onSyncedDataUpdated

      public void onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> key)
      Overrides:
      onSyncedDataUpdated in class NPCEntity