Package net.minecraftforge.fml
Record Class IExtensionPoint.DisplayTest
java.lang.Object
java.lang.Record
net.minecraftforge.fml.IExtensionPoint.DisplayTest
- All Implemented Interfaces:
IExtensionPoint<IExtensionPoint.DisplayTest>
- Enclosing interface:
- IExtensionPoint<T extends Record>
public static record IExtensionPoint.DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String,Boolean> remoteVersionTest)
extends Record
implements IExtensionPoint<IExtensionPoint.DisplayTest>
Compatibility display test for the mod.
Used for displaying compatibility with remote servers with the same mod, and on disk saves.
The supplier provides my "local" version for sending across the impl or writing to disk
The predicate tests the version from a remote instance or save for acceptability (Boolean is true for impl, false for local save)
and returns true if the version is compatible.
Return net.minecraftforge.network.NetworkConstants#IGNORESERVERONLY in the supplier, if you wish to be ignored
as a server side only mod.
Return true in the predicate for all values of the input string (when impl boolean is true) if you are client side, and don't care about matching any potential server version.
Examples: A server only mod
registerExtensionPoint(DisplayTest.class, ()->new DisplayTest(
()->NetworkConstants.IGNORESERVERONLY, // ignore me, I'm a server only mod
(s,b)->true // i accept anything from the server or the save, if I'm asked
)
Examples: A client only mod
registerExtensionPoint(DisplayTest.class, ()->new DisplayTest(
()->"anything. i don't care", // if i'm actually on the server, this string is sent but i'm a client only mod, so it won't be
(remoteversionstring,networkbool)->networkbool // i accept anything from the server, by returning true if it's asking about the server
)
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraftforge.fml.IExtensionPoint
IExtensionPoint.DisplayTest -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiPredicate<String,Boolean> The field for theremoteVersionTestrecord component.The field for thesuppliedVersionrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) Creates an instance of aDisplayTestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theremoteVersionTestrecord component.Returns the value of thesuppliedVersionrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
suppliedVersion
The field for thesuppliedVersionrecord component. -
remoteVersionTest
The field for theremoteVersionTestrecord component.
-
-
Constructor Details
-
DisplayTest
Creates an instance of aDisplayTestrecord class.- Parameters:
suppliedVersion- the value for thesuppliedVersionrecord componentremoteVersionTest- the value for theremoteVersionTestrecord 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. All components in this record class are compared withObjects::equals(Object,Object). -
suppliedVersion
Returns the value of thesuppliedVersionrecord component.- Returns:
- the value of the
suppliedVersionrecord component
-
remoteVersionTest
Returns the value of theremoteVersionTestrecord component.- Returns:
- the value of the
remoteVersionTestrecord component
-