Jump to content

[SOLVED] [1.7.2] Enchantment effect onto armor


FlatCrafter

Recommended Posts

Hi, I need help:

 

I made a mod which adds Nether star armor, everything is working fine.

I added the enchantment effect (only the effect, not any enchantment!!!) to the items, worked. But now, I want to ask you how can I add this effect to the armor 'model' when I wear the armor (means: how do I add this effect that I can see that and other players too). Would be great if anyone could help me.

 

The thing is, it would be great if other modders could know that too. I googled and googled, watched videos and other stuff... but I didn't find it out for so much time.

 

Greets, FlatCrafter

Link to comment
Share on other sites

ive added the enchantment effect to items using,

 

@SideOnly(Side.CLIENT)

    public boolean hasEffect(ItemStack par1ItemStack)

    {

        return true;

    }

 

with a few items like ingots and such just inside the item class, armour is made like an item and has the ability to use the effect in standard vanilla, i dont see why you cant use the method in the armour class? have you tried it

Link to comment
Share on other sites

ive added the enchantment effect to items using,

 

@SideOnly(Side.CLIENT)

    public boolean hasEffect(ItemStack par1ItemStack)

    {

        return true;

    }

 

with a few items like ingots and such just inside the item class, armour is made like an item and has the ability to use the effect in standard vanilla, i dont see why you cant use the method in the armour class? have you tried it

 

Yes I did this exactly like you, but I don't see this 'glitter/enchantment' effect at the model.

BTW, this is my NetherStarArmor class:

[spoiler=NetherStarArmor.java]

package de.cynfos.toolsplus.armor;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import de.cynfos.toolsplus.Armor;
import de.cynfos.toolsplus.ToolsPlus;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;

public class NetherStarArmor extends ItemArmor {

public NetherStarArmor(ArmorMaterial material, int ID, int placement) {
	super(material, ID, placement);
	setCreativeTab(ToolsPlus.tabToolsPlus);

	if (placement == 0) { setTextureName(ToolsPlus.MODID + ":nether_star_helmet"); }
	else if (placement == 1) { setTextureName(ToolsPlus.MODID + ":nether_star_chestplate"); }
	else if (placement == 2) { setTextureName(ToolsPlus.MODID + ":nether_star_leggings"); }
	else if (placement == 3) { setTextureName(ToolsPlus.MODID + ":nether_star_boots"); }
}

public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
	if (stack.getItem() == Armor.NetherStarHelmet || stack.getItem() == Armor.NetherStarChestplate || stack.getItem() == Armor.NetherStarBoots) {
		return ToolsPlus.MODID + ":textures/models/armor/nether_star_layer_1.png";
	}
	if (stack.getItem() == Armor.NetherStarLeggings) {
		return ToolsPlus.MODID + ":textures/models/armor/nether_star_layer_2.png";
	}
	else {
		return null;
	}
}

@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack) {
	return true;
}

}

 

Link to comment
Share on other sites

Ok guys, I solved the problem. Many thanks to all of you!

Here is my new hasEffect() method:

 

@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack) {
     par1ItemStack.setTagInfo("ench", new NBTTagList());
     return true;
}

 

I have to relink to this thread on the Minecraft Forums: LINK

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.