Advertisement
Guest User

Untitled

a guest
Dec 13th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. package DSFoFG.items;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.client.renderer.texture.IIconRegister;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.nbt.NBTTagCompound;
  11. import net.minecraft.world.World;
  12. import DSFoFG.Main;
  13. import DSFoFG.entities.powerPack;
  14. import cpw.mods.fml.relauncher.Side;
  15. import cpw.mods.fml.relauncher.SideOnly;
  16.  
  17.  
  18. public class blaster extends Item {
  19.  
  20. private String texturePath = "dsfofg:";
  21.  
  22. public blaster(int ItemID, String textureName)
  23. {
  24. super();
  25. this.setUnlocalizedName(textureName);
  26. this.setCreativeTab(Main.dsfofgWeapons);
  27. texturePath += textureName;
  28.  
  29. }
  30. public static void int getCodeIfValid(EntityPlayer player){
  31. ItemStack hold = player.inventory.getCurrentItem();
  32. if(hold.getItem() != Main.blasterPistol() )
  33. }
  34.  
  35. public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
  36. itemStack.stackTagCompound = new NBTTagCompound();
  37. itemStack.stackTagCompound.setString("Owner", player.getDisplayName());
  38.  
  39. }
  40. public void addInformation(ItemStack itemStack, EntityPlayer player,
  41. List list, boolean par4) {
  42. if (itemStack.stackTagCompound != null) {
  43. String owner = itemStack.stackTagCompound.getString("owner");
  44. list.add("Owner: " + owner);
  45.  
  46.  
  47. }
  48.  
  49. }
  50.  
  51.  
  52.  
  53. @Override
  54. @SideOnly(Side.CLIENT)
  55.  
  56.  
  57. public void registerIcons(IIconRegister iconRegister)
  58. {
  59. this.itemIcon = iconRegister.registerIcon(texturePath);
  60. }
  61.  
  62. private int coolDown = 0;
  63.  
  64. @Override
  65. public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) {
  66. if(coolDown <= 0) {
  67. coolDown = 40; // Cool down time in ticks
  68. }
  69. if(par3EntityPlayer.capabilities.isCreativeMode||par3EntityPlayer.inventory.consumeInventoryItem(null))
  70. {
  71. par2World.playSoundAtEntity(par3EntityPlayer, "mob.irongolem.hit", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
  72. if (!par2World.isRemote)
  73. {
  74. par2World.spawnEntityInWorld(new powerPack(par2World, par3EntityPlayer));
  75. }
  76. }
  77. return par1ItemStack;
  78. }
  79. @SideOnly(Side.CLIENT)
  80. public boolean isFull3D()
  81. {
  82. return true;
  83. }
  84.  
  85.  
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement