From 358405da1db44f6ed83fd59a4d2c94ec2d857f25 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sun, 30 Aug 2015 22:49:03 +0100 Subject: [PATCH] Having a Haste buff enabled lowers the Mana Blaster's cooldown. --- .../java/vazkii/botania/common/item/ItemManaGun.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/vazkii/botania/common/item/ItemManaGun.java b/src/main/java/vazkii/botania/common/item/ItemManaGun.java index 31f5904a5..5a0ba0d24 100644 --- a/src/main/java/vazkii/botania/common/item/ItemManaGun.java +++ b/src/main/java/vazkii/botania/common/item/ItemManaGun.java @@ -20,6 +20,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; @@ -72,6 +74,11 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem { @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + int effCd = COOLDOWN; + PotionEffect effect = par3EntityPlayer.getActivePotionEffect(Potion.digSpeed); + if(effect != null) + effCd -= (effect.getAmplifier() + 1) * 8; + if(par3EntityPlayer.isSneaking() && hasClip(par1ItemStack)) { rotatePos(par1ItemStack); par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F); @@ -79,7 +86,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem { par3EntityPlayer.swingItem(); ItemStack lens = getLens(par1ItemStack); ItemsRemainingRenderHandler.set(lens, -1); - par1ItemStack.setItemDamage(COOLDOWN); + par1ItemStack.setItemDamage(effCd); } else if(par1ItemStack.getItemDamage() == 0) { EntityManaBurst burst = getBurst(par3EntityPlayer, par1ItemStack, true); if(burst != null && ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, burst.getMana(), true)) { @@ -95,7 +102,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem { par3EntityPlayer.motionY -= burst.motionY * 0.3; par3EntityPlayer.motionZ -= burst.motionZ * 0.1; } - par1ItemStack.setItemDamage(COOLDOWN); + par1ItemStack.setItemDamage(effCd); } else if(!par2World.isRemote) par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F); }