1.18
Introduction
Everything you need to know about 1.18 modding with Forge.
Documentation
- The official Forge documentation. Very well written and good explanation on various subjects
- Very good Wiki with all kinds of Forge related info
Useful links
- McJty's discord
- GitHub for the 1.18 version of the first tutorial (V1)
- GitHub for the newest 1.18 tutorial (V3)
- IntelliJ migration settings for 1.16 -> 1.18
- Forge MDK Download
- Parchment Wiki (for better named parameters)
- Many examples in code form. Easy to use as a start for your own blocks and items
- Java 17
- Older Tutorials
- Structure Tutorial by TelepathicGrunt
- Minecraft Wiki with information on custom dimensions
Porting
Various bits of information to help with porting
- Making a custom rendertype with custom shader: here
- How to add entity renderers and layer renderers: here
- Updating a mod from 1.16.5 to 1.17 (start with this): here
- A migration tool for IntelliJ to move from 1.17 to 1.18: here
- List of renames and refactors in 1.18 forge: here
(most of these are from gigaherz)
Some notes about BlockEntity saving:
"1.18 doesn't really use save() in the same way older versions used to. If you continue overriding save, it will not work. Instead, you should override saveAdditional. If you are storing BlockEntities somewhere, don't call save. Call saveWithFullMetadata(), saveWithId() or saveWithoutMetadata(), depending on your needs."
Porting step summary
Porting steps (from 1.17):
- Clone 1.17 version of your project (or copy it using file system)
- Change Project JDK to Java 17
build.gradle
: Change mappings to either parchment or officialbuild.gradle
: Change forge dependency to latest versionbuild.gradle
: change java target to 17build.gradle
andgradle.properties
: set JEI and TOP dependencies- Update to latest gradle wrapper from MDK
- Refresh gradle
- genIntellijRuns
- Switch to gradle settings: IntelliJ
- Do the FML Legacy migration: here
- Many other fixes (also check here)
IForgeContainerType
->IForgeMenuType
- Forge Constraints class -> Block
ClientboundBlockEntityDataPacket
constructor private: use createRenderWorldLastEvent
->RenderLevelLastEvent
- Capabilities have changed: The
@CapabilityInject
annotation is gone. UseCapabilityManager.get(...)
and theRegisterCapabilitiesEvent
to register it getMatrixStack()
->getPoseStack()
ChunkGenerator
/BiomeSource
changes- Override
BlockEntity.saveAdditional()
instead ofsave()
! - Use
RenderTooltipEvent.GatherComponents
instead ofRenderTooltipEvent.Pre
- Don't override
BlockEntity.save()
! Instead overridesaveAdditional()
The Porting Tutorial
Check the two part 1.16 to 1.17 porting tutorial first:
This video follows the steps described above: Porting from 1.17 to 1.18
1.18 Step By Step
These videos will now have a table of contents for easier navigation. Note that whenever possible some remarks have been added for 1.19.2 versions of the code. The GitHub for the source code from this tutorial can be found here: TutorialV3 GitHub
Contents | Video | Wiki |
---|---|---|
Episode 1: Basic Project Setup, first mod, first blocks, datageneration | YouTube Link | Episode 1 |
Episode 2: Items, container, smelting, powergenerator, capabilities, gui | YouTube Link | Episode 2 |
Episode 3: Baked models, Block Entity Renderer | YouTube Link | Episode 3 |
Episode 4: Parchment, Entity | YouTube Link | Episode 4 |
Episode 5: Ore generation, Structures, AT's, Custom Dimension | YouTube Link | Episode 5 |
Episode 6: Configs | YouTube Link | Episode 6 |
Episode 7: World data, Player Capabilities, Networking, Overlay | YouTube Link | Episode 7 |
Episode 8: Porting to 1.18.2 | YouTube Link |
Future Subjects
- Commands
- Multiblocks
- Interfacing with other mods: JEI, TOP, Curios, ...
- Advanced Rendering
- Overlay Rendering
- Sounds
- Particle Systems