mNo edit summary
(Nobody noticed 😏)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Pokémon Behaviour==
A Pokémon's AI behaviour is configurable from their species JSON. This is used control whether it can walk, swim, or fly as well as the speed it moves while doing each of those, whether or not it can fall asleep, and various other things.
A Pokémon's AI behaviour is configurable from their species JSON. This is used control whether it can walk, swim, or fly as well as the speed it moves while doing each of those, whether or not it can fall asleep, and various other things.


The default is a land-moving AI that moves at a brisk pace, cannot breathe underwater, and does not sleep.
'''If you don't include any of the following behavior properties in your species JSON, the Pokémon will use default AI behavior. The default is a land-moving AI that moves at a brisk pace, cannot breathe underwater, and does not sleep.'''


===PokemonBehaviour===
===PokemonBehaviour===
Line 28: Line 27:
| canWalk
| canWalk
| A <code>true/false</code> value. If <code>false</code>, the Pokémon cannot move over land.
| A <code>true/false</code> value. If <code>false</code>, the Pokémon cannot move over land.
|-
| avoidsLand
| A <code>true/false</code> value. If <code>true</code>, the Pokémon should avoid land.
|-
|-
| walkSpeed
| walkSpeed
Line 40: Line 42:
! Option
! Option
! style="text-align:left;" | Details
! style="text-align:left;" | Details
|-
| avoidsWater
| A <code>true/false</code> value. If <code>true</code>, the Pokémon should avoid water.
|-
|-
| canSwimInWater
| canSwimInWater
| A <code>true/false</code> value. If <code>true</code>, it can swim in water.
| A <code>true/false</code> value. If <code>true</code>, the Pokémon can swim in water.
|-
|-
| canBreatheUnderwater
| canBreatheUnderwater
Line 51: Line 56:
|-
|-
| canSwimInLava
| canSwimInLava
| A <code>true/false</code> value. If <code>true</code>, it can swim in lava without taking damage.
| A <code>true/false</code> value. If <code>true</code>, the Pokémon can swim in lava.
|-
|-
| canBreatheUnderlava
| canBreatheUnderlava
Line 58: Line 63:
| canWalkOnLava
| canWalkOnLava
| A <code>true/false</code> value. If <code>true</code>, the Pokémon will move across the top of lava as if it's walking on it.
| A <code>true/false</code> value. If <code>true</code>, the Pokémon will move across the top of lava as if it's walking on it.
|-
| hurtByLava
| A <code>true/false</code> value. If <code>false</code>, the Pokémon will not take damage in lava.
|-
|-
| swimSpeed
| swimSpeed
Line 79: Line 87:
|-
|-
| canLook
| canLook
| A <code>true/false</code> value. If false, the Pokémon will not even turn to look at nearby entities.
| A <code>true/false</code> value. If <code>false</code>, the Pokémon will not even turn to look at nearby entities.
|-
| looksAtEntities
| A <code>true/false</code> value. If <code>false</code>, the Pokémon will not even turn to look at nearby entities despite <code>canLook</code> being set to true. The default value is <code>true</code>.
|-
| stepHeight
| The height, measured in blocks, a Pokémon can step over before they consider jumping instead. The default value is <code>0.6</code>. This default height allows them to step over beds. Due to unfinished pathfinding ai, Pokémon cant properly use this property.
|-
| wanderChance
| The number of ticks it takes before the Pokémon has a chance at wandering. The default value is <code>120</code>.
|-
| wanderSpeed
| Multiplies the Pokémon's speed by this value when the Pokémon is using the wander behavior. The default value is <code>1</code>. This property also seems to change the pathfinding behavior if the Pokémon is moving very fast.
|}
|}
|-
|-
Line 85: Line 105:
| A set of properties relating to how and when the Pokémon sleeps, if it sleeps at all.
| A set of properties relating to how and when the Pokémon sleeps, if it sleeps at all.
<br>
<br>
{| class="wikitable" style="margin:auto"
{| class="wikitable" style="margin:auto"
|-
|-
Line 96: Line 114:
|-
|-
| times
| times
| A time range for when it can sleep, which can be abbreviations or tick ranges and can be combined with commas. Examples: <code>"day"</code>, <code>"night"</code>, <code>"dawn,dusk"</code>, <code>"1200-2400,morning"</code>. This is the same format as the time range controls in Spawner Conditions.
| A time range for when it can sleep, which can be abbreviations or tick ranges and can be combined with commas. Examples: <code>"day"</code>, <code>"night"</code>, <code>"dawn,dusk"</code>, <code>"1200-2400,morning"</code>. This is the same format as the time range controls in Spawner Conditions. The default value is set to <code>"night"</code> if no other value is specified.
|-
|-
| sleepChance
| sleepChance
Line 108: Line 126:
|-
|-
| light
| light
| A light level or level range, between <code>0</code> and <code>15</code>, which represents the light levels in which the Pokémon is able to sleep. If you set this option to <code>"15"</code>, then the Pokémon can only fall asleep in maximum light. If you set this option to <code>"0-7"</code>, then it can only fall asleep when it's fairly dark. {{mc|Light#Light_level|These light levels can be found on the Minecraft Wiki}}.
| A light level or level range, between <code>0</code> and <code>15</code>, which represents the light levels in which the Pokémon is able to sleep. If you set this option to <code>"15"</code>, then the Pokémon can only fall asleep in maximum light. If you set this option to <code>"0-7"</code>, then it can only fall asleep when it's fairly dark. [[minecraftwiki:Light#Light_level|These light levels can be found on the Minecraft Wiki]].
|-
|-
| depth
| depth
Line 121: Line 139:
Examples from existing species JSONs:
Examples from existing species JSONs:


'''Charmander'''
'''Charmander''' - A classic land walker using many default behavior values which don't need to be specified in code.
     "behaviour": {
     "behaviour": {
         "resting": {
         "resting": {
Line 132: Line 150:




'''Charizard'''
'''Charizard''' - A land walker that can also fly
    "behaviour": {
  "behaviour": {
        "moving": {
    "resting": {
            "fly": {
      "canSleep": true,
                "canFly": true,
      "depth": "normal",
                "flySpeedHorizontal": 0.6
      "light": "0-4"
            }
        }
     },
     },
    "moving": {
      "fly": {
        "canFly": true,
        "flySpeedHorizontal": 0.6
      }
    }
  },




'''Lapras'''
'''Bidoof''' - A semi-aquatic egg laying land dweller. Chooses to 'walk' on water in combination with animations to appear like it prefers to float on the surface of water and walk on land.
    "behaviour": {
  "behaviour": {
        "moving": {
    "moving": {
            "swim": {
      "walk": {
                "canWalkOnWater": true,
        "walkSpeed": 0.28
                "canSwim": true,
      },
                "canBreatheUnderwater": true
      "swim": {
            }
        "swimSpeed": 0.17,
        }
        "canSwimInWater": true,
        "canBreatheUnderwater": true,
        "canWalkOnWater": true
      }
     },
     },
    "resting": {
      "canSleep": true,
      "willSleepOnBed": true,
      "depth": "normal",
      "light": "0-4"
    }
  },
'''Magikarp''' - A basic fish-like aquatic pokemon
  "behaviour": {
    "moving": {
      "canLook": false,
      "walk": {
        "avoidsLand": true
      },
      "swim": {
        "swimSpeed": 0.1,
        "canSwimInWater": true,
        "canBreatheUnderwater": true
      }
    }
  },
'''Shellder'''- An aquatic Pokémon prefers to walk on surfaces. Can walk on both land or underwater
  "behaviour": {
    "moving": {
      "swim": {
        "swimSpeed": 0.1,
        "canSwimInWater": false,
        "canBreatheUnderwater": true
      }
    }
  },
{{Addon Creation}}

Latest revision as of 00:46, 21 March 2024

A Pokémon's AI behaviour is configurable from their species JSON. This is used control whether it can walk, swim, or fly as well as the speed it moves while doing each of those, whether or not it can fall asleep, and various other things.

If you don't include any of the following behavior properties in your species JSON, the Pokémon will use default AI behavior. The default is a land-moving AI that moves at a brisk pace, cannot breathe underwater, and does not sleep.

PokemonBehaviour

Option Details
moving A set of properties relating to the movement of a Pokémon.


Option Details
walk A set of properties that control the land walking of a Pokémon.


Option Details
canWalk A true/false value. If false, the Pokémon cannot move over land.
avoidsLand A true/false value. If true, the Pokémon should avoid land.
walkSpeed The base speed of the Pokémon when moving over land, defaulting to 0.35.
swim A set of properties that control the swimming (through water or lava) of a Pokémon.


Option Details
avoidsWater A true/false value. If true, the Pokémon should avoid water.
canSwimInWater A true/false value. If true, the Pokémon can swim in water.
canBreatheUnderwater A true/false value. If false, the Pokémon will drown if it stays submerged in water for too long.
canWalkOnWater A true/false value. If true, the Pokémon will move across the top of water as if it's walking on it.
canSwimInLava A true/false value. If true, the Pokémon can swim in lava.
canBreatheUnderlava A true/false value. If false, the Pokémon will drown if it stays submerged in lava for too long.
canWalkOnLava A true/false value. If true, the Pokémon will move across the top of lava as if it's walking on it.
hurtByLava A true/false value. If false, the Pokémon will not take damage in lava.
swimSpeed The base speed of the Pokémon when moving through fluids, defaulting to 0.3.
fly A set of properties that control the flight through the air of a Pokémon.


Option Details
canFly A true/false value. If true, the Pokémon is capable of flying through the air.
flySpeedHorizontal The horizontal speed of the Pokémon when flying, defaulting to 0.3.
canLook A true/false value. If false, the Pokémon will not even turn to look at nearby entities.
looksAtEntities A true/false value. If false, the Pokémon will not even turn to look at nearby entities despite canLook being set to true. The default value is true.
stepHeight The height, measured in blocks, a Pokémon can step over before they consider jumping instead. The default value is 0.6. This default height allows them to step over beds. Due to unfinished pathfinding ai, Pokémon cant properly use this property.
wanderChance The number of ticks it takes before the Pokémon has a chance at wandering. The default value is 120.
wanderSpeed Multiplies the Pokémon's speed by this value when the Pokémon is using the wander behavior. The default value is 1. This property also seems to change the pathfinding behavior if the Pokémon is moving very fast.
resting A set of properties relating to how and when the Pokémon sleeps, if it sleeps at all.


Option Details
canSleep A true/false value. If it's true, then it can fall asleep if it is a wild Pokémon. Many other options exist as filters for when a Pokémon can fall asleep in nature and all require this option to be set to true.
times A time range for when it can sleep, which can be abbreviations or tick ranges and can be combined with commas. Examples: "day", "night", "dawn,dusk", "1200-2400,morning". This is the same format as the time range controls in Spawner Conditions. The default value is set to "night" if no other value is specified.
sleepChance The chance (per tick) of a Pokémon falling asleep. By default it is 0.0017 which roughly equates to it taking an average of 30 seconds to fall asleep.
blocks A list of block conditions, one of which must be met for the Pokémon to be able to sleep on the block. Block conditions can be either the name of the block or a tag that the block must be in.
biomes A list of biome conditions, one of which must be met for the Pokémon to be able to sleep in the biome. Biome conditions can be either the name of the biome or a tag that the biome must be in.
light A light level or level range, between 0 and 15, which represents the light levels in which the Pokémon is able to sleep. If you set this option to "15", then the Pokémon can only fall asleep in maximum light. If you set this option to "0-7", then it can only fall asleep when it's fairly dark. These light levels can be found on the Minecraft Wiki.
depth The depth of the sleep. This is a classification on what things can interrupt the sleep and make the Pokémon wake up. If you set it to "normal" then it will wake up when a non-sneaking player is within 16 blocks of the Pokémon. Another option is "comatose", and this causes the Pokémon to sleep through pretty much anything. You can add new sleep depths using the SleepDepth API.
willSleepOnBed A true/false value. If true, the Pokémon will try to sleep on top of the player's bed when they hop into it, much like cats.

Examples

Examples from existing species JSONs:

Charmander - A classic land walker using many default behavior values which don't need to be specified in code.

   "behaviour": {
       "resting": {
           "canSleep": true,
           "willSleepOnBed": true,
           "depth": "normal",
           "light": "0-2"
       }
   },


Charizard - A land walker that can also fly

 "behaviour": {
   "resting": {
     "canSleep": true,
     "depth": "normal",
     "light": "0-4"
   },
   "moving": {
     "fly": {
       "canFly": true,
       "flySpeedHorizontal": 0.6
     }
   }
 },


Bidoof - A semi-aquatic egg laying land dweller. Chooses to 'walk' on water in combination with animations to appear like it prefers to float on the surface of water and walk on land.

 "behaviour": {
   "moving": {
     "walk": {
       "walkSpeed": 0.28
     },
     "swim": {
       "swimSpeed": 0.17,
       "canSwimInWater": true,
       "canBreatheUnderwater": true,
       "canWalkOnWater": true
     }
   },
   "resting": {
     "canSleep": true,
     "willSleepOnBed": true,
     "depth": "normal",
     "light": "0-4"
   }
 },


Magikarp - A basic fish-like aquatic pokemon

 "behaviour": {
   "moving": {
     "canLook": false,
     "walk": {
       "avoidsLand": true
     },
     "swim": {
       "swimSpeed": 0.1,
       "canSwimInWater": true,
       "canBreatheUnderwater": true
     }
   }
 },


Shellder- An aquatic Pokémon prefers to walk on surfaces. Can walk on both land or underwater

 "behaviour": {
   "moving": {
     "swim": {
       "swimSpeed": 0.1,
       "canSwimInWater": false,
       "canBreatheUnderwater": true
     }
   }
 },