Open theboomer opened 7 years ago
Adding my comment from the channel:
It'll be because
LocatableBlock
isn't aDataHolder
, it's anImmutableDataHolder
I don't thinkImmutableDataHolder
is of typeDataHolder
, and the filter only checks forDataHolder
types: https://github.com/SpongePowered/SpongeCommon/blob/bleeding/src/main/java/org/spongepowered/common/event/filter/delegate/HasDataFilterDelegate.java#L56
This is indeed the case, @Has
and @Supports
only support DataHolder
s and ImmutableDataHolder
does not inherit DataHolder
- but the filters only use methods on the ValueContainer
which is common to the DataHolder
and ImmutableDataHolder
- should we change the filters to check for the ValueContainer
type, or is there some reason why they check for DataHolder
?
Yeah it should be changed to use ValueContainer
I was looking at the wrong get
method, it doesn't have get(Manipulator.class)
on the ValueContainer
which the filter needs - this is because mutable and immutable data holders use manipulators that extend from different classes. So scratch that part of what I said.
Asked to post this here by Zidane re: #spongedev chat.
The following logical event filter does not work: public void onPremove(ChangeBlockEvent.Pre event, @First @Has(PistonData.class) LocatableBlock lb) { with either @First or @Root as the error thrown is: Annotated type for data filter is not a DataHolder
and this seems to be because locatableblock is an immutable data holder, @Has only looks at mutable data holders ..
Full Error entry: https://pastebin.com/PJSz3Np6