net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent Java Examples
The following examples show how to use
net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent.
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: VanishTracker.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public static void ai(LivingSetAttackTargetEvent event) { if (event.getEntityLiving() instanceof EntityPlayer) return; if (!(event.getEntityLiving() instanceof EntityLiving)) return; EntityLivingBase potentialPotion = ((EntityLiving) event.getEntityLiving()).getAttackTarget(); if (potentialPotion != null && isVanished(potentialPotion)) { ((EntityLiving) event.getEntityLiving()).setAttackTarget(null); } }
Example #2
Source File: EventHandlerPneumaticCraft.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
/** * Used by PneumaticHelmet * @param event */ @SubscribeEvent public void onMobTargetSet(LivingSetAttackTargetEvent event){ if(event.entity instanceof EntityCreature) { if(!event.entity.worldObj.isRemote) { NetworkHandler.sendToAllAround(new PacketSetMobTarget((EntityCreature)event.entity, event.target), new NetworkRegistry.TargetPoint(event.entity.worldObj.provider.dimensionId, event.entity.posX, event.entity.posY, event.entity.posZ, TileEntityConstants.PACKET_UPDATE_DISTANCE)); } else { warnPlayerIfNecessary(event); } } }
Example #3
Source File: EventHandlerPneumaticCraft.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) private void warnPlayerIfNecessary(LivingSetAttackTargetEvent event){ EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; if(event.target == player && (event.entityLiving instanceof EntityGolem || event.entityLiving instanceof EntityMob)) { ItemStack helmetStack = player.getCurrentArmor(3); if(helmetStack != null && helmetStack.getItem() == Itemss.pneumaticHelmet && ((IPressurizable)helmetStack.getItem()).getPressure(helmetStack) > 0 && ItemPneumaticArmor.getUpgrades(ItemMachineUpgrade.UPGRADE_ENTITY_TRACKER, helmetStack) > 0 && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + EntityTrackUpgradeHandler.UPGRADE_NAME).checked) { HUDHandler.instance().getSpecificRenderer(EntityTrackUpgradeHandler.class).warnIfNecessary(event.entityLiving); } } else { HUDHandler.instance().getSpecificRenderer(EntityTrackUpgradeHandler.class).removeTargetingEntity(event.entityLiving); } }
Example #4
Source File: EntityEvents.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public static void onLivingSetAttackTarget(LivingEntity entity, LivingEntity target) { MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(entity, target)); }