Skip to content

Instantly share code, notes, and snippets.

@zombiepigcreeper
Created January 7, 2012 10:28
Show Gist options
  • Save zombiepigcreeper/1574367 to your computer and use it in GitHub Desktop.
Save zombiepigcreeper/1574367 to your computer and use it in GitHub Desktop.
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, PlayerCapabilities, InventoryPlayer,
// EntityArrow, ItemStack, World, EnumAction
public class ItemKatapult extends Item
{
public ItemKatapult(int i)
{
super(i);
maxStackSize = 1;
setMaxDamage(240);
}
public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer entityplayer, int i)
{
if(entityplayer.capabilities.depleteBuckets || entityplayer.inventory.hasItem(mod_katapult.smallstone.shiftedIndex))
{
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;
}
EntityStone entitystone = new EntityStone(world, entityplayer);
if(f == 1.0F)
{
entitystone.beenAttacked = true;
}
itemstack.damageItem(1, entityplayer);
world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
entityplayer.inventory.consumeInventoryItem(mod_katapult.smallstone.shiftedIndex);
if(!world.multiplayerWorld)
{
world.entityJoinedWorld(entitystone);
}
}
}
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)
{
if(entityplayer.capabilities.depleteBuckets || entityplayer.inventory.hasItem(mod_katapult.smallstone.shiftedIndex))
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
}
return itemstack;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment