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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
CustomPacketPayload.FallbackProvider<B extends FriendlyByteBuf>, CustomPacketPayload.Type<T extends CustomPacketPayload>, CustomPacketPayload.TypeAndCodec<B extends FriendlyByteBuf,T extends CustomPacketPayload> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]The field for theadditionalDatarecord component.private final MenuType<?> The field for themenuTyperecord component.private final ComponentThe field for thenamerecord component.static final StreamCodec<RegistryFriendlyByteBuf, AdvancedOpenScreenPayload> static final CustomPacketPayload.Type<AdvancedOpenScreenPayload> private final intThe field for thewindowIdrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionAdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, byte[] additionalData) Creates an instance of aAdvancedOpenScreenPayloadrecord class. -
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.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.type()intwindowId()Returns the value of thewindowIdrecord component.
-
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. -
TYPE
-
STREAM_CODEC
-
-
Constructor Details
-
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
-
type
- Specified by:
typein 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
-