Java Coding Class: Generators Tutorial

I know I talked about generators in my class 2 notes extra article, but in this one, we will be going in-depth on a full tutorial on them. This one is on the give command generator, but I might make a part 2 in the future for the summon command generator.


The best generator in my opinion is mcstacker.net

The reason being is that this has pretty much everything, from attribute modifiers to CustomModelData.


When you get to the website, you will see a page like this:


Since we are in part 1, we will go to the give item section. You will pretty much never need generators for commands that aren't given and summon, so we won't be looking at the other ones today.

When you click on the give section, scroll down and you will see the target selectors section.

This is where you can choose who you want to give the item to, but most of the time you won't change anything here. Just in case, I will explain everything in this section. If you don't want to read this part, just scroll down.


On the first line, this is where you will be given some base target selectors: @p, @a, @s, @r, or a player's name. The second line allows you to choose how many players you want this to affect.

In the next line, you can choose the sort of players. You will also use this in target selectors, which you can find here:

insert target selectors article


You can choose 'arbitrary' to not sort the player, you can choose nearest, furthest, and random, as well.


In the next three lines, you can choose the location of the targets you want to select, for example, if I am standing at 32 45 64, and I write 32 44 23, it will not target me as I am not in the specified location.


The next four lines have to do with rotation, and they are so useless I won't even get into them here.

On the next line, you can specify your team, which has to do with the team command. We will get into that in a later class. Further down, you can enter the name of the entity you want to select, for entities that have custom names. You can also enter the NBT data for the entity, (players can't have NBT) as well as the gamemode. You can also enter the minimum and maximum XP level of the player, and if you want it to be a set value, say 64, just put 64 as the min and max.

You can enter advancements, as well as tags. You can tag an entity by running the command:


/tag (entity) (tag)

At the very bottom of the selectors tab, you can enter score objectives, which have to do with the scoreboard command.


Now, onto the next section: making the item.


Choose the item you want, either by typing it in in the 'filter' tab or by choosing it from the drop-down menu. I will pick a wooden sword.


After you pick your item, a whole list of new things will pop up. Just like the last section, we will start from the top down.


On the first line, you can make a name by pressing the S button. Enter the name for your weapon by putting it in 'value', and don't worry about component type. You can choose the color, (the font option doesn't work) and the way it looks. If you want to add another section, you can press the plus button at the top, and to navigate you can use the arrow buttons. To hide the menu again, press the H button next to 'name'.


On the 2nd line, you can choose the Lore of the item, which is basically just the text under the name. The menu functions the same as the name menu, so no explanation is needed.


On the 3rd line, you can enter the damage. THIS IS NOT THE DAMAGE OF THE ITEM, BUT THE DAMAGE DONE TO THE DURABILITY.


You can also add the repair cost, which is the number of XP levels added to the base XP level needed to repair, combine, or rename the item.

On the next line, you can choose if the item is unbreakable or not.

You can also choose the number of items you want. For example, I would get 2 wooden swords if I put the number 2 there.

On the next line, you can enter the custom model data of the item. This allows you to make a custom texture for your item. If you watch a tutorial on youtube on how to make a custom texture for an item, they will say you need to enter the custom model data for the item. I usually make the number 6 digits so it's long and I can have a lot of them, but any number works.


The next line is the custom tags for the item. You will use this in datapacks if you ever want to make custom items. But, for items only, you always have to add a :1b to the end. For example, if I wanted to make my sword have the coolSword tag, I would have to write coolSword:1b in the tag part.

The next two lines allow you to choose what you can place the item on (blocks only) or what the item can break. (items only) This feature only works in adventure mode.

The next line allows you to choose what flags to hide. For example, if I check 'Unbreakable' and 'hide unbreakable' in the hide flags tab, it won't say my item is unbreakable even though it is.

The next part is where you can choose your enchantments. At first, it will only show you the enchants you can put on the sword, but if you click 'Show All' it will show you every enchant and you can apply it to your item. For example, I can get a bow with sharpness 5!

You can also check 'glint only' which means the item will have no enchants, but still will have the enchant glint.

You can enter the level you want on the side.


TIP: On version 1.17 and up, the enchantment cap is 255, but on versions 1.16.5 and below the limit is a whopping 32,767!


The last tab allows you to enter your attribute modifier. This is basically enchants, but more powerful. You can choose what attribute modifier you want, you can add more, you can choose if it activates when it is in your offhand or mainhand, or if it is in one of your armor slots, as well as the value and operation. You don't have to worry about the UUID, either.

The operation is the way the value is represented. For example, if I choose percent and I write 200, that would be double as the base damage is 100%, and 200% is double of 100%.

You can choose' amount', which is the default, where you can enter the strength of the attribute. The maximum amount you can enter is 999,999.

Multiply means that if I enter 2, it will double the base damage of the item since (base damage)*2 = double


That's it for the give command, I might make a part 2 to this explaining the summon command generator in the future.

I hope you learned something, and like always, see you next class!


~ Benny