Snails' Plugin (1.20.1)

Supported MCreator versions
2023.4
2024.1
2024.2
Tags / plugin type
Procedures
Decorative plugin icon.
Downloads:
3675
Upvotes: 33
About the plugin

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

110 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 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
    • Does entity have damage immunity frames remaining
    • Get entity's remaining damage immunity ticks
    • 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 umber 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
    • Does entity exist
      • A more compact, intuitive test for whether an entity exists (aka whether an entity is 'null'.
  • 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'.
    • Get bonus damage from enchants on an enchanted item against a specified entity
  • 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 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.
  • 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.

         

17 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.
  • Arrow is nocked
  • Player uses tool secondary action on block
  • Player right clicks with item (unrestricted)
    • 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.
    • Necessary to get around some bugs with Mojang's spaghetti programming for tool interactions.

1 New Placement Feature

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

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. 

I would be happy to collaborate on official MCreator support for these procedures.

-

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

Fabric support is not planned due to its entirely different coding language.

-

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

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.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.zip Uploaded on: 05/04/2024 - 21:38   File size: 185.67 KB
SnailsPlugin-1.5.0.zip - Available for forge 1.20.1, 1.19.4, 1.18.2 and 1.16.5 and neoforge 1.20.4 and 1.20.6 - SnailsPlugin-1.5.0.zip Uploaded on: 07/29/2024 - 09:25   File size: 294.29 KB
SnailsPlugin-1.5.1.zip - Now supports MCreator 2024.2. - SnailsPlugin-1.5.1.zip Uploaded on: 09/19/2024 - 23:29   File size: 295.75 KB
SnailsPlugin-1.5.2.zip - Now supports MCreator 2024.3 and neoforge 1.21.1. - SnailsPlugin-1.5.2.zip Uploaded on: 10/24/2024 - 06:12   File size: 337.13 KB

Comments

I think the Get world seed block doesn't work correctly. I'm trying to use it during world gen to make the world gen of my mod seed-based but it seems to return always 0.
Have you any idea of what may cause this?

Will this plugin have a neoforge port for 1.20.6 eventually?
There are alot of things in this that would help alot with my mod.

You could always add that support yourself for personal use by cloning the "forge-1.20.1" folder in the plugin, renaming it, and adding the necessary stuff into the plugin.json. I've done so and haven't ran into any issues so far. I don't recommend doing this for major version leaps though as it can cause problems if Mojang decides to deprecate stuff.

I'm on neoforge 1.20.4 on 2024.1 but the elytra procedures (start/stop elytra flying) are "not supported by the current generator"

Hey, i try to give an entity an effect when a player is looking at it but i cant get it to work, could u explain how to use the line of sight procedure? it just always gives me an error code that says:
Block entity_to_entity_raytrace is not supported by the selected generator

The 'line of sight' procedure returns true whenever there's a direct line of sight between the two entities' heads; the procedure doesn't consider what direction the entities are looking in, you'll have to program that yourself.

I got an error with the ray cast looking at player, I am using Mcreator 2023.2 with the 1.4.0 version:
https://jmp.sh/s/6JwhIHNLDwvy1SvdAMn6

From the error log, I think you're trying to raycast to a non-existent (null) entity. If either entity doesn't exist it'll crash the game, so you have to manually check before running the raycast procedure.