2016-02-15 15:01:03 -08:00
|
|
|
package WayofTime.bloodmagic.util.handler;
|
|
|
|
|
2016-03-17 13:00:44 -07:00
|
|
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
|
|
|
import WayofTime.bloodmagic.util.Utils;
|
2016-02-15 15:01:03 -08:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
|
|
|
2016-03-16 18:41:06 -04:00
|
|
|
public class IMCHandler
|
|
|
|
{
|
2016-02-15 15:01:03 -08:00
|
|
|
|
2016-03-16 18:41:06 -04:00
|
|
|
public static void handleIMC(FMLInterModComms.IMCEvent event)
|
|
|
|
{
|
|
|
|
for (FMLInterModComms.IMCMessage message : event.getMessages())
|
|
|
|
{
|
2016-02-15 15:01:03 -08:00
|
|
|
if (message.key.equals("teleposerBlacklist") && message.isItemStackMessage())
|
|
|
|
{
|
|
|
|
ItemStack stack = message.getItemStackValue();
|
|
|
|
if (stack.getItem() instanceof ItemBlock)
|
|
|
|
{
|
|
|
|
Block block = Block.getBlockFromItem(stack.getItem());
|
|
|
|
BloodMagicAPI.addToTeleposerBlacklist(block, stack.getItemDamage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (message.key.equals("sacrificeValue") && message.isStringMessage())
|
|
|
|
{
|
|
|
|
String[] splitInfo = message.getStringValue().split(";");
|
|
|
|
if (splitInfo.length == 2 && Utils.isInteger(splitInfo[1]))
|
|
|
|
BloodMagicAPI.setEntitySacrificeValue(splitInfo[0], Integer.parseInt(splitInfo[1]));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (message.key.equals("greenGroveBlacklist") && message.isStringMessage())
|
|
|
|
{
|
|
|
|
String[] splitInfo = message.getStringValue().split(":");
|
|
|
|
if (splitInfo.length == 2)
|
|
|
|
{
|
|
|
|
Block block = GameRegistry.findBlock(splitInfo[0], splitInfo[1]);
|
|
|
|
if (block != null)
|
|
|
|
BloodMagicAPI.blacklistFromGreenGrove(block);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|