Jump to content

1.7.2 custom weapons


MetaFace

Recommended Posts

What have you tried so far? Have you got a custom weapon that acts normally working already?

 

Once you do that, you should look at all the methods available in the class and think about how you could use them. There are methods called for attacks and such that you can override.

 

There are also lots of weapons tutorials and there is open source for many popular mods available.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I have, I then added onrightclick to summon an explosion, but I don't know enough for much else.

 

This is what I have for the current weapon,

 

 

 

public class ItemConcept extends ItemSword {

 

public ItemConcept(ToolMaterial material) {

super(material);

 

this.setUnlocalizedName("*Concept*");

this.setTextureName("MetaSwords:Concept");

this.setCreativeTab(CreativeTabs.tabCombat);

this.setNoRepair();

this.setContainerItem(MetaSwords.RhydrSpear);

 

}

@Override

public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {

  super.onUpdate(stack, world, entity, par4, par5);

  EntityPlayer player = (EntityPlayer) entity;

  ItemStack equipped = player.getCurrentEquippedItem();

  if(equipped == stack) {

  player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5, 5));

  }

  }

  public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer entity)

    {

    if(!world.isRemote)

    {

    item.damageItem(1, entity);

  world.createExplosion((Entity)null, entity.posX, entity.posY, entity.posZ, 1.0F, false);

}

return item;

    }

}

 

 

-MetaFace

Link to comment
Share on other sites

In onUpdate(), I don't think you should cast Entity to EntityPlayer without instanceof (mob can be holding weapon too), unless onUpdate() works only for players (idk actually, you might wanna check).

 

onItemRightClick's entity param is the player who rightclicked, to get the entity "hit" with rightclick you will need to raytrace him on your own.

You can rayTrace on client and send packet to server that will validate "hit" (to save server's cpu) or do it directly on server.

 

This is what you would need to know:

http://jabelarminecraft.blogspot.com/p/minecraft-modding-extending-reach-of.html

#getMouseOverExtended i belive.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Thanks but it didn't work for me, too many unresolved errors. OnUpdate works fine, enemies cannot spawn with this weapon and if they get a hold of it... you're dead. The problem is getting the explosion to spawn on the enemy, I got close but the tutorial was for 1.8 the small differences messes me up, I'm no where close to being professional. My problems at the moment is learning everything that I need, anyway to maybe resize the item? Make it bigger?

 

I pretty sure I'm too stupid to figure this out... I am most definitely not a modder

-MetaFace

Link to comment
Share on other sites

I pretty sure I'm too stupid to figure this out... I am most definitely not a modder

 

With that attitude you aren't. Press on and if you are determened enough you have something amazing to release into the worlds.

 

Anyway, to give your sword different sizes you need to mess with the values of the scale attribiute in your item model JSON. Mess around and try diffrent things and if you run into trouble just ask away. We won't bite.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

Do I need to make the JSON? I don't have one for it, just a basic set texture.

 

Yes I realize it seems like a bad attitude to have, but I want to do this for a friend, I'm no minecrafter, but I'll do it for my friend. Any help is highly appreciated.

-MetaFace

Link to comment
Share on other sites

 

 

Do I need to make the JSON? I don't have one for it, just a basic set texture.

 

Yes I realize it seems like a bad attitude to have, but I want to do this for a friend, I'm no minecrafter, but I'll do it for my friend. Any help is highly appreciated.

 

Wait I derp'd. I thought this was 1.8 mod *facepalm*

 

You should be able to with some methods change how the item is rendered. I would not know what to tell you as I've not done this kind of thing pre-1.8.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

I don't know more about pre 1.8 than you do, or any other version. I know how to place objects into the game and texture them, that's all I know so far. I think when I get a little more time I'll look more into this stuff, really hard to find reliable tutorials. Thanks though.

-MetaFace

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.