Jump to content

Recommended Posts

Posted

Hello, I'm working on a mod that has a tnt launcher. Well the basic primed tnt entity simply falls to the ground which I don't want. So I made my own custom tnt entity to change that (so that it shoots out), but for some reason I can't get it to render. Currently both my render class and entity class are the same as the originals. Any amount of help is appreciated.

 

Main Mod File

 

  Reveal hidden contents

 

 

ClientProxy

 

  Reveal hidden contents

 

 

EntityMyTNT

 

  Reveal hidden contents

 

 

RenderMyTNT

 

  Reveal hidden contents

 

Posted

Hello, I appreciate the help, but I don't quite see how I would do that. Here is my launcher item class when I spawn the entity, if you could let me know how I would do that I would appreciate that =)

 

package teampap.grenade.items;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import teampap.grenade.lib.Constants;

public class ItemTNTLauncher extends Item
{
    private String name = "tntLauncher";

    public ItemTNTLauncher()
    {
        setUnlocalizedName(Constants.MODID + "_" + name);
        setCreativeTab(CreativeTabs.tabCombat);
    }

    public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player)
    {

        item.damageItem(1, player);

        if (!world.isRemote)
        {
            world.spawnEntityInWorld(new EntityTNTPrimed(world, player.posX, player.posY, player.posZ, player));
        }

        return item;

    }
}

Posted

Thanks! One last thing though, how would I know where the player is facing in order to shoot it out in that direction?

 

EntityTNTPrimed mytnt = new EntityTNTPrimed(world, player.posX, player.posY, player.posZ, player);
mytnt.motionX += 10;
world.spawnEntityInWorld(mytnt); 

 

The above works, but it (obviously) only shoots out in one direction.

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.