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
Modifier and TypeFieldDescriptionprivate final byte[]
The field for theadditionalData
record component.private final MenuType
<?> The field for themenuType
record component.private final Component
The field for thename
record component.static final StreamCodec
<RegistryFriendlyByteBuf, AdvancedOpenScreenPayload> static final CustomPacketPayload.Type
<AdvancedOpenScreenPayload> private final int
The field for thewindowId
record component. -
Constructor Summary
ConstructorDescriptionAdvancedOpenScreenPayload
(int windowId, MenuType<?> menuType, Component name, byte[] additionalData) Creates an instance of aAdvancedOpenScreenPayload
record class. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the value of theadditionalData
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.MenuType
<?> menuType()
Returns the value of themenuType
record component.name()
Returns the value of thename
record component.final String
toString()
Returns a string representation of this record class.type()
int
windowId()
Returns the value of thewindowId
record component.
-
Field Details
-
windowId
private final int windowIdThe field for thewindowId
record component. -
name
The field for thename
record component. -
additionalData
private final byte[] additionalDataThe field for theadditionalData
record component. -
TYPE
-
STREAM_CODEC
-
-
Constructor Details
-
AdvancedOpenScreenPayload
public AdvancedOpenScreenPayload(int windowId, MenuType<?> menuType, Component name, byte[] additionalData) Creates an instance of aAdvancedOpenScreenPayload
record class.- Parameters:
windowId
- the value for thewindowId
record componentmenuType
- the value for themenuType
record componentname
- the value for thename
record componentadditionalData
- the value for theadditionalData
record component
-
-
Method Details
-
type
- Specified by:
type
in 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 thewindowId
record component.- Returns:
- the value of the
windowId
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
additionalData
public byte[] additionalData()Returns the value of theadditionalData
record component.- Returns:
- the value of the
additionalData
record component
-