Now mobs can't see you, if you equipped ONE RING

This commit is contained in:
fewizz committed 2016-05-23 16:58:12 +03:00
1 parent 8ee577a958
commit 2c7c28bbc3
59 files changed
+488 -481

No files matched your search

+24 -4
View File
@@ -2,22 +2,26 @@ package emt.util;
import java.util.Random;
import baubles.api.BaublesApi;
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;
import emt.ElectroMagicTools;
import emt.ModInformation;
import emt.EMT;
import emt.client.EMTKeys;
import emt.init.EMTItems;
import emt.network.PacketEMTKeys;
import emt.proxy.ClientProxy;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import thaumcraft.common.entities.monster.EntityTaintChicken;
public class EMTEventHandler {
@@ -38,9 +42,25 @@ public class EMTEventHandler {
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.modID.equals(ModInformation.MODID)) {
if (event.modID.equals(EMT.MOD_ID)) {
EMTConfigHandler.syncConfig();
ElectroMagicTools.LOGGER.info("Refreshing configuration file.");
EMT.LOGGER.info("Refreshing configuration file.");
}
}
@SubscribeEvent
public void onSetEntityAttack(LivingSetAttackTargetEvent e) {
if (e.entityLiving != null && e.target != null && e.entityLiving instanceof EntityLiving && e.target instanceof EntityPlayer) {
IInventory inventory = BaublesApi.getBaubles((EntityPlayer) e.target);
for(int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack stack = inventory.getStackInSlot(i);
if(stack != null && stack.getItem() == EMTItems.onering) {
((EntityLiving)e.entityLiving).setAttackTarget(null);
}
}
}
}
}