2016-03-16 17:49:28 +03:00
|
|
|
package emt.util;
|
2015-12-06 19:47:41 +03:00
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
|
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
|
|
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
|
|
|
|
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
|
|
|
|
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
2016-03-16 17:49:28 +03:00
|
|
|
import emt.ElectroMagicTools;
|
|
|
|
|
import emt.ModInformation;
|
|
|
|
|
import emt.client.EMTKeys;
|
2016-03-17 18:25:51 +03:00
|
|
|
import emt.init.EMTItems;
|
2016-03-16 17:49:28 +03:00
|
|
|
import emt.network.PacketEMTKeys;
|
|
|
|
|
import emt.proxy.ClientProxy;
|
2015-12-06 19:47:41 +03:00
|
|
|
import net.minecraft.entity.item.EntityItem;
|
|
|
|
|
import net.minecraft.entity.monster.EntityCreeper;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|
|
|
|
import thaumcraft.common.entities.monster.EntityTaintChicken;
|
|
|
|
|
|
|
|
|
|
public class EMTEventHandler {
|
|
|
|
|
Random rnd = new Random();
|
|
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
|
public void onEntityLivingDrops(LivingDropsEvent event) {
|
|
|
|
|
if (event.entityLiving instanceof EntityCreeper) {
|
|
|
|
|
EntityCreeper creeper = (EntityCreeper) event.entityLiving;
|
|
|
|
|
if (creeper.getPowered()) {
|
2016-03-17 18:25:51 +03:00
|
|
|
event.entityLiving.entityDropItem(new ItemStack(EMTItems.itemEMTItems, 1, 6), 1);
|
2015-12-06 19:47:41 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (event.entityLiving instanceof EntityTaintChicken) {
|
2016-03-17 18:25:51 +03:00
|
|
|
event.entityLiving.entityDropItem(new ItemStack(EMTItems.itemEMTItems, rnd.nextInt(3), 13), 1);
|
2015-12-06 19:47:41 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
|
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
2016-04-10 13:45:07 +03:00
|
|
|
if (event.modID.equals(ModInformation.MODID)) {
|
2015-12-14 21:29:29 +03:00
|
|
|
EMTConfigHandler.syncConfig();
|
2016-04-10 13:45:07 +03:00
|
|
|
ElectroMagicTools.LOGGER.info("Refreshing configuration file.");
|
2015-12-06 19:47:41 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|