Tutorials/Useful commands

Commands is useful for map building, Creative mode, etc. In this article we will list out some useful commands.

Invisible Item Frame
Item Frame is an entity. We can get an invisible Item Frame using command. This is the command: /give @p minecraft:item_frame{EntityTag:{Invisible:1}}

Villager Trades
Note: If you are too lazy to write these long commands, you can always use commands generators in the internet. Villagers are passive mobs and they live in villages. We can trade with them. By using command, we can spawn villagers with custom trades. /summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains},CustomName:"\"John\"",Offers:{Recipes:[{buy:{id:emerald,Count:1},sell:{id:wheat,Count:1},rewardExp:0b,maxUses:9999999}]}} In this command, we will spawn a villager call John and he sells 1 wheat for 1 emerald.

Profession and Types
You can edit the  to other professions,   to specific biomes. You can see all the professions and types at here.

Custom Name
You can change  to any name.

Id and Count
Change the  to any items or blocks. defines the number of items.

Reward Experience and Max Uses
is the experience you get when you traded. is how many times you can trade with.

Replacing Blocks
By using command, we can replace a type of block in an area. /fill 16 ~ 16 0 ~ 0 minecraft:stone replace minecraft:grass_block The command above will replace grass block to stone in an area. The  is the coordinates. The block after  is the block we want to replace.

Custom Enchanment Levels
Note: Some enchanments won't work. By using command, we can get a netherite sword with sharpness and custom level.

Single Enchanment
/give @p minecraft:netherite_sword{Enchanments:[{id:sharpness,lvl:10}]} 1 The command above will give you a netherite sword with sharpness 10. You will see the enchanment as Sharpness X. You can change  to any enchanments.

Levels
Change  to any number. The maximum number is 255, if your number is bigger than 255, The level will automatically change to 255.

Double Enchanments
To get more than one enchanments in a tool, add a comma after the first enchanment and add a new enchanment. /give @p minecraft:netherite_sword{Enchanments:[{id:sharpness,lvl:10},{id:looting,lvl:10}]} 1 This command added looting 10 to the netherite sword.