I developed this plugin to add more procedure blocks and event triggers that I either couldn't find in other plugins or wanted to design my own way.
145 New Procedure Blocks
- Math procedures
- Number clamped between X and Y
- Number rounded to X decimal places
- Return 'true' with a chance of X in Y
- Is number between X and Y
- Cast number to float
- Text procedures
- Get text from / between first occurrence of text X and first occurrence of text Y on text Z
- Returns a portion of the text from a string. The difference between 'from' and 'between' is that 'from' includes the character occurrence in the returned string while 'between' excludes it.
- Effectively allows strings to be used as arrays for compact storage of variables.
- Get position of first occurrence of text X on text Y
- Does text X contain regex ('regular expression') Y
- Replace regex X with text Y on text Z
- Get boolean from integer on position X of text Y
- Basically used to read a string of binary numbers, like an array of booleans. Returns true if the character at the given position is '1', and returns false otherwise. Could be used for compact storage of a large number of logic variables.
- Append text X to start/end of text Y
- A more compact method of concatenating a string. Only works for local variables.
- Trim brackets/parentheses/curly brackets/namespace from text
- Get text from / between first occurrence of text X and first occurrence of text Y on text Z
- Entity procedures
- Set entity on ground to true/false
- Controls certain behaviors like movement friction, view bobbing and ability to jump.
- Set entity friction to true/false
- More commonly recognized as the Aether's quicksoil effect.
- Get/set idle time for entity
- A vanilla timer on mob entities (internally referred to as 'noActionTime') that increases for every tick they're at least 32 blocks from the player.
- When this timer is greater than 100 ticks, most mobs are programmed to not wander around aimlessly but otherwise behave as normal.
- When this timer is greater than 600 ticks, mobs begin to randomly despawn if they're also at least 32 blocks from the player.
- When this timer is less than 600 ticks, mobs do not despawn as long as they're within 128 blocks of the player.
- Get/set entity persistence
- Mobs with 'persistence required' do not despawn naturally.
- Set absorption health of entity to X
- Stop/release item that entity is using
- Get block that entity is standing on (smart detection)
- Mojang programmed this themselves but constantly forget to use it in favor of 'get block at y-1'.
- Get entity active potion effects as string
- Get number of armor slots filled for entity
- Entity is holding item X / item of type X / item tagged as X / is empty-handed
- Compact version of testing for the item in each of the entity's hands.
- Is entity not holding item tagged as X
- Is entity sensitive to water
- Is entity immune to effect X
- Is creeper entity swelling
- Get creeper entity swelling level
- Set swelling of creeper entity to X
- Get/set climbing of spider entity
- Is spider entity on climbable
- Is enderman entity enraged
- Has enderman entity been stared at
- Returns 'true' if a survival-mode player is looking at the enderman, or if the enderman is enraged.
- Is ghast entity charging a fireball
- Entity-entity raytrace ('has line of sight')
- Disable XP dropping for provided entity
- Is entity colliding
- Returns true if the entity's bounding box is interacting with that of another entity, or if the entity performs a melee attack. Includes collisions by entities such as arrow projectiles, but not the player's punching attack which isn't technically mediated by the bounding box.
- Is entity on climbable (ladder, vine, etc.)
- Get fall distance of entity
- Does entity have damage immunity frames (hurt time) remaining
- Get entity's remaining damage immunity ticks (hurt time)
- Is entity pathfinding to attack target
- Is entity swinging an arm
- Get number of ticks entity has been swinging an arm for
- Get entity's arm swing progress fraction
- Get ticks since entity attacked another entity
- Get ticks since entity was attacked by another entity
- Get entity tick count
- Returns the number of ticks that an entity has been existed for. Increments every tick that the entity is loaded, resets to zero every time the world is closed.
- Get/set age of ageable entity
- Returns the age of animals. Relevant to breeding cooldowns and aging of baby mobs.
- Does entity exist
- A more intuitive shortcut for testing whether an entity exists (aka whether an entity is 'null').
- Set entity on ground to true/false
- Projectile procedures
- Get XYZ power of fireball entity
- Set power of fireball entity
- Sets the inertial motion vector ('power') of 'fireball' entities, which include all fireballs as well as wither skulls and wind charges.
- Player procedures
- Get GUI menu currently being displayed
- Start/stop elytra flying
- Get elytra flight time
- Get/set number of pincushion arrows / bee stingers stuck in the player model
- Only works for players, unfortunately.
- Has swim/crawl pose
- Get swim/crawl pose animation level
- Force player to jump
- Can only be done for the player, not other entities.
- Get player's total XP points
- Get player's XP pickup time
- Returns '2' on the tick that a player picks up an XP orb, returns '1' one tick later, and returns '0' otherwise.
- Get player's approximate attack strength factor
- Returns the player's damage reduction factor due to cooldown for the currently held weapon. Approximate due to unknown additional variables.
- Set player's attack strength cooldown
- Sets the player's attack cooldown to full.
- Shrink player's held item by X if in survival
- Shortcut for removing players' held items if in survival mode.
- Is player able to eat
- Shortcut for testing whether the player doesn't have full hunger or is in creative mode.
- Item procedures
- Does item exist
- A more intuitive shortcut for testing whether an item is valid or 'air'.
- Get bonus damage from enchants on an enchanted item against a specified entity
- Does item have use animation of type X
- Does item have any use animation
- Does item exist
- Block procedures
- Does provided block exist
- A more intuitive shortcut for testing whether a block is valid or an air block.
- Does provided block drop XP
- Is provided block replaceable
- Checks for blocks that the player can replace with another block, such as air, water, lava, tall grass, etc. This procedure was salvaged from the Additions plugin after being deprecated.
- Is provided block full
- Returns true for any solid block with a 16x16x16-pixel bounding box, including blocks like dirt, stone, glass, leaves, etc. Returns true for double slabs but not single slabs. Returns false for blocks with bounding boxes that aren't precisely 16x16x16 pixels, such as farmland and soul sand, or blocks with 'holes', such as cauldrons or composters. Also returns false for blocks that are 16x16x16 pixels, but are non-solid, such as cobwebs or tall flowers.
- Does block at XYZ have solid collisions
- Returns true for any block that entities can collide with or stand on, such as dirt, stone, glass, slabs, stairs, fences, etc. Returns false for water, tall grass, cobwebs, rails, etc. As another example, this will return true for fence gates only if they are closed (since open fence gates have no collision), but will always return true for trapdoors since they can be collided with even when they are open.
- Get solid collision height of block at XY
- Returns the height of the highest solid portion of the block's collision hitbox. For example, returns '1' for standard-size blocks, '0.5' for bottom-half slabs, '1' for top-half or double slabs, '0.1875' for flat (closed) trapdoors, '1' for vertical (open) trapdoors, and returns zero for blocks with no collision, such as tall grass or flowers.
- Can block be rotated
- Detects rotation in everything except for block entities (chests, furnaces, etc.) and (for some reason) anvils or stonecutters
- Does block have rotation type log/cardinal/all
- Detects rotation in everything except for block entities (chests, furnaces, etc.) and (for some reason) anvils or stonecutters
- Is block of type slab/stairs/fence/wall/door/torch/block entity
- Does provided block exist
- Game Instance Procedures (these are all checked for the current instance of Minecraft being tested)
- Get FOV / FOV Effect Scale
- Get FPS / FPS Limit
- Get Render / Simulation Distance
- Is graphics quality set to Fast, Fancy or Fabulous
- Crash current instance
- Closes the game for whichever player or dedicated server executes the procedure. I don't know what use anyone could conceive for this but I'm adding it anyways.
- Are key and modifier bound to action X pressed
- As an example, if the "Walk Forwards" keybind action was bound to "W + CTRL", this would return true only if both the W and CTRL keys are pressed.
- Currently only detects keys pressed when the player does not have a menu open or the chat (the same conditions for when keybind actions actually apply).
- Is action X bound to key Y
- Does key bound to action X have a modifier
- Does key bound to action X have modifier Y
- Valid modifiers are 'shift', 'control', 'alt' or 'none'.
- Get key bound to action X
- As an example, would return 'w' for the "Walk Forwards" keybind action assuming it hasn't been changed from the default bind.
- Get modifier of key bound to action X
- Returns either 'shift', 'control', 'alt' or 'none' depending on the modifier assigned to the given keybind action.
- Is key X pressed
- Detects the press of any key except the mouse buttons which I'm still working on detection for.
- Currently only detects keys pressed when the player does not have a menu open or the chat (the same conditions for when keybind actions actually apply).
- Key presses will only be detected if pressed during the procedure you're checking them on, which means that very short keystrokes can be missed if, for instance, they are checked only on player tick updates.
- Is key modifier X pressed
- Valid modifiers are 'shift', 'control', 'alt' or 'none'.
- Can detect keys pressed even when the player has a menu open or the chat.
- World procedures
- Get blocklight / skylight level at XYZ
- Is it cold enough to snow at XYZ
- Does biome at XYZ have precipitation
- Is provided world loaded at XYZ
- Returns true if the chunk containing the specified position is currently loaded, which is true if the chunk is within the players' render distance (not the 'simulation distance'), or near the world spawn.
- Play sound on clientside
- Get/set gametime
- 'Gametime' is the age of the world in ticks. Useful as a standardized global counter.
- Is world singleplayer / superflat / hardcore / has cheats / has sleeping enabled
- Get/set PvP enabled / difficulty lock / default gamemode
- Get world display name
- Get world seed
- Get time remaining until it starts raining
- Get time remaining until it stops raining/thundering
- Organizational procedures
- Decorative procedure labels (red, green, blue and white). Found in the 'flow control' tab
- The first type is essentially just a label with a text display. Purely decorative and does not inject any code.
- The second type is similar to the first, but allows for the inclusion of arguments which are ignored unless the checkbox is ticked, allowing procedure blocks to be easily toggle during testing.
- Decorative procedure labels (red, green, blue and white). Found in the 'flow control' tab
- Event procedures
- End interaction procedures if event is canceled
- Used for the player interaction event triggers (player left/right-clicks entity/item/block, and the 'advanced' variants added in this plugin).
- If a player interaction event is canceled, this procedure will prevent the game from proceeding with the next iteration of the player interaction procedures for the current hand, if one exists.
- For example, if the 'player right-clicks block' event is canceled while iterating the player's main-hand, the subsequent 'player right-clicks with item' (for main-hand) and 'player right-clicks block' (for off-hand) events will not be triggered (if applicable for the current circumstances).
-
The order and firing conditions of Minecraft's player interaction event iteration procedures are quite complicated and will not be fully documented here.
- End interaction procedures if event is canceled
25 New Event Triggers
- Entity is unloaded (aka entity leaves the world)
- Triggered every time an entity is unloaded, just as the 'entity joins world' trigger is called every time an entity is loaded.
- As with 'entity joins world' it detects all entities, not just mobs / living entities.
- Provides the 'removalreason' as a string.
- Returns 'discarded' for projectiles that collide with blocks or entities, and for items that are picked up, merged or destroyed.
- Returns 'null' for entities that are unloaded to an inactive chunk.
- Returns 'killed' for slain mobs, paintings and item frames.
- Returns 'changed_dimension' for entities that travel through a portal or are teleported to another dimension via commands.
- Block is placed (non-attributable)
- As of version 2024.2 this trigger no longer seems to work. Similar to the 'block is placed' trigger but with no entity dependency, meaning it's called for any block placed in the world, not just ones placed by the player.
- Neighbor block changes
- Similar to the previous trigger.
- Entity is hurt (non-attributable)
- A modified version of the 'entity is attacked' trigger with no source entity dependency.
- Player right-clicks block (advanced)
- A modified version of the 'player right-clicks block' trigger which is called once for each of the player's hands, unless the block that the player clicks is interactable in which case it's called only for the player's main hand.
- Player uses tool secondary action on block
- Called when the player right clicks on a block with either a shovel, axe or hoe. Used in vanilla for log stripping, dirt path flattening, tilling, etc. Actions include "shovel_flatten", "axe_strip", "axe_scrape", "axe_wax_off" and "till" (for the hoe).
- Provides the relevant itemstack, the hand being used, the block being clicked, and the face of the block being clicked. Is cancelable.
- Player right-clicks with item (advanced)
- A modified version of the 'player right-clicks with item' trigger that doesn't test for which hand the player is using when they interact with a block, which is necessary to get around some bugs with Mojang's spaghetti programming for tool interactions.
- Provides the relevant itemstack and the hand being used. Is cancelable.
- Player right-clicks entity (advanced)
- Called first for the player's mainhand. If (and only if) the mainhand is empty, the procedure is called again for the offhand.
- Provides the relevant itemstack and the hand being used. Is cancelable.
- Entity changes attack target
- Doesn't properly retrieve the 'original' attack target, but unlike the 'entity sets attack target' trigger it is cancellable.
- Projectile hits object
- Called whenever a projectile hits a block or an entity.
- Provides the projectile and source entity, the projectile position (x, y, z), the (more accurate) raytrace target position (hx, hy, hz), the hit result ("block", "entity" or "miss").
- The 'raytrace target position' is the exact edge of the block the projectile hits, or the exact position of the entity the projectile hits.
- I'm not sure what conditions return the "miss" hit result. Projectiles that are deflected by invulnerable enemies (e.g. the wither in phase 2), those that hit a blocking player or those that miss an enderman still return the "entity" hit result.
- Does not provide the block or entity that are hit, although those can be extrapolated fairly easily.
- Entity effect added / tried / expires / removed
- Called for entity potion effects. Provides the effect type as a string, as well as its level and duration.
- The 'tried' and 'removed' procedures are cancelable.
- Fluid tries to create source
- Enderman tries to teleport
- Called every time an enderman tries to teleport, including any failed attempts, of which there are usually several for each successful teleport. Cancelable.
- Entity drops item
- Called when an entity drops its loot table or held equipment. Limited functionality. Provides the list of dropped item entities in string format.
- Arrow is nocked
- Explosion begins
- Called when an explosion is going to occur. Cancelable. Provides the explosion damagesource, whether the explosion damages blocks, and the entity (if applicable) and the sourceentity (if applicable).
- Canceling an explosion does not prevent the explosion effects from being shown.
- Explosion finalizes
- Called when an explosion finalizes. Not cancelable. Provides the same dependencies as the 'explosion begins' trigger as well as a string list of affected block positions.
- Entity spawns (advanced)
- Called when the game tries to spawn an entity via the mob spawn cycle or from chunk generation.
- Provides the spawn position (rounded down), the entity type as a string, as well as the spawn type (not to be confused with the 'forge:spawn_type' tag. See this page I wrote for more information).
- Spawn types that have been confirmed to occur include 'natural', 'chunk_generation' and 'spawner'. Spawn types that have been confirmed not to occur include null (empty) spawn types, 'structure', 'dispenser', 'spawn egg', silverfish that spawn from infested blocks, animals that result from breeding, and others.
1 New Placement Feature
- Is water at current position
- A small shortcut to check for water.
Support for languages other than English currently isn't planned, since I don't know any other languages and I make frequent changes to the plugin texts.
This plugin is currently only tested for versions of MCreator later than MCreator 2023.4 but should work for earlier versions. Additionally, I've only developed the plugin for Forge 1.20.1, so there may be issues on the other supported generator types.
The latest version of this plugin supports the following generators: Forge 1.16.5, Forge 1.18.2, Forge 1.19.4, Forge 1.20.1, NeoForge 1.20.4, NeoForge 1.20.6, and NeoForge 1.21.1. Support for versions of the Fabric generator is not planned due to its use of a different coding language, which would be quite time-consuming to translate.
-
Changelog:
v1.0.0 - Initial release. Adds 21 new procedures, 7 new triggers.
v1.0.1 - Minor bugfixes.
v1.1.0 - Added tooltips (show by hovering the cursor over the procedure blocks) and 17 new procedures (from 21 to 38).
v1.2.0 - Added 25 new procedures (from 38 to 63).
v1.3.0 - Added more features to the "projectile hits object" trigger and added 14 new procedures (from 63 to 77).
v1.4.0 - Added 19 new procedures (from 77 to 96), 7 new triggers (from 7 to 14) and 1 new placement feature (from 0 to 1). Added basic support for earlier forge versions.
v1.4.1 - Added support for MCreator 2024.1.
v1.5.0 - Added 14 new procedures (from 96 to 110), 3 new triggers (from 14 to 17) and added basic support for Neoforge.
v1.5.1 - Added support for MCreator 2024.2.
v1.5.2 - Added support for MCreator 2024.3 and neoforge 1.21.1.
v1.5.3 - Added support for MCreator 2024.4.
v1.6.0 - (version skipped due to upload error)
v1.6.1 - Added 2 new procedures (from 110 to 112), 3 new triggers (from 17 to 20) and new dependencies for the right-click triggers. Also added support for Forge 1.19.2.
v1.7.0 - Added 15 new procedures (from 112 to 127) and 3 new triggers (from 20 to 23). Minor fixes.
v1.7.1 - Minor fixes. Removed one event trigger (from 23 to 22) because it wasn't working.
v1.8.0 - Added 18 new procedures (from 127 to 145) and 3 new triggers (from 22 to 25). Minor fixes and improvements.
The plugin download is available below. I hope you guys find it useful. If you have issues, post them in the comments or contact me via discord under the username 'snailsattack'.
Comments
New update, 1.7.0 is pretty huge; this is now the first plugin I'm aware of with some really powerful tools for detecting keystrokes. Provides procedures that trigger universally when the client presses keys. You can specify and detect almost any pressed key, keybind and even the modifier keys. The procedures also seem to be easy to register on serverside as well.
THANK YOU SO MUCH, your the best creator seriously this helped me so much and i'm glad i can now use it to full capabilities! I didn't think you would go around and update it for 1.19.2 but you did and it is awesome, it helped me so much that i can't have mcreator without snail's procedures!
Regarding several questions about the elytra procedures,
I did not program them, they're method blocks created by Mojang. All this plugin does is make them accessible. I've documented these procedures when possible, but they often behave in unexpected and limited ways that you'll have to figure out on your own.
Would it be possible to make an entity that both flies and walks around with this plugin? Like using the "Set entity on ground" procedure?