![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
A number of things to fix when you branch your 1.15.2 code and try to compile it under 1.16.3:
General
- 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 'license' field is now required in
mods.toml
. - 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. - Join the Forge Project Discord and mind your manners; they can provide invaluable advice on modding current versions of Minecraft. You will be expected to heed the Discord rules and already know basic Java programming
Server-side
Items & Blocks
- IArmorMaterial enums have a new mandatory method to implement that returns the knockback resistance.
- Blocks need to have .setRequiresTool() added to initialization, or else they can be harvested bare-handed, no matter the harvestLevel.
- Your
DeferredRegister
classes now must use thecreate()
method rather thannew
. 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 aToIntFunction<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.
- Coding tags has changed slightly.
- Entities no longer have a registerAttributes() override, but instead prepare their attributes
in a static method and add them to
GlobalEntityTypeAttributes
in theFMLCommonSetupEvent
event handler. Example:
And for SilverGolemEntity.prepareAttributes():@SubscribeEvent public static void onCommonSetup(final FMLCommonSetupEvent event) { DeferredWorkQueue.runLater( ()-> { GlobalEntityTypeAttributes.put(ModEntities.silver_golem.get(), SilverGolemEntity.prepareAttributes().create()); }); } // end onCommonSetup
public static AttributeModifierMap.MutableAttribute prepareAttributes() { return MobEntity.func_233666_p_() .createMutableAttribute(Attributes.MAX_HEALTH, 35.0D) .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.5D) .createMutableAttribute(Attributes.KNOCKBACK_RESISTANCE, 1.0D) .createMutableAttribute(Attributes.ATTACK_DAMAGE, 15.0D); }
World Generation
- Has all changed drastically, as vanilla world generation is now JSON driven.
- Forge provides an Event,
BiomeLoadingEvent
, that you use to add features to a biome as it is loaded. - Use too complex to explain here. To see it in action, see my SimpleOres2 1.16.3 GitHub. Helper classes are in SimpleCoreLib for 1.16.3.
Client-side
- 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().
- 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.registerProperty(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.registerProperty(bow, new ResourceLocation("pulling"), (p0, p1, p2) -> { return p2 != null && p2.isHandActive() && p2.getActiveItemStack() == p0 ? 1.0F : 0.0F; }); }