mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Bow tweaks
This commit is contained in:
1 parent
d411fac65c
commit
b6d607b553
2 files changed
+16
-4
No files matched your search
@@ -15,6 +15,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -50,4 +51,9 @@ public class ItemCrystalBow extends ItemLivingwoodBow {
|
||||
ManaItemHandler.requestManaExactForTool(stack, ((EntityPlayer) living), ARROW_COST / (infinity ? 2 : 1), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getAmmo(EntityPlayer player) {
|
||||
return new ItemStack(Items.arrow);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -126,8 +127,8 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
if(f > 1.0F)
|
||||
f = 1.0F;
|
||||
|
||||
ItemStack ammo = shooter instanceof EntityPlayer ? PlayerHelper.getAmmo(((EntityPlayer) shooter), AMMO_FUNC) : null;
|
||||
if(ammo == null)
|
||||
ItemStack ammo = shooter instanceof EntityPlayer ? getAmmo(((EntityPlayer) shooter)) : null;
|
||||
if(ammo == null || !(ammo.getItem() instanceof ItemArrow))
|
||||
ammo = new ItemStack(Items.arrow);
|
||||
EntityArrow entityarrow = ((ItemArrow) ammo.getItem()).createArrow(world, ammo, shooter);
|
||||
entityarrow.func_184547_a(shooter, shooter.rotationPitch, shooter.rotationYaw, 0.0F, f * 3.0F, 1.0F);
|
||||
@@ -173,8 +174,9 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
void onFire(ItemStack bow, EntityLivingBase living, boolean infinity, EntityArrow arrow) {
|
||||
if(infinity)
|
||||
arrow.canBePickedUp = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
else if(living instanceof EntityPlayer)
|
||||
PlayerHelper.consumeAmmo(((EntityPlayer) living), AMMO_FUNC);
|
||||
else if(living instanceof EntityPlayerMP)
|
||||
if(((EntityPlayerMP) living).interactionManager.getGameType().isSurvivalOrAdventure())
|
||||
PlayerHelper.consumeAmmo(((EntityPlayerMP) living), AMMO_FUNC);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,4 +195,8 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ItemStack getAmmo(EntityPlayer player) {
|
||||
return PlayerHelper.getAmmo(player, AMMO_FUNC);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user