Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.Random;
- public class ItemAmethystBow extends Item
- {
- public ItemAmethystBow(int i)
- {
- super(i);
- maxStackSize = 1;
- setMaxDamage(384);
- }
- public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
- {
- EntityPlayer entityplayer = (EntityPlayer)entity;
- ItemStack itemstack1 = entityplayer.inventory.getCurrentItem();
- if(entityplayer.isUsingItem() && itemstack1.itemID == mod_LEM.AmethystBow.shiftedIndex)
- {
- int k = itemstack.getMaxItemUseDuration() - entityplayer.func_35205_Y();
- if(k >= 18)
- {
- iconIndex = mod_LEM.AmethystBow4;
- }else
- if(k > 13)
- {
- iconIndex = mod_LEM.AmethystBow3;
- }else
- if(k > 0)
- {
- iconIndex = mod_LEM.AmethystBow2;
- }else
- iconIndex = mod_LEM.AmethystBow1;
- }
- }
- public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer entityplayer, int i)
- {
- int j = getMaxItemUseDuration(itemstack) - i;
- float f = (float)j / 20F;
- f = (f * f + f * 2.0F) / 3F;
- if((double)f < 0.10000000000000001D)
- {
- return;
- }
- if(f > 1.0F)
- {
- f = 1.0F;
- }
- EntityAmethystArrow entityamethystarrow = new EntityAmethystArrow(world, entityplayer, f * 2.0F);
- itemstack.damageItem(1, entityplayer);
- world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
- world.entityJoinedWorld(entityamethystarrow);
- }
- public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer)
- {
- return itemstack;
- }
- public int getMaxItemUseDuration(ItemStack itemstack)
- {
- return 0x11940;
- }
- public EnumAction getItemUseAction(ItemStack itemstack)
- {
- return EnumAction.bow;
- }
- public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
- {
- entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
- return itemstack;
- }
- }
Add Comment
Please, Sign In to add comment