Pre-Enchanted Armor Piece Help

Started by Kane on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Pre-Enchanted Armor Piece Help

I was trying to make a pre-enchanted armor piece (have it already enchanted when you get it in creative) , like for the items/tools, but it doesn't work.

I know it's more or less the same thing but I can't make it work D:

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I came out with this ugly
Sat, 09/03/2016 - 22:07

I came out with this ugly thing: [spoiler]

@SideOnly(Side.CLIENT)
            public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
                Item boots = new ItemStack(itemIn, 1, 0);

                boots.addEnchantment(Enchantments.DEPTH_STRIDER, 3);

                subItems.add(boots);

[/spoiler]

just no errors but not enchantment too obviously

I can just wonder why it doesn't work D:

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Do you have it correctly in
Sat, 09/03/2016 - 22:55

Do you have it correctly in the instance/class of the item?

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Do you have it correctly in
Sat, 09/03/2016 - 23:37

@#2 I guess it, it is right after 

static { ItemArmor.ArmorMaterial etc..;

boots = etc... {

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If in your version the item
Sun, 09/04/2016 - 09:54

If in your version the item is instance of custom class that extends ItemArmor , simply it is supossed to be in the inner class , if the item is directly instance of ItemArmor , you need add after new ItemArmor(...) bracket and your method.

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:If in your version the item
Sun, 09/04/2016 - 10:20

@#3 it's directly instance of itemAmor and in fact First I put it right after 

boots = (new ItemArmor(enuma, armorPreffix, EntityEquipmentSlot.FEET) {

 

 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmmm...try:
Sun, 09/04/2016 - 19:05

Hmmm...try:

[spoiler]

@SideOnly(Side.CLIENT)
@Override
            public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
                Item boots = new ItemStack(itemIn, 1, 0);

                boots.addEnchantment(Enchantments.DEPTH_STRIDER, 3);

            subItems.add(boots);}
[/spoiler]

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Hmmm...try:
Sun, 09/04/2016 - 19:16

@#4 It works! (just had to change Item boots into ItemStack boots) thx a lot!

But now there's another little problem... when I craft them, I get not enchantment (obviously, I didn't think about it).

Where do I have to write the recipe? I've added it automatically with mcreator but it's at the top of the code

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just put after the previous
Sun, 09/04/2016 - 19:24

Just put after the previous method:

[spoiler]
@Override
 public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn)
    {
stack.addEnchantment(Enchantments.DEPTH_STRIDER, 3);

}

[/spoiler]

Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Just put after the previous
Sun, 09/04/2016 - 19:35

@#5 That was easy! thx a lot!

I was thinking I wrote something wrong (and really dumb) with the boots enchantment code.
It's thanks to you if I'm starting to understand this stuff :D