Record Class NegotiationResult
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.negotiation.NegotiationResult
- Record Components:
components- The successfully negotiated components. Is empty whensuccess()is false.success- Whether the negotiation was successful.failureReasons- The reasons for the failure of the negotiation. Is empty whensuccess()is true.
@Internal
public record NegotiationResult(List<NegotiatedNetworkComponent> components, boolean success, Map<ResourceLocation,Component> failureReasons)
extends Record
Represents the result of a negotiation of network components.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<NegotiatedNetworkComponent> The field for thecomponentsrecord component.private final Map<ResourceLocation, Component> The field for thefailureReasonsrecord component.private final booleanThe field for thesuccessrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionNegotiationResult(List<NegotiatedNetworkComponent> components, boolean success, Map<ResourceLocation, Component> failureReasons) Creates an instance of aNegotiationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponentsrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefailureReasonsrecord component.final inthashCode()Returns a hash code value for this object.booleansuccess()Returns the value of thesuccessrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
components
The field for thecomponentsrecord component. -
success
private final boolean successThe field for thesuccessrecord component. -
failureReasons
The field for thefailureReasonsrecord component.
-
-
Constructor Details
-
NegotiationResult
public NegotiationResult(List<NegotiatedNetworkComponent> components, boolean success, Map<ResourceLocation, Component> failureReasons) Creates an instance of aNegotiationResultrecord class.- Parameters:
components- the value for thecomponentsrecord componentsuccess- the value for thesuccessrecord componentfailureReasons- the value for thefailureReasonsrecord component
-
-
Method Details
-
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 '=='. -
components
Returns the value of thecomponentsrecord component.- Returns:
- the value of the
componentsrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
failureReasons
Returns the value of thefailureReasonsrecord component.- Returns:
- the value of the
failureReasonsrecord component
-