Dev15 Beta Changelog - ProjectZulu/JustAnotherSpawner GitHub Wiki
UPDATE 12/05/2014: Just Another Spawner v0.16.DEV1
- Add InstanctDespawn Tag. For compatability, only works if a despawn tag is present. Value key is "InstantDespawns Tags": add to livinghandler as you would despawn tags.
- Reports the current dimension the player is in that can be used with the dimension tag
- Add Command entitystats to calculate mean/median/mode for entity density and entity distance to player
- Switch from PersistenceRequired hackery to using AllowDespawn forge event.
- Should provide better compatability, notably allowing entities to despawn normally once JAS is uninstalled or despawn tags are no longer used by user.
- Fix overly sensitive duplicate entity class / mappings detection. Should now no longer report false positives
- Prepend MVEL execution block error messages to better assist debugging
- Command CanSpawnHere now reports the probability success / # of trials of an entity to spawn in a given location, if at all. Ommitted if 100%
- long wrld.totalTime() // Total time for the world
- long wrld.timeofDay() // The current world time in ticks, ranging from 0 to 23999.
UPDATE 09/06/2014: Just Another Spawner v0.15.DEV1 This is a development version and is subject to change. Feedback/Testing Appreciated. Download: https://www.dropbox.com/sh/5rhhkmqkaq6bzc1/AAABN_2c49E09N3TxJeTZV5Ga?dl=0
This versions significantly changes the format of multiple configuration files. All compatible changes are automatically converted. Only two previous features are however no longer supported. First, blockRange no longer exists. The new block expression function has the ability to accept range. If you were using the blockRange tag you will need to manually adjust the imported block function withe appropriate range. Second, LivingHandlers absorbed the functionality of LivingGroups except for the ability to reference other biomegroups. Attributes will need to be used for this. If you had LivinGroups referencing other LivingGroups you will need to correct the imported LivingHandler contents.
##Major Features
Tags have been replaced with MVEL expressions. These are scripts based on Java syntax. See http://mvel.codehaus.org/Language Guide for 2.0.
Old tags are imported from fileVersion=1.0 config files and automatically converted to the new expression format. The format is similar: {spawn:sky}
is now just sky()
.
- Old CreatureType Monster Tag:
"Tags": "{spawn:!solidside,1,0,[0/-1/0]:liquid,0:normal,0:normal,0,[0/1/0]:!opaque,0,[0/-1/0]}"
- New CreatureType Monster Tag:
"Spawn Tag": "!solidside(1,{0,0,0},{0,-1,0})||liquid({0,0,0},{0,0,0})||normal({0,0,0},{0,0,0})||normal({0,0,0},{0,1,0})||!opaque({0,0,0},{0,-1,0})"
All MVEL expressions are on their own 'line'. They no longer split from a single line i.e. {spawn}{depsawn}
MVEL supports brackets, if-else statements, ternary operator, ^, &&, ||. Note that if using "
that because "
is considered special is GSON it must be escaped i.e. "Entity Tags": ""Zombie"", needs to be "Entity Tags": "\"Zombie\""
.
MVEL automatically assumed the result of the expression based on the output i.e. sky() && blockfoot() is clearly a boolean result and MVEL will handle it automatically. There are functions ('tags') that will not return a boolean function. i.e. count.getLocalEntityTypeCount(String entityType)
returns an integer. To be valid it must be compared to something i.e. count.getLocalEntityTypeCount(String entityType) < 5
.
CreatureType now has the following fields:
- "Spawn Tag": MVEL spawn expression. Expects a boolean value.
- "Iterations Per Chunk": Number of times to try to spawn different entities per chunk per CreatureType
- "Iterations Per Pack": Number of times to try to spawn a particular entity per 'iteration per chunk'
- "Contents": String value containing Attribtues (marked with A|) or mapping names from LivingGroups.CFG to indicate which entities this should spawn. Multiple entities are chosen randomly to spawn with equal weights.
- "Spawn Operand": Whether LH Spawn Tag is && or || with SpawnListEntry.
- "Spawn Tag": MVEL spawn expression. Expects a boolean value. Absent if empty.
- "Despawn Tags": MVEL despawn expression. Expects a boolean value. Absent if empty.
- "PostSpawn Tags": MVEL postspawn expression. Expects a boolean value. Absent if empty.
- "Entity Tags": MVEL spawn expression. Overrides what Entity this LH should spawn. Expects a String value, a JAS mapping. Absent if empty.
- "Min Despawn Range": Minimum range the entity should be before being eligible for despawning.
- "Max Despawn Range": Range this entity should instantly despawn at.
- "Despawn Age": Minimum age the entity should be before being eligible for despawning.
- "Despawn Rate": Rate at which this entity should despawn once eligible.
- "Entity Cap": Maximum number of this entity that should be allowed to spawn in loaded chunks.
- "Spawn Operand": Whether SPL Spawn Tag is && or || with LivingHandler.
- "Spawn Tag": MVEL spawn expression. Expects a boolean value. Absent if empty.
- "PostSpawn Tags": MVEL postspawn expression. Expects a boolean value. Absent if empty.
Access to the following fields are variables are provided and accessed in the form "Spawn Tag": "posX > 200"
- posX: X coordinate of the spawning location
- posY: Y coordinate of the spawning location
- posZ: Z coordinate of the spawning location
- entity: The entity to be spawned (not always present but mostly i.e. during CreatureType spawning)
Access to the following methods are provided and accessed in the form "Spawn Tag": "sky()". If a specific size array is marked with the form [N] where N is the number of values required. If unlimited it will say N. Typically 3 and that means X,Y,Z coords/range/offsets. If 2 it would mean min/max or X/Z (i.e. biomes which are same no matter Y). Common Functions:
- boolean sky()
- boolean block(String[N] blockKeys, Integer[3] searchRange, Integer[3] searchOffsets)
- boolean block(String[N] blockKeys, Integer[N] metas, Integer[3] searchRange, Integer[3] searchOffsets)
- boolean blockFoot(String[N] blockKeys)
- boolean blockFoot(String[N] blockKeys, Integer[N] metas)
- boolean normal(Integer[3] searchRange, Integer[3] searchOffsets)
- boolean liquid(Integer[3] searchRange, Integer[3] searchOffsets)
- boolean solidside(Integer side, Integer[3] searchRange, Integer[3] searchOffsets)
- boolean opaque(Integer[3] searchRange, Integer[3] searchOffsets)
- boolean ground()
- boolean random(int range, int offset, int maxValue) // True if [0, range - 1] + offset <= maxValue
- boolean modspawn() // Default entity.getCanSpawnHere methods
- boolean isTamed()
- boolean isTameable()
- boolean biome(String biomeName, int[3] range, int[3] offset) // BiomeName can be G|group, A|attribute, or mapping.
- writenbt(String[] nbtOperations) // Like the previous tag, except instead of linking each op together with , you have each as element in list
Plenty of old-style tag equivalents that are less useful now that expressions can be made on the users own
- boolean lgcy.height(int minHeight, int maxHeight)
- boolean lgcy.light(int minLight, int maxLight)
- boolean lgcy.torchlight(int minLight, int maxLight)
- boolean lgcy.origin(int minDistance, int maxDistance)
- boolean lgcy.height(int minHeight, int maxHeight)
- boolean lgcy.top() // Block at foot is same as biomes specified top block
- boolean lgcy.filler() // Block at foot is same as biomes specified filler block
- boolean lgcy.dimension(int dimension)
- boolean lgcy.location(int[3] offset, int[3] range)
- boolean lgcy.players(int[2] searchRange, int[2] minMaxBounds)
- boolean lgcy.entities(String[N] searchNames, int[2] searchRange, int[2] minMaxBounds)
- boolean lgcy.difficulty(int desiredDifficulty)
These do not return boolean values, but quantities of values at spawn location
- String obj.block() // returns name of block
- int obj.light() // returns light level
- int obj.torchlight()
- int obj.origin() // Distance to Server-spawnpoint
- String obj.material()
- int obj.difficulty // 0 == Peaceful, 1 == Easy, 2 == normal, 3 == Hard
- int obj.highestResistentBlock() // Highest block that restrics movement and is not Leaves, wood, glass, or foliage
- int obj.playersInRange(int minRange, int maxRange) // Number of players in sphere specfified by min/max range
- int obj.countEntitiesInRange(String[N] searchNames, int minRange, int maxRange) // Number of players in sphere specfified by min/max range, searchName is FML name
- int obj.countJASEntitiesInRange(String[N] searchNames, int minRange, int maxRange) // Number of players in sphere specfified by min/max range, searchName is JAS name
Less useful tags used by other tags internally or by advanced users
- boolean util.inRange(int current, int minRange, int maxRange) // Is the current value between the min and max
- String util.material(Material material) // String name for the provided Material reference
- int util.rand(int value) //random value between 0 and value-1
- void util.log(String string) // Logs measage to FML log under [JAS] header. Is prepended with [TAG_LOG]
Access to certain function similar to native world functions modders have access to. Used to check arbitrary nearby blocks to spawn position.
- int lightAt(int coordX, int coordY, int coordZ)
- int torchlightAt(int coordX, int coordY, int coordZ)
- String blockNameAt(Integer offsetX, Integer offsetY, Integer offsetZ)
- Block blockAt(int coordX, int coordY, int coordZ) // returns Block object at coord
- Block biomeTop(int coordX, int coordZ) // returns Block object of specified top block of Biome at coord
- Block biomeFiller(int coordX, int coordZ) // returns Block object of specified filler block of Biome at coord
- BiomeGenBase biomeAt(int coordX, int coordZ) // returns Biome object at coord
- Material materialAt(int coordX, int coordY, int coordZ) // returns Material object at coord
- ChunkCoordinates originPos() // Server Spawn point
- boolean skyVisibleAt(int coordX, int coordY, int coordZ) // call to World.canBlockSeeSky(int coordX, int coordY, int coordZ)
- int dimension() // Current Dimension, 0 == overworld
Access to the current entity count
- int getLocalEntityTypeCount(String entityType) // Number of CreatureType in the current chunk
- int getLocalEntityClassCount(String entityJasName) // Number of JAS mapping in the current chunk
- int getGlobalEntityTypeCount(String entityType) // Number of CreatureType across countable chunks
- int getGlobalEntityClassCount(String entityJasName) // Number of JAS mapping across countable chunks
- int entitiesSpawnedThisChunk() // Counts all entities spawned during all "Iterations Per Chunk" CreatureType settings
- int entitiesSpawnedThisPack() // Counts all entities spawned during all "Iterations Per Pack" CreatureType settings
- int clodCount(String entityType) // Number of CreatureType in a 2x2 chunk radius, same area used in BiomeCap