public static final class FMLInterModComms.IMCMessage
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
isFunction |
java.lang.String |
key
This field, and
value are both at the mod's discretion |
private java.lang.String |
sender
This is the modid of the mod that sent you the message
|
private java.lang.Object |
value
This field, and
key are both at the mod's discretion |
Modifier | Constructor and Description |
---|---|
private |
IMCMessage(java.lang.String key,
java.lang.Object value) |
private |
IMCMessage(java.lang.String key,
java.lang.String value,
boolean isFunction) |
Modifier and Type | Method and Description |
---|---|
<T,V> java.util.Optional<java.util.function.Function<T,V>> |
getFunctionValue(java.lang.Class<T> functionFrom,
java.lang.Class<V> functionTo)
Get the
Function value from this message. |
ItemStack |
getItemStackValue()
Get the
ItemStack value from this message |
java.lang.Class<?> |
getMessageType()
Get the actual message class type
|
NBTTagCompound |
getNBTValue()
Get the
NBTTagCompound value from this message |
ResourceLocation |
getResourceLocationValue()
Get the ResourceLocation value from this message.
|
java.lang.String |
getSender()
Get the sending modId of this message.
|
java.lang.String |
getStringValue()
Get the string value from this message.
|
boolean |
isFunctionMessage()
Is this a
Function type message |
boolean |
isItemStackMessage()
Is this an
ItemStack type message |
boolean |
isNBTMessage()
Is this an
NBTTagCompound type message |
boolean |
isResourceLocationMessage()
Is this an
ResourceLocation type message |
boolean |
isStringMessage()
Is this a string type message
|
(package private) void |
setSender(ModContainer activeModContainer) |
java.lang.String |
toString() |
private final boolean isFunction
private java.lang.String sender
@Nonnull public final java.lang.String key
value
are both at the mod's discretion@Nonnull private final java.lang.Object value
key
are both at the mod's discretionprivate IMCMessage(@Nonnull java.lang.String key, @Nonnull java.lang.Object value)
private IMCMessage(@Nonnull java.lang.String key, @Nonnull java.lang.String value, boolean isFunction)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getSender()
void setSender(ModContainer activeModContainer)
public java.lang.String getStringValue()
java.lang.ClassCastException
- if this message doesn't contain a String valuepublic ResourceLocation getResourceLocationValue()
java.lang.ClassCastException
- if this message doesn't contain a ResourceLocation valuepublic NBTTagCompound getNBTValue()
NBTTagCompound
value from this messagejava.lang.ClassCastException
- if this message doesn't contain an NBT value@Nonnull public ItemStack getItemStackValue()
ItemStack
value from this messagejava.lang.ClassCastException
- if this message doesn't contain an Itemstack valuepublic <T,V> java.util.Optional<java.util.function.Function<T,V>> getFunctionValue(java.lang.Class<T> functionFrom, java.lang.Class<V> functionTo)
Function
value from this message. This will attempt to classload the function
supplied by the caller. The parameter classes are strictly to give a concrete generic function return value.T
- The argument typeV
- The result typefunctionFrom
- The type of the argument to the functionfunctionTo
- The type of the result of the functionpublic java.lang.Class<?> getMessageType()
public boolean isStringMessage()
public boolean isItemStackMessage()
ItemStack
type messagepublic boolean isNBTMessage()
NBTTagCompound
type messagepublic boolean isResourceLocationMessage()
ResourceLocation
type messagepublic boolean isFunctionMessage()
Function
type message