New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Turtle events #522

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@SquidDev
Contributor

SquidDev commented Feb 16, 2018

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

SquidDev added some commits Feb 16, 2018

Add turtle events
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.
Add config options to disable various turtle actions
Mostly intended for those people who don't like .inspect() or
.getItemDetail(), but could allow modpacks to block equipping upgrades,
placing blocks, etc...
@thatcraniumguy

This comment has been minimized.

thatcraniumguy commented May 23, 2018

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