Support ResLocations for IMC

This commit is contained in:
cpw 2016-04-02 12:19:27 -04:00
parent 4c8da35655
commit efcb9ee570
1 changed files with 33 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import com.google.common.base.Function;
import com.google.common.base.Optional;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
@ -131,6 +132,15 @@ public class FMLInterModComms {
{
return (String) value;
}
/**
* Get the ResourceLocation value from this message.
* @throws ClassCastException if this message doesn't contain a ResourceLocation value
* @return The string value
*/
public ResourceLocation getResourceLocationValue()
{
return (ResourceLocation) value;
}
/**
* Get the {@link NBTTagCompound} value from this message
@ -242,6 +252,18 @@ public class FMLInterModComms {
return enqueueStartupMessage(modId, new IMCMessage(key, value));
}
/**
* Send a startup time message
* @param modId The modid to send it to
* @param key The mod specific key
* @param value A ResourceLocation value
* @return if the message was enqueued successfully and will be processed during startup
*/
public static boolean sendMessage(String modId, String key, ResourceLocation value)
{
return enqueueStartupMessage(modId, new IMCMessage(key, value));
}
/**
* Send a startup time message
* @param modId The modid to send it to
@ -253,7 +275,6 @@ public class FMLInterModComms {
{
return enqueueStartupMessage(modId, new IMCMessage(key, value));
}
/**
* Send a startup time function message
* @param modId The modid to send it to
@ -303,6 +324,17 @@ public class FMLInterModComms {
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
}
/**
* Send a post-startup message
* @param sourceMod The mod sending the message
* @param modId The modid to send it to
* @param key The mod specific key
* @param value A string value
*/
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, ResourceLocation value)
{
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
}
/**
* Send a post-startup function message.
*