net.minecraft.item.EnumAction Java Examples
The following examples show how to use
net.minecraft.item.EnumAction.
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: ItemLowerOrgansUpgrade.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleEatFoodTick(LivingEntityUseItemEvent.Tick event) { EntityLivingBase e = event.getEntityLiving(); ItemStack stack = event.getItem(); if (e instanceof EntityPlayer && CyberwareAPI.hasCapability(e) && stack != null && (stack.getItem().getItemUseAction(stack) == EnumAction.EAT || stack.getItem().getItemUseAction(stack) == EnumAction.DRINK)) { EntityPlayer p = (EntityPlayer) e; ICyberwareUserData cyberware = CyberwareAPI.getCapability(e); if (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(this, 1, 0))) { potions.put(p.getEntityId(), new ArrayList<PotionEffect>(p.getActivePotionEffects())); } } else { //potions.remove(e); } }
Example #2
Source File: EssentialsMissingHandler.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleEatFoodTick(LivingEntityUseItemEvent.Tick event) { EntityLivingBase e = event.getEntityLiving(); ItemStack stack = event.getItem(); if (e instanceof EntityPlayer && CyberwareAPI.hasCapability(e) && stack != null && stack.getItem().getItemUseAction(stack) == EnumAction.EAT) { EntityPlayer p = (EntityPlayer) e; ICyberwareUserData cyberware = CyberwareAPI.getCapability(e); if (!cyberware.hasEssential(EnumSlot.LOWER_ORGANS)) { hunger.put(p.getEntityId(), p.getFoodStats().getFoodLevel()); saturation.put(p.getEntityId(), p.getFoodStats().getSaturationLevel()); } } else { hunger.remove(e.getEntityId()); saturation.remove(e.getEntityId()); } }
Example #3
Source File: EssentialsMissingHandler.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleEatFoodEnd(LivingEntityUseItemEvent.Finish event) { EntityLivingBase e = event.getEntityLiving(); ItemStack stack = event.getItem(); if (e instanceof EntityPlayer && CyberwareAPI.hasCapability(e) && stack != null && stack.getItem().getItemUseAction(stack) == EnumAction.EAT) { EntityPlayer p = (EntityPlayer) e; ICyberwareUserData cyberware = CyberwareAPI.getCapability(e); if (!cyberware.hasEssential(EnumSlot.LOWER_ORGANS)) { int hungerVal = hunger.keySet().contains(p) ? hunger.get(p) : p.getFoodStats().getFoodLevel(); float satVal = saturation.keySet().contains(p) ? saturation.get(p) : p.getFoodStats().getSaturationLevel(); p.getFoodStats().setFoodLevel(hungerVal); p.getFoodStats().setFoodSaturationLevel(satVal); } } }
Example #4
Source File: ItemLowerOrgansUpgrade.java From Cyberware with MIT License | 5 votes |
@SubscribeEvent public void handleEatFoodEnd(LivingEntityUseItemEvent.Finish event) { EntityLivingBase e = event.getEntityLiving(); ItemStack stack = event.getItem(); if (e instanceof EntityPlayer && CyberwareAPI.hasCapability(e) && stack != null && (stack.getItem().getItemUseAction(stack) == EnumAction.EAT || stack.getItem().getItemUseAction(stack) == EnumAction.DRINK)) { EntityPlayer p = (EntityPlayer) e; ICyberwareUserData cyberware = CyberwareAPI.getCapability(e); if (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(this, 1, 0))) { Collection<PotionEffect> toRemove = new ArrayList<PotionEffect>(p.getActivePotionEffects()); for (PotionEffect pE : toRemove) { if (pE.getPotion().isBadEffect()) { p.removePotionEffect(pE.getPotion()); } } Collection<PotionEffect> toAdd = potions.keySet().contains(p.getEntityId()) ? potions.get(p.getEntityId()) : new ArrayList<PotionEffect>(); for (PotionEffect add : toAdd) { for (PotionEffect removed : toRemove) { if (removed.getPotion() == add.getPotion()) { p.addPotionEffect(add); break; } } } } } }
Example #5
Source File: ItemSyringe.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (getItemUseAction(stack) == EnumAction.BOW) { if (world.isRemote && (Minecraft.getMinecraft().currentScreen != null)) { return new ActionResult<>(EnumActionResult.FAIL, stack); } else { player.setActiveHand(hand); return new ActionResult<>(EnumActionResult.PASS, stack); } } else return new ActionResult<>(EnumActionResult.FAIL, stack); }
Example #6
Source File: EnumActionDeserializer.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
public EnumActionDeserializer() { map.put("none", EnumAction.NONE); map.put("eat", EnumAction.EAT); map.put("drink", EnumAction.DRINK); map.put("block", EnumAction.BLOCK); map.put("bow", EnumAction.BOW); }
Example #7
Source File: ItemPotteryJug.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override public EnumAction getItemUseAction(ItemStack stack) { if(IsWaterJug(stack)) return EnumAction.DRINK; return EnumAction.NONE; }
Example #8
Source File: MetaItem.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public EnumAction getItemUseAction(ItemStack stack) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { return useManager.getUseAction(stack); } return EnumAction.NONE; }
Example #9
Source File: ItemEnderBow.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BOW; }
Example #10
Source File: ItemPLFood.java From Production-Line with MIT License | 4 votes |
/** * returns the action that specifies what animation to play when the items is being used */ @Override @Nonnull public EnumAction getItemUseAction(ItemStack itemStack) { return EnumAction.EAT; }
Example #11
Source File: ItemGravityRay.java From Production-Line with MIT License | 4 votes |
/** * returns the action that specifies what animation to play when the items is being used */ @Override @Nonnull public EnumAction getItemUseAction(ItemStack itemStack) { return EnumAction.BOW; }
Example #12
Source File: LingeringPotion.java From Et-Futurum with The Unlicense | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.none; }
Example #13
Source File: ItemBasicLaserGun.java From AdvancedRocketry with MIT License | 4 votes |
/** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.NONE; }
Example #14
Source File: ItemFoodTFC.java From TFC2 with GNU General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.EAT; }
Example #15
Source File: ItemFirestarter.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack is) { return EnumAction.NONE; }
Example #16
Source File: DragonEgg.java From Ex-Aliquo with MIT License | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack itemStack) { return EnumAction.eat; }
Example #17
Source File: RenderGuard.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
private void setModelVisibilities(EntityGuard clientPlayer) { ModelGuard modelplayer = (ModelGuard) this.getMainModel(); ItemStack itemstack = clientPlayer.getHeldItemMainhand(); ItemStack itemstack1 = clientPlayer.getHeldItemOffhand(); modelplayer.setVisible(true); modelplayer.isSneak = clientPlayer.isSneaking(); ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY; ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY; if (itemstack != null) { modelbiped$armpose = ModelBiped.ArmPose.ITEM; if (clientPlayer.getItemInUseCount() > 0) { EnumAction enumaction = itemstack.getItemUseAction(); if (enumaction == EnumAction.BLOCK) { modelbiped$armpose = ModelBiped.ArmPose.BLOCK; } else if (enumaction == EnumAction.BOW) { modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW; } } } if (itemstack1 != null) { modelbiped$armpose1 = ModelBiped.ArmPose.ITEM; if (clientPlayer.getItemInUseCount() > 0) { EnumAction enumaction1 = itemstack1.getItemUseAction(); if (enumaction1 == EnumAction.BLOCK) { modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK; } } } if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) { modelplayer.rightArmPose = modelbiped$armpose; modelplayer.leftArmPose = modelbiped$armpose1; } else { modelplayer.rightArmPose = modelbiped$armpose1; modelplayer.leftArmPose = modelbiped$armpose; } }
Example #18
Source File: ItemBuildersWand.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BLOCK; }
Example #19
Source File: ItemJetpackFueller.java From SimplyJetpacks with MIT License | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.bow; }
Example #20
Source File: ItemStreamChainsaw.java From Electro-Magic-Tools with GNU General Public License v3.0 | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack itemstack) { return EnumAction.bow; }
Example #21
Source File: ItemRidingCrop.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.none; }
Example #22
Source File: ItemDiabolistFork.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.none; }
Example #23
Source File: ItemGuardiansBow.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
/** * returns the action that specifies what animation to play when the items is * being used */ @Override public EnumAction getItemUseAction(ItemStack p_77661_1_) { return EnumAction.BOW; }
Example #24
Source File: MoCItemWeapon.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items * is being used */ @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; }
Example #25
Source File: ItemStaffPortal.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items * is being used */ @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; }
Example #26
Source File: ItemStaffTeleport.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items * is being used */ @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; }
Example #27
Source File: ItemBuilderHammer.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items * is being used */ @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; }
Example #28
Source File: ItemOgreHammer.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
/** * returns the action that specifies what animation to play when the items * is being used */ @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; }
Example #29
Source File: ItemArtifact.java From Artifacts with MIT License | 4 votes |
@Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.none; }
Example #30
Source File: ItemArtifactArmor.java From Artifacts with MIT License | 4 votes |
public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.none; }