How to get target TileEntity from ChangeBlockEvent.Break?

There isn’t a mutable SignData that you can get. It is a block snapshot.

ImmutableSignData data = trans.getOriginal().get(ImmutableSignData.class).get();
ImmutableSignData data = trans.getOriginal().getOrCreate(ImmutableSignData.class).get();

Those should both work, with the latter creating a new ImmutableDataManipulator if one doesn’t already exist.

Sorry. I didn’t realize that you can only get immutable data from an immutable data holder. @Azat The previous code was correct; it’s a bug in Sponge.

@gravityfox, this code not work: No value present

And that’s the Sponge Bug.

That code IS SUPPOSED TO WORK.

It just doesn’t.

Wait a day or two for the devs to get around to fixing that.

I open github issue.

I’ve fixed it now
https://github.com/SpongePowered/SpongeCommon/commit/92db8eba25d4e696232a65cbd5023647963c0d16

trans.getOriginal().get(ImmutableSignData.class); should now work

1 Like