Java Code Examples for net.minecraftforge.fml.common.eventhandler.EventPriority#HIGH
The following examples show how to use
net.minecraftforge.fml.common.eventhandler.EventPriority#HIGH .
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: ItemCyberlimb.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent(priority = EventPriority.HIGH) public void power(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); for (int i = 0; i < 4; i++) { ItemStack test = new ItemStack(this, 1, i); ItemStack installed = CyberwareAPI.getCyberware(e, test); if (e.ticksExisted % 20 == 0 && installed != null) { boolean used = CyberwareAPI.getCapability(e).usePower(installed, getPowerConsumption(installed)); CyberwareAPI.getCyberwareNBT(installed).setBoolean("active", used); } } }
Example 2
Source File: ItemCybereyes.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent(priority = EventPriority.HIGH) public void handleMissingEssentials(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); if (CyberwareAPI.isCyberwareInstalled(e, new ItemStack(this))) { if (e.ticksExisted % 20 == 0) { boolean powerUsed = CyberwareAPI.getCapability(e).usePower(new ItemStack(this), getPowerConsumption(null)); if (e.worldObj.isRemote && e == Minecraft.getMinecraft().thePlayer) { isBlind = !powerUsed; } } } else if (e.worldObj.isRemote && e == Minecraft.getMinecraft().thePlayer) { isBlind = false; } }
Example 3
Source File: SingleFluidBucketFillHandler.java From OpenModsLib with MIT License | 6 votes |
@SubscribeEvent(priority = EventPriority.HIGH) public void onBucketFill(FillBucketEvent evt) { if (evt.getResult() != Result.DEFAULT) return; if (evt.getEmptyBucket().getItem() != EMPTY_BUCKET) return; final RayTraceResult target = evt.getTarget(); if (target == null || target.typeOfHit != RayTraceResult.Type.BLOCK) return; final TileEntity te = evt.getWorld().getTileEntity(target.getBlockPos()); if (te == null) return; if (te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, target.sideHit)) { final IFluidHandler source = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, target.sideHit); final FluidStack drained = source.drain(containedFluid, false); if (containedFluid.isFluidStackIdentical(drained)) { source.drain(containedFluid, true); evt.setFilledBucket(filledBucket.copy()); evt.setResult(Result.ALLOW); } } }
Example 4
Source File: WorldGeneratorImpl.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.HIGH) public void onOreGenerate(OreGenEvent.GenerateMinable event) { EventType eventType = event.getType(); if (ConfigHolder.disableVanillaOres && ORE_EVENT_TYPES.contains(eventType)) { event.setResult(Result.DENY); } }
Example 5
Source File: AdvancedRocketry.java From AdvancedRocketry with MIT License | 5 votes |
@SubscribeEvent(priority=EventPriority.HIGH) public void registerEnchants(RegistryEvent.Register<Enchantment> evt) { //Enchantments AdvancedRocketryAPI.enchantmentSpaceProtection = new EnchantmentSpaceBreathing(); AdvancedRocketryAPI.enchantmentSpaceProtection.setRegistryName(new ResourceLocation("advancedrocketry:spacebreathing")); evt.getRegistry().register(AdvancedRocketryAPI.enchantmentSpaceProtection); }
Example 6
Source File: ItemSkinUpgrade.java From Cyberware with MIT License | 4 votes |
@SubscribeEvent(priority = EventPriority.HIGH) public void handleMissingEssentials(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); ItemStack test = new ItemStack(this, 1, 3); if (CyberwareAPI.isCyberwareInstalled(e, test)) { boolean last = lastImmuno(e); boolean powerUsed = e.ticksExisted % 20 == 0 ? CyberwareAPI.getCapability(e).usePower(test, getPowerConsumption(test)) : last; if (!powerUsed && e instanceof EntityPlayer && e.ticksExisted % 100 == 0 && !e.isPotionActive(CyberwareContent.neuropozyneEffect)) { e.attackEntityFrom(EssentialsMissingHandler.lowessence, 2F); } if (potions.containsKey(e.getEntityId())) { Collection<PotionEffect> potionsLastActive = potions.get(e.getEntityId()); Collection<PotionEffect> currentEffects = e.getActivePotionEffects(); for (PotionEffect cE : currentEffects) { if (cE.getPotion() == MobEffects.POISON || cE.getPotion() == MobEffects.HUNGER) { boolean found = false; for (PotionEffect lE : potionsLastActive) { if (lE.getPotion() == cE.getPotion() && lE.getAmplifier() == cE.getAmplifier()) { found = true; break; } } if (!found) { e.addPotionEffect(new PotionEffect(cE.getPotion(), (int) (cE.getDuration() * 1.8F), cE.getAmplifier(), cE.getIsAmbient(), cE.doesShowParticles())); } } } } potions.put(e.getEntityId(), e.getActivePotionEffects()); } else { lastImmuno.remove(e.getEntityId()); potions.remove(e.getEntityId()); } }