Skip to content

Instantly share code, notes, and snippets.

@Sinhika
Last active August 7, 2020 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sinhika/89723e27ed966532f5122a181c4b4046 to your computer and use it in GitHub Desktop.
Save Sinhika/89723e27ed966532f5122a181c4b4046 to your computer and use it in GitHub Desktop.
Notes on porting Minecraft mods from 1.15.2 to 1.16.1 Forge
A number of things to fix when you branch your 1.15.2 code and try to compile it under 1.16.1:
- Client-side GUI methods all have a new argument in front, MatrixStack. It's passed in from the caller and needs to be
passed to most subordinate methods, including blit().
- Use the mapping snapshot for 20200723 or later; before that, the mappings were incomplete in some important areas,
such as client-side GUIs.
- Don't forget to update mods.toml as well as your gradle properties.
- The code for displaying arrows on bows was removed from BowItem and moved to some private method. Either use access
transformers to access that private method, or just cut & paste the initialization code to a static method somewhere and
call it in your FMLClientSetupEvent handler.
It looks something like this:
private static void setupBowModelProperties(Item bow)
{
ItemModelsProperties.func_239418_a_(bow, new ResourceLocation("pull"), (p0, p1, p2) -> {
if (p2 == null) {
return 0.0F;
} else {
return p2.getActiveItemStack() != p0 ? 0.0F : (float)(p0.getUseDuration() - p2.getItemInUseCount()) / 20.0F;
}
});
ItemModelsProperties.func_239418_a_(bow, new ResourceLocation("pulling"), (p0, p1, p2) -> {
return p2 != null && p2.isHandActive() && p2.getActiveItemStack() == p0 ? 1.0F : 0.0F;
});
}
- A number of Minecraft class paths were changed (such as the Loot stuff). Your IDE should handle that for you.
Shift-Ctrl-O in Eclipse; I don't know what IntelliJ's keybind is.
- IArmorMaterial enums have a new mandatory method to implement that returns the knockback resistance.
- Your DeferredRegister classes now must use the create() method rather than new. This was introduced late in 1.15.2,
so if you have used the more recent 1.15.2 Forge versions to develop against, it will not be a surprise.
- Setting the light_level for a block got slightly more complicated. 1.16.1 now enforces setting it in the BlockState
(not the Block) via the new setLightLevel() Property method that takes a ToIntFunction<BlockState> value as an argument.
See vanilla code for examples of how this works--I'm not doing all your work for you ;-)
- A block being a beacon base is now a tag in 'data/minecraft/tags/blocks/beacon_base_blocks.json', rather than a
boolean function in the block class.
- (Introduced late in 1.15.2) Forge finally added a tag, 'data/forge/tags/items/shears.json' that lists modded items
that should act like vanilla shears. No more complicated workarounds using GlobalLootModifiers needed!
- (Also introduced in 1.15.2) Minecraft added a tag for plants that are affected by bee pollination,
'data/minecraft/tags/blocks/bee_growables.json'. However, this includes everything included in the
'data/minecraft/tags/blocks/crops.json tag, so if your plant is a harvestable crop, tag it in #minecraft:crops
- In general, vanilla Minecraft now has a lot of tags that add special handling to blocks and items, check them out and
be aware of them.
- Ore generation is mostly unchanged, though Feature definition has changed. Dimension & chunk generation definitely
changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment