Skip to content
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

Block physics event bug #1825

Closed
The-Mr-Mango opened this issue Oct 28, 2018 · 1 comment
Closed

Block physics event bug #1825

The-Mr-Mango opened this issue Oct 28, 2018 · 1 comment

Comments

@The-Mr-Mango
Copy link

The-Mr-Mango commented Oct 28, 2018

The output of /version on my server is: This server is running CraftBukkit version git-Spigot-f6a273b-db10914 (MC: 1.13.1) (Implementing API version 1.13.1-R0.1-SNAPSHOT)

The output of /version denizen on my server is: Denizen version 1.0.3-SNAPSHOT (build 446-DEV)

(If relevant) A link to a paste of a script demonstrating the issue: https://one.denizenscript.com/paste/50444
(This script returns m@cactus when a cactus breaks by updating it: https://one.denizenscript.com/paste/50445)

"/denizen debug -r" outcome:
http://old.mcmonkey.org/paste/50447

The issue is:
<context.new_material> does not return the expected outcome. When blocks break because of block updates (like sugar cane, cacti or chorus plants) <context.new_material> returns the block it was before it updated. (I hope I got this right, sometimes I overlook obvious mistakes in my own code).

@The-Mr-Mango The-Mr-Mango changed the title Block physics event but Block physics event bug Oct 28, 2018
@mcmonkey4eva
Copy link
Member

Looking through relevant stuff...
Seems to be that new_material is a bit poorly labeled as a context value.
There isn't actually a value in the sourcing Spigot event (BlockPhysicsEvent) that will say 'air' when a cactus breaks if that context doesn't. The value used for new_material is a bit of a generic Material value that can be different things in different situations.

Depending on your preference, you might:

  • Check if <context.location.below.material.name> == air in the physics event, as if that's true it's likely the cactus is breaking from falling. You'd probably also want to listen to on player breaks cactus:
  • Or, - wait 1t then check if <context.location.material.name> == air as if that's true, the cactus broke. (Validating by waiting out past the end of the event and checking what happened).

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

No branches or pull requests

2 participants