Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DSFoFG.items;
- import java.util.List;
- import net.minecraft.client.renderer.texture.IIconRegister;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.world.World;
- import DSFoFG.Main;
- import DSFoFG.entities.powerPack;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class blaster extends Item {
- private String texturePath = "dsfofg:";
- public blaster(int ItemID, String textureName)
- {
- super();
- this.setUnlocalizedName(textureName);
- this.setCreativeTab(Main.dsfofgWeapons);
- texturePath += textureName;
- }
- public static void int getCodeIfValid(EntityPlayer player){
- ItemStack hold = player.inventory.getCurrentItem();
- if(hold.getItem() != Main.blasterPistol() )
- }
- public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
- itemStack.stackTagCompound = new NBTTagCompound();
- itemStack.stackTagCompound.setString("Owner", player.getDisplayName());
- }
- public void addInformation(ItemStack itemStack, EntityPlayer player,
- List list, boolean par4) {
- if (itemStack.stackTagCompound != null) {
- String owner = itemStack.stackTagCompound.getString("owner");
- list.add("Owner: " + owner);
- }
- }
- @Override
- @SideOnly(Side.CLIENT)
- public void registerIcons(IIconRegister iconRegister)
- {
- this.itemIcon = iconRegister.registerIcon(texturePath);
- }
- private int coolDown = 0;
- @Override
- public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) {
- if(coolDown <= 0) {
- coolDown = 40; // Cool down time in ticks
- }
- if(par3EntityPlayer.capabilities.isCreativeMode||par3EntityPlayer.inventory.consumeInventoryItem(null))
- {
- par2World.playSoundAtEntity(par3EntityPlayer, "mob.irongolem.hit", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
- if (!par2World.isRemote)
- {
- par2World.spawnEntityInWorld(new powerPack(par2World, par3EntityPlayer));
- }
- }
- return par1ItemStack;
- }
- @SideOnly(Side.CLIENT)
- public boolean isFull3D()
- {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement