Snails' Plugin (1.20.1)

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

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

77 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'
  • 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 creepy entity
    • Spider entity get/set climbing
    • 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.)
  • 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.
    • 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.
    • Get total XP points
    • Get 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.
  • World procedures
    • 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.
    • Get blocklight / skylight level at XYZ
       

7 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 provided the block or entity that are hit, although those can be extrapolated fairly easily.

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 other versions. However, the plugin will definitely only work for forge 1.20.1 unless you manually edit the files; this should be fairly easy to do, but I probably won't add standard support for earlier versions or other generator types.

-

v1.0.0 - Initial release. 21 new procedures, 7 new triggers.

v1.0.1 - Minor bug fixes.

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

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.1.0.zip - Available for forge 1.20.1 only - SnailsPlugin-1.1.0_1.zipUploaded on: 02/01/2024 - 19:29   File size: 34.87 KB
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

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.