cpw.mods.fml.common.event.FMLInterModComms.IMCEvent Java Examples

The following examples show how to use cpw.mods.fml.common.event.FMLInterModComms.IMCEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdvancedMod.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public void onIMCMessages(IMCEvent event){
    Log.info("Receiving IMC");
    for(IMCMessage message : event.getMessages()) {
        if(message.key.equalsIgnoreCase("camoMineBlacklist")) {
            if(message.isItemStackMessage()) {
                ItemStack blacklistedStack = message.getItemStackValue();
                if(blacklistedStack.getItem() != null) {
                    TileEntityCamoMine.camouflageBlacklist.add(blacklistedStack);
                    Log.info(String.format("Mod %s added %s to be blacklisted as camouflage for the Camo Mine", message.getSender(), blacklistedStack.toString()));
                } else {
                    throw new IllegalStateException(String.format("ItemStack tried to be used in registry by the mod %s has a null item.", message.getSender()));
                }
            } else {
                Log.warn(String.format("Mod %s sent a non-ItemStack message, where an ItemStack message was expected.", message.getSender()));
            }
        } else {
            Log.warn(String.format("Mod %s used an invalid IMC key: %s", message.getSender(), message.key));
        }
    }
}
 
Example #2
Source File: EtFuturum.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@EventHandler
public void processIMCRequests(IMCEvent event) {
	for (IMCMessage message : event.getMessages())
		if (message.key.equals("register-brewing-fuel")) {
			NBTTagCompound nbt = message.getNBTValue();
			ItemStack stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("Fuel"));
			int brews = nbt.getInteger("Brews");
			BrewingFuelRegistry.registerFuel(stack, brews);
		}
}
 
Example #3
Source File: LookingGlass.java    From LookingGlass with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler
public void handleIMC(IMCEvent event) {
	// Catch IMC messages and send them off to our IMC handler
	ImmutableList<IMCMessage> messages = event.getMessages();
	IMCHandler.process(messages);
}
 
Example #4
Source File: Chisel.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@EventHandler
public void onIMC(IMCEvent event) {
	for (IMCMessage msg : event.getMessages()) {
		IMCHandler.INSTANCE.handleMessage(msg);
	}
}