Record Class AdvancedOpenScreenPayload
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.payload.AdvancedOpenScreenPayload
- Record Components:
windowId- The window ID to use for the screen.- The menu type to open.name- The name of the screen.additionalData- The additional data to pass to the screen.
- All Implemented Interfaces:
CustomPacketPayload
@Internal
public record AdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, byte[] additionalData)
extends Record
implements CustomPacketPayload
A custom payload that allows for opening screens with additional data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]The field for theadditionalDatarecord component.static final ResourceLocationprivate final MenuType<?>The field for themenuTyperecord component.private final ComponentThe field for thenamerecord component.private final intThe field for thewindowIdrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionAdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, byte[] additionalData) Creates an instance of aAdvancedOpenScreenPayloadrecord class.AdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, Consumer<FriendlyByteBuf> dataWriter) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns the value of theadditionalDatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()MenuType<?>menuType()Returns the value of themenuTyperecord component.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.intwindowId()Returns the value of thewindowIdrecord component.voidwrite(FriendlyByteBuf buffer)
-
Field Details
-
windowId
private final int windowIdThe field for thewindowIdrecord component. -
name
The field for thenamerecord component. -
additionalData
private final byte[] additionalDataThe field for theadditionalDatarecord component. -
ID
-
-
Constructor Details
-
AdvancedOpenScreenPayload
public AdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, Consumer<FriendlyByteBuf> dataWriter) -
AdvancedOpenScreenPayload
-
AdvancedOpenScreenPayload
public AdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, byte[] additionalData) Creates an instance of aAdvancedOpenScreenPayloadrecord class.- Parameters:
windowId- the value for thewindowIdrecord componentmenuType- the value for themenuTyperecord componentname- the value for thenamerecord componentadditionalData- the value for theadditionalDatarecord component
-
-
Method Details
-
write
- Specified by:
writein interfaceCustomPacketPayload
-
id
- Specified by:
idin interfaceCustomPacketPayload
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
windowId
public int windowId()Returns the value of thewindowIdrecord component.- Returns:
- the value of the
windowIdrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
additionalData
public byte[] additionalData()Returns the value of theadditionalDatarecord component.- Returns:
- the value of the
additionalDatarecord component
-