Play effect doesn't accept sub classes of the expected data type

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None

      Purple wool is the block I first noticed it with, but all MaterialData sub classes cannot be passed as data to World#playEffect(Location, Effect, T) when the effect is Effect.TILE_BREAK.

      I'm not 100% sure if the line number is correct but the method signature above is the method I am referring to in CraftWorld.
      I found this line 829 in CraftWorld and 382 in CraftPlayer

      Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
      

      The validation check is backwards, the expected effect data should be assignable from the given data's type:

      Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!");
      

            Assignee:
            Unassigned
            Reporter:
            MrBlobman
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: