The Biggest One Yet [3.8.0]
This update comes with a whole whack-a-doo of new features, changes, fixes, etc.
Because this update is quite large, I have broken the changelog into a few sections, and included some spoilers.
Happy Skripting with SkBee!
Caution
Due to API changes/new features in Skript 2.10.x, SkBee now requires Skript 2.10.x+
General Changes
Here are some general changes that didn't fit into one of the below categories.
See details
FIXED:
- Fixed a bug on older server versions where spawning particles with force threw an error
- Fixed the team prefix/suffix expression returning empty strings when not set
- Fixed the objective name expression to properly use name/display name.
- Fixed the objective score expression throwing errors when attempting to set unmodifiable scores
- Fixed an issue with comparing structure sizes to vectors returning false
ADDED:
- Added an Audience type (for text component syntaxes)
- Added a condition to check if an objective/criteria has a modifiable score.
- Added support for statistics in the criteria expression
- Added support for text components in scoreboards
- Added an expression to get the tooltip lines of an item (Returned as a list of text components)
- Added a transmute recipe section
- Added an expression to get all possible blockdatas from a single block block
- Added an expression to get the resulting item when crafting a list of items
- Added a Skript type for PotionType
CHANGED:
- Changed how tag type of nbt expression returns list (hopefully producing the correct list type, or null)
- Changed the
chunk at coords
expression to optionally allow not loading/generating said chunk - Changed the "Give or Return Items" expression to always return a list.
- Changed the text component send/title effects to support sending to Audiences
- Changed the number format expression to return a proper string version.
- Changed the objective score expression to return null if the score was never set.
- Changed priority of chunk generator structure to load before events (this way you can use it in a world creator on load, without having to add a wait)
- Started using Skript's runtimes errors in a few places. This will grow over time.
Switch Cases
Switch cases are a tool that selects a code block to execute based on the value of a given expression.
They're basically a short form version of if/else if/else condition sections.
Check out The Docs for more examples.
Check out The Wiki for more information.
See Details
There are 2 variants of switches:
- Switch section, which is used to run code in the cases
- Switch return expression section, which is used to return a value from the cases
There are 2 variants of cases:
- Case section, used to run multiple lines of code in the section. (Used in Switch section)
- Case inline effect, used to either return a single value (in Switch return) or run an effect (in Switch section) all in one line.
Examples
# Switching with an action using section cases
on break:
switch type of event-block:
case stone, andesite, diorite:
give player a diamond named "Stone Gem"
case dirt, grass block, gravel, sand:
give player an emerald named "Ground Gem"
default:
give player a stick named "Boring Stick"
# Switching with a return using section cases
on break:
set {_i} to switch return type of event-block:
case stone, andesite, diorite:
return a diamond named "Stone Gem"
case dirt, grass block, gravel, sand:
return an emerald named "Ground Gem"
default:
return a stick named "Boring Stick"
give player {_i}
# Switching with an action using inline cases
on break:
switch type of event-block:
case stone, andesite, diorite -> give player a diamond named "Stone Gem"
case dirt, grass block, gravel, sand -> give player an emerald named "Ground Gem"
default -> give player a stick named "Boring Stick"
# Switching with a return using inline cases
on break:
set {_i} to switch return type of event-block:
case stone, andesite, diorite -> a diamond named "Stone Gem"
case dirt, grass block, gravel, sand -> an emerald named "Ground Gem"
default -> a stick named "Boring Stick"
give player {_i}
Bound Changes
Bounds got a pretty big overhaul in terms of performance
See details
CHANGED:
- Deprecated bound coords expression (use Bound Locations/World expressions instead)
- Changed bounds to use a new region system, see below.
- Full bounds now don't actually stretch the locations. You can now modify if the bound is full or not afterwards.
- Bounds now use locations 2 different ways, see below for more info.
- Bound saving has changed:
- Previous behaviour: each bound would save when it was created/modified.
This could cause massive lag if creating/modifying many in a short period of time. - New behaviour: bounds are only saved every 5 minutes (off the main thread) and when the server stops.
This is a massive performance boost.
- Previous behaviour: each bound would save when it was created/modified.
ADDED:
- Added support for
set
in the bound locations expression (allowing you to set greater/lesser corners) - Added support for
add/remove
in the bound locations expression (allowing you to add/remove vectors to/from greater/lesser corners to offset size) - Added an expression to get the world of a bound
- Added an expression to get/set the full state of a bound
BOUND REGIONS:
Bounds internally now use a region system.
The issue before with bound events was when a player moved, ALL bounds were looped and checked if the player moved in/out of that bound.
Now, bounds are put into regions with a size of 16x16 chunks. So when a player moves, only the bounds within that region at the player are checked.
This GREATLY increases performance.
Spark Test:
- 19200 bounds
- 50 players (all moving)
Old System:
- SkBee was using about 50% of server resources per tick
New System:
- SkBee was using about 0.3% of server resources per tick
BOUND CREATION CHANGES:
When creating/resizing a bound, you have 2 options as what to pass in for your 2 points:
- LOCATIONS: If you use locations, your bound will be created using the exact location you pass in.
In the image on the left, locations were used, and the bound created using the exact location of the blocks.
Example:create bound with id "test" within (location of {_a}) and (location of {_b})
(a/b representing blocks) - BLOCKS: If you use blocks, 1 will be added to the x/y/z axes of the bound to account for the blocks on the edge.
In the image on the right, blocks were used. The x/y/z axes had 1 added to account for those blocks.
Example:create bound with id "test" within {_c} and {_d}
(c/d representing blocks)
Item Component Changes
Some exciting new Item Components to make your items even cooler.
See details
ADDED:
- Added a "ConsumeEffect" type (used in Consumable/DeathProtection components)
- Added 5 new functions, 1 for each consume effect
- Added a can break/can place on component section (called Adventure Predicate)
- Added a charged projectiles component expression
- Added a consumable component section
- Added a custom model data component section
- Added a death protection component section
- Added an enchantable component expression
- Added an equippable component section
- Added a firework explosion component section
- Added a fireworks component section
- Added a glider component expression
- Added an instrument component section
- Added an intangible projectile component expression
- Added an item model component expression
- Added a jukebox playable component section
- Added a repairable component expression
- Added a tooltip style component expression
- Added a use cooldown component section
- Added a use remainder component expression
CHANGED:
Registry Additions
I have added some of Paper's registry stuff.
As of right now it's not super useful, but maybe in the future.
This all requires Paper 1.21+ (I believe, maybe 1.20.6?!?!)
See details
ADDED:
- Added RegistryKey type
- Added TypedKey type
- Added TagKey type
- Added an expression to get all values from a registry (via RegistryKey)
- Added an expression to get all TagKeys from a registry
- Added an expression to get a TagKey from a registry
Runtime Errors:
Skript recently added an option for runtime errors.
These errors are sent when something goes wrong at runtime, that the parser couldn't catch and will better help you understand if/why your code may not be working.
SkBee has implemented these in many places.
Hopefully these won't get too annoying.