Skip to content

[WIP] Turtle events#522

Open
SquidDev wants to merge 2 commits intodan200:masterfrom
SquidDev-CC:feature/turtle-event
Open

[WIP] Turtle events#522
SquidDev wants to merge 2 commits intodan200:masterfrom
SquidDev-CC:feature/turtle-event

Conversation

@SquidDev
Copy link
Copy Markdown
Contributor

This makes most turtle actions fire an event describing the action. Other mods may then listen to the event, cancelling it or changing the behaviour. Examples of things which may be done:

  • Prevent turtles from attacking specific mobs or players.
  • Block turtles from sucking from inventories (but still allow sucking item entities).
  • Add additional data to .inspect*() methods.
  • Disable any turtle action.

Most of these serve little purpose in the main mod, but do allow for greater flexibility for other mods. Whilst this technically works as is, I'm marking "WIP" as I'd like to get some thoughts on the whole implementation. It may be that this whole system is overkill and we can build something much simpler but equally powerful.

I'd also like to flesh out the event system a little more. Potentially adding the following:

  • Support for refuelling from non-fuel sources (and blocking from existing ones).
  • Control over turtle animation/action speed (as mentioned in [Suggestion] Turtles get buffs when in range of (vanilla) beacons #276).
  • Add additional data to .getItemDetail() method.
  • Allow reading/writing ItemStack NBT (and turtle upgrade NBT) when equipping upgrades. This would allow items to preserve information when being equipped and unequipped.

The main aim of this is to allow for greater extensibility for other
mods. For instance, you can now prevent turtles placing dirt blocks, or
turning when on gravel.
Mostly intended for those people who don't like .inspect() or
.getItemDetail(), but could allow modpacks to block equipping upgrades,
placing blocks, etc...
@thatcraniumguy
Copy link
Copy Markdown

Can one of the admins verify this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants