-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Open container from type & some fixes #2504
base: api-11
Are you sure you want to change the base?
Conversation
@@ -64,7 +64,7 @@ public interface Chest extends NameableCarrierBlockEntity { | |||
* @return The attachment type of this chest. | |||
*/ | |||
default Value.Mutable<ChestAttachmentType> attachmentType() { | |||
return this.requireValue(Keys.CHEST_ATTACHMENT_TYPE).asMutable(); | |||
return this.block().requireValue(Keys.CHEST_ATTACHMENT_TYPE).asMutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is subtle, but why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Keys.CHEST_ATTACHMENT_TYPE
is registered for BlockState
, not BlockEntity
. And currently this method simply throw an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we have code (SpongeDataHolder#impl$delegateDataHolder
) that could make this work on BlockEntity too.
e.g.
https://github.com/SpongePowered/Sponge/blob/api-12/src/main/java/org/spongepowered/common/world/server/SpongeServerLocation.java#L280
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's cool. I guess it would be better to use this method then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted change in Chest
file, in impl made BlockEntity
delegate DataHolder
to its #block()
and #block().type()
.
Also reverted Container#type()
change since it's breaking (and in api-12 Faithcaio fixed this).
SpongeAPI | Sponge