[TUTORIAL] How to create custom enchants (1.14.4)

Started by Max094_Reikeb on

Topic category: User side tutorials

Last seen on 14:00, 14. Nov 2023
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to create custom enchants (1.14.4)

For this tutorial, I'll show you how to create a custom enchantment.

But read this WARNING first : the enchantments that you'll create will be applied only on custom items that you create (so no vanilla) and these enchantments won't be found in the enchantment table and you won't be able to use them in the Anvil.

Are you good? Here we go!
First of all, you need to create an Enchanted Book. On the first page, you will add the name of your enchantment as the description. And don't forget to check "glowing effect".
toolenchant

Then, you'll need to edit your Enchanted Book, and around line 60, you'll find this 

list.add(new StringTextComponent("Thundering"));

You'll need to add "\u00A77" before the Enchantment name to set it as the others, in grey. When you finish, lock the code, and build the workspace.

Then, you'll need to create your tool. Create it and don't forget to create the effect of your Enchantment. I wanted an enchantment that makes you able to summon lightning. And as a condition, you'll need to check if the NBT tag is true. And finally, don't forget to link the procedure to your item. For me, it'll be "When right clicked on block".
procedureeffect
kind

Then, again, you'll need to enter a code: your tool's code. You'll need these dependencies (take out the one you've got already)

import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.world.World;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.Direction;
import net.minecraft.util.ActionResultType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Item;
import net.minecraft.item.IItemTier;
import net.minecraft.item.AxeItem;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.block.BlockState;

And also, if it's not here, don't forget to call your procedure (replace ThunderingEffectProcedure by the name of your procedure)

import net.mcreator.testenchant.procedures.ThunderingEffectProcedure;

Then around line 66, you'll see this:

    }, 1, -2.7999999999999998f, new Item.Properties().group(ItemGroup.TOOLS)) {
        @Override
        public ActionResultType onItemUse(ItemUseContext context) {
........
........
........
		}
	}.setRegistryName("netherite_axe"));
}

You'll need to paste the following code between the line 1 of the extract above and the line 2 of the extract above:

@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack itemstack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
	if ((((itemstack).getOrCreateTag().getBoolean("EnchantThundering")) == (true))) {
		tooltip.add(new StringTextComponent("\u00A77Thundering"));
	}
}
			
@Override
@OnlyIn(Dist.CLIENT)
public boolean hasEffect(ItemStack itemstack) {
	if ((((itemstack).getOrCreateTag().getBoolean("EnchantThundering")) == (true))) {
		return true;
	} else {
		return false;
	}
}

There are 2 things you'll need to modify: the name of the boolean because with me it's "EnchantThundering" but it'll be something else with you. The second thing is the name of the Enchantment with the line "tooltip.add(...);"

Almost done! The last thing you'll have to do is to find a way to give the Enchanted book to the players (can be a drop or a loot table) AND you'll need a way to apply the book on the tool.
For me, I've created a simple block with a GUI and in the procedure, I add the NBT tag to the tool.
lt

And tadam! Over! This is how it looks In Game:
igl

Of course, if you didn't understand what I've done, I have a little something for you: the archive of my project!
Here it ishttps://mega.nz/#!bAM0xapT!al1UVYpkXBxoxi1rtaEBR0qSK0oLcx6sohJ7hjh6Xy0

Last seen on 17:32, 27. Mar 2024
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nice!
Wed, 03/25/2020 - 16:39

Nice!

Last seen on 14:00, 14. Nov 2023
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hope you'll like it and use…
Wed, 03/25/2020 - 17:14

Hope you'll like it and use it!

Last seen on 23:55, 15. Mar 2023
Joined Oct 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Great tutorial! Might end up…
Wed, 03/25/2020 - 19:07

Great tutorial! Might end up making some enchantments.

Last seen on 20:43, 14. Feb 2024
Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is a great tutorial…
Fri, 03/27/2020 - 01:52

This is a great tutorial indeed! Love the work you did. Congrats on doing such a great job :]

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Great Tutorial, my only…
Fri, 04/17/2020 - 20:28

Great Tutorial, my only problem is, is that the new enchanted book item stands out as the rest of the books are highlighted in yellow. Any idea on how to change the Items name colour?

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also the images are broken
Fri, 04/17/2020 - 20:30

also the images are broken

Last seen on 14:00, 14. Nov 2023
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please, avoid double posts…
Sat, 04/18/2020 - 00:00

Please, avoid double posts.

What do you mean by "the images are broken"?
To change an item name (the name of the book) you need to go to the tab named "Localization" and there you will be able to use a color code.

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, i didn't double post but…
Sat, 04/18/2020 - 11:05

Ok, i didn't double post but thanks :D

 

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
im confused, i have been to…
Sat, 04/18/2020 - 11:25

im confused, i have been to the localisation tabs but none of the colour codes work? where exactly do i put the colour code?

 

Last seen on 14:00, 14. Nov 2023
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please again avoid double…
Sat, 04/18/2020 - 11:27

Please again avoid double posts!
And download the workspace I gave at the end of the tutorial to see it!

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your google/ firefox or…
Sat, 04/18/2020 - 14:14

Your google/ firefox or whatever you use is glitched, or its the website. im not double posting :/

Last seen on 14:00, 14. Nov 2023
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes you are double posting.
Sat, 04/18/2020 - 14:24

Yes you are double posting.
img

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oops i realise my mistake, i…
Sat, 04/18/2020 - 14:34

oops i realise my mistake, i thought you meant double posting as in 2 posts with the same exact words, sorry and im doing it again!

also the workspace provided did not help with the question i asked you as you have not done that either. What i asked is if you know how to make The Enchanting Books label be yellow instead of white. i have some images so you can see what i mean.

 

Here is your book: 

 

 

 

Here is minecrafts book (with a yellow tag in the name of the book):

Last seen on 12:27, 8. May 2023
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
well mcreator didnt show the…
Sat, 04/18/2020 - 14:36

well mcreator didnt show the images so heres the links to them

Your book:

https://www.pinterest.co.uk/pin/644507396662459335/

Minecrafts book (with the yellow name instead of it being white):

https://www.pinterest.co.uk/pin/644507396662459341/