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
Modifier and TypeFieldDescriptionprivate final BiPredicate<String,
Boolean> The field for theremoteVersionTest
record component.The field for thesuppliedVersion
record component. -
Constructor Summary
ConstructorDescriptionDisplayTest
(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) Creates an instance of aDisplayTest
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of theremoteVersionTest
record component.Returns the value of thesuppliedVersion
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
suppliedVersion
The field for thesuppliedVersion
record component. -
remoteVersionTest
The field for theremoteVersionTest
record component.
-
-
Constructor Details
-
DisplayTest
Creates an instance of aDisplayTest
record class.- Parameters:
suppliedVersion
- the value for thesuppliedVersion
record componentremoteVersionTest
- the value for theremoteVersionTest
record 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 thesuppliedVersion
record component.- Returns:
- the value of the
suppliedVersion
record component
-
remoteVersionTest
Returns the value of theremoteVersionTest
record component.- Returns:
- the value of the
remoteVersionTest
record component
-