Jump to content

Ghast tentacles [1.47]


ashtonr12

Recommended Posts

i have added an item that when right clicked pawns a fireball but it only shoots in one direction and the .setMaxDamage doesn't work, here is the code

 

Main Class;

package ashtonsmod.common;

import net.minecraft.block.Block;
import net.minecraft.block.BlockReed;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;

@Mod(modid = "ashtonsmod", name = "Ashton's Mod", version = "1.00")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class ashtonsmod
{
public static Item Tentacle;

@SidedProxy(clientSide = "ashtonsmod.client.ClientProxyashtonsmod", serverSide = "ashtonsmod.common.CommonProxy")
public static CommonProxy proxy;

proxy.registerServerTickHandler();

proxy.registerRenderers();{
Tentacle = new Tentacle(548).setMaxStackSize(1).setIconIndex(44).setItemName("Tentacle").setMaxDamage(32);
DungeonHooks.addDungeonLoot(new ItemStack(ashtonsmod.Tentacle), 10, 1, 1);
LanguageRegistry.addName(Tentacle,"Lesser Ghast Tentacle");
}
}
}

 

the tentacle class;

 

package ashtonsmod.common;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class Tentacle extends Item{


    public Tentacle(int par1)
    {
        super(par1);
        this.setMaxDamage(32);
    }
    
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        if (!par3EntityPlayer.capabilities.isCreativeMode)
        {
            --par1ItemStack.stackSize;
        }

        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntitySmallFireball(par2World, par3EntityPlayer, iconIndex, iconIndex, iconIndex));
        }
        par3EntityPlayer.swingItem();
        return par1ItemStack;
    }
    @Override
  	public String getTextureFile(){
  		return CommonProxy.items_png;   
}

   }

 

Let e know if you need any more code, such as the serverProxy or client proxy or some such like that.

 

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.