Minecraft modding how-tos for Fabric, NeoForge and Forge
Each page explains one thing a mod can do: the steps, the classes and methods it uses, and example code for each loader and version. Every one covers Fabric and NeoForge 1.21.1, and some also cover 1.20.1, 26.3 or Forge 1.20.1. They are the how-tos in Linen’s How-tos library.
Blocks
Section titled “Blocks”- A block that can hold water
- A block that changes over time with random ticks
- A block that does something when clicked
- A block that faces the player
- A block that gives off light
- A block with the properties you choose
- A new block
- A source of redstone power
- Fix a crash when a block is placed
Block entities
Section titled “Block entities”- A block entity that ticks
- A block that holds an item
- Draw something on a block with a block entity renderer
- A food item
- A new item
- A pickaxe
- A piece of armour
- A sword
- A sword that sets targets on fire
- A tool that breaks a 3 by 3 area
- A tool tier of your own
- A wand that strikes lightning where you look
- An item that burns in a furnace
- An item that changes the block you click
- An item that does something when used
- An item that explodes where you aim
- An item that fills the hunger bar
- An item that gives a potion effect
- An item that gives the player another item
- An item that heals you when you use it
- An item that launches you into the air
- An item that makes a burst of particles
- An item that places blocks in a line
- An item that plays a sound
- An item that sets the time and weather
- An item that shoots a projectile
- An item that spawns a mob where you click
- An item that teleports you forward
- An item that wears out
- An item with a tooltip
- An item with the properties you choose
- An item you use on a mob or player
- Food that gives a potion effect
- Show a message above the hotbar
- Store a value on an item with a data component
Mobs and entities
Section titled “Mobs and entities”- A mob that drops an item
- A mob with attributes and a spawn egg
- Add a villager trade
- Change a mob’s health and speed
- Give a mob a new AI goal
- Make a mob spawn in the world
- Ride a mob
Events and fixes
Section titled “Events and fixes”- Armor that gives a potion effect
- Do something when a player joins
- Find out why a mod is not in the mod list
- Fix a wrong Java version error
- Fix ClassNotFound and NoSuchMethod errors
- Give players items when they first join
- Make players immune to a kind of damage
- React to chat messages
- React when a player breaks a block
- React when a player right-clicks a block
- React when something takes damage
- Run code every tick
- Share code between Fabric and NeoForge
- Spawn a mob every few seconds
World generation and data
Section titled “World generation and data”- A new dimension
- A new enchantment
- Add an advancement
- An enchantment that heals you (lifesteal)
- Define a damage type
- Define a new biome
- Generate ore in the world
- Save data with the world
- Store data on a player or entity
Recipes
Section titled “Recipes”Data generation
Section titled “Data generation”- Generate a block’s model with datagen
- Generate a crafting recipe with datagen
- Generate block tags with datagen
Screens, keys and the HUD
Section titled “Screens, keys and the HUD”- A key the player can press
- A menu with slots and a screen
- Draw text on the screen
- Fix an item name that shows as item.modid.name
- Open a screen from an item
Commands
Section titled “Commands”Config and publishing
Section titled “Config and publishing”- A config value players can change
- Add a game rule
- Publish my mod on Modrinth or CurseForge
- Update my mod to a new Minecraft version
Mixins
Section titled “Mixins”- Change Minecraft’s code with a mixin
- Change what a method returns with a mixin
- Read a private field with a mixin accessor
- See what my mixin did to the game’s code
- Stop a method from running with a mixin
Access wideners
Section titled “Access wideners”Networking
Section titled “Networking”Textures and models
Section titled “Textures and models”- A block with a different texture on each side
- A texture for an item or block
- Fix a purple and black missing texture