Snails' Plugin (1.20.1)

Supported MCreator versions
EAP 2023.4.49117
Tags / plugin type
Procedures
Decorative plugin icon.
Downloads:
992
Upvotes: 13
About the plugin

I developed this plugin to add more procedure blocks and event triggers not found in other plugins.

96 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
  • 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 text Y
      • A more compact method of concatenating a string. Only works for local variables.
  • 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 / is empty-handed
      • Compact version of testing for the item in each of the entity's hands.
    • 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
    • Is entity pathfinding to attack target
  • Player procedures
    • Get FPS / FOV / FOV Effect Scale of current instance of Minecraft
    • 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, sadly.
    • 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.
  • Item procedures
    • Does item exist
      • A more compact, intuitive test for whether an item is valid or 'air'.
  • Block procedures
    • Does provided block exist
      • A more compact, intuitive test for whether a block is valid or an air block.
    • Does provided block drop XP
    • 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.
  • World procedures
    • Get blocklight / skylight level at XYZ
    • 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 as string
    • Get world seed number
    • Crash current instance of Minecraft
      • 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.
  • Organizational procedures
    • Decorative procedure labels (red, green, blue and white)
      • A label with a text display. Purely decorative. Found in the 'flow control' tab.
    • Decorative procedure labels (red, green, blue and white) with arguments and a checkbox
      • The procedure arguments are ignored unless the checkbox is ticked, allowing procedure blocks to be easily toggle during testing.

         

14 New Event Triggers

  • Entity leaves 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.
  • Block is placed (non-attributable)
    • 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 (unrestricted)
    • A modified version of the 'player right-clicks block' trigger that doesn't test for which hand the player is using when they interact with a block.
    • Called twice per right-click, once for each hand, unless the block is interactable in which case it's called only for the player's main hand.
    • Necessary to get around some bugs with Mojang's spaghetti programming for tool interactions (e.g. axe stripping and shovel flattening).
  • 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 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.

1 New Placement Feature

  • Is water at current position
    • A small shortcut to check for water.

Note that there are some brevity/clarity tweaks to the base MCreator localizations included in the plugin's lang file, which you can remove manually if you'd like.

I probably won't do support for languages besides English, since I don't know any, and I make frequent changes to the plugin texts. 

Also, if Klemen's reading this I'd be happy to collaborate on official MCreator support for these procedures.

-

This plugin is currently only tested for MCreator 2023.4 but should work for earlier versions.

-

v1.0.0 - Initial release. 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 19), 7 new triggers (from 7 to 14) and 1 new placement feature (from 0 to 1). Added basic support for earlier forge versions.

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'.

License
Creative Commons Attribution-NonCommercial 3.0

Plugin downloads
SnailsPlugin-1.2.0.zip - Available for forge 1.20.1 only - SnailsPlugin-1.2.0.zipUploaded on: 02/07/2024 - 21:22   File size: 52 KB
SnailsPlugin-1.3.0.zip - Available for forge 1.20.1 only - SnailsPlugin-1.3.0.zipUploaded on: 02/15/2024 - 01:51   File size: 62.67 KB
SnailsPlugin-1.4.0.zip - Available for forge 1.20.1 with attempted support for forge 1.19.4, 1.18.2 and 1.16.5 - SnailsPlugin-1.4.0.zipUploaded on: 05/04/2024 - 21:38   File size: 185.67 KB

Comments

I seem to be having an issue in 1.3.0 that when I open a procedure for the first time it opens fine but any after that are blank. The issue is resolved when I remove your plugin. Feel free to DM me if you need any more info

Really need 2024.1 verison to contiune working on my mod as it uses Model layers, but theres a bug with them that was fixed in 2024.1 but i cannot use the plugin in 2024.1 because it was not updated for that verison so am stuck on the verison that has the model layer bug

This totally worked for me. Some of the procedures like the check in sight between two entities didn't work. But the one I needed (Set on ground to true/false) did work. I couldn't use version 1.30 though and the "Minecraft Components" tab is completely broken. I am on forge 1.18.2, MCreator 2023.2.

version 1.3.0 (released just now) has some pretty cool stuff, including procedures to get the player's framerate and field of view, as well as text blocks with regex support

will you ever make these plugins work for older versions, because it seems like it would be infinitely useful in other versions as well

probably not, because maintaining multiple versions of this plugin would take considerable effort. I'd suggest modifying the plugin yourself; you could start with trying to rename the 'forge-1.20.1' folder to whatever version you're using.

When using the newest version of the plugin, if i try to make a procedure using the (get pincushion arrows) and [set pincushion arrows] blocks, MCreator says there is an error with the procedure when i try to save it, even though there are 0 warnings or errors in the procedure.