NeoForge 1.20.2 Porting Notes ============================== Most of these are just notes from looking through git diffs, or what other people have said. It's by no means complete, and is probably way too detailed for the average modder. Vanilla Changes ---------------- ### General - Resource pack and data pack version bumped to 18 - New feature flag: `TRADE_REBALANCE` - Various classes have been converted to records (where applicable) ### Blocks - New method `BlockStateBase#is(Holder<Block>)` - New sound types `SPONGE` and `WET_SPONGE` - `SimpleWaterloggedBlock#canPlaceLiquid` now has a new first `Player` parameter - `BonemealableBlock#isValidBonemealTarget` no longer has the last `boolean` parameter - `BlockBehavior.Properties#noParticlesOnBreak` was renamed to `BlockBehavior.Properties#noTerrainParticles` - This includes all related methods, fields etc. - `BarrierBlock` now implements `SimpleWaterloggedBlock` - `BlockSourceImpl` and `PositionImpl` have been removed - `BlockSource` has been moved and made a record type ### Items - Usable items now trigger interaction game events - `BrushItem#spawnDustParticles` has been made private - New method `ItemStack#is(HolderSet)` for set-based comparisons - New method `MapItem#getTooltipForId(ItemStack)` - `ItemStack#setRepairCost` now removes the repair cost tag if the given value is lower than 0 - `PlayerHeadItem` profile loading has been refactored - Removed method `SmithingTemplateItem#getDescriptionId` - `SuspiciousStewItem` has been refactored: - NBT rename `Effects` -> `effects` - Removed `EFFECT_ID_TAG` and `EFFECT_DURATION_TAG` - Now serializes effects using codecs from `SuspiciousEffectHolder` #### Armor Trims - `ArmorTrim#getTrim` now has an additional boolean parameter - This enables/disables warnings when failing to find the trim - `TrimPattern` now has an additional boolean parameter/field ### Entities - New synced entity attributes - Entities now trigger more game events - NBT keys were changed: - AreaAffectCloud `Effects` -> `effects` - LivingEntity `ActiveEffects` -> `active_effects` - Arrow `CustomPotionEffects` -> `custom_potion_effects` - Mooshrooms now have a list of effects rather than one - Stored in `stew_effects` NBT tag - Method changes on `Entity`, most of these are for the new passenger handling: - New method `Entity#canControlVehicle` - New method `Entity#isInLiquid` that also considers lava - New method `Entity#getPassengerRidingPosition` for getting riding position - New method `Entity#getPassengerAttachmentPoint` for getting passenger attachment point - New method `Entity#lerpPositionAndRotationStep` - New method `Entity#ridingOffset` for returning riding offset for given entity - New methods `Entity#lerpTarget...` for getting target x/y/z and rotation - Method `Entity#getMyRidingOffset` now requires an `Entity` parameter - Method `Entity#lerpTo` no longer requires a boolean - Removed method `Entity#canEnterPose` - Removed method `Entity#getPassengerRidingOffset` - Removed method `Entity#getBoundingBoxForPose` - New class `Camel$CamelLookControl` - New method `Boat#getTypeName()` - New method `Camel#canCamelChangePose` - New method `EntityType#is(HolderSet)` - New method `PathfinderMob#isPanicking`, used in leash ticking - New method `Raids#factory` for use with DFU - Renamed `GlowSquid#checkGlowSquideSpawnRules` to `checkGlowSquidSpawnRules` (typo fix) - Renamed `AbstractChestedHorse#getPassengersRidingOffset()` to `getPassengersRidingOffsetY` - Removed class `RiderShieldingMount` - `EquipmentSlot` and `HumanoidArm` now have `Codec`s and implement `StringRepresentable` - Villager trade logic has been refactored - Raid component constants/translation keys have changed #### LivingEntity - Caps health and absorption when changing attributes - New method `LivingEntity#getHitbox` - New method `LivingEntity#getMaxAbsorption` - New method `LivingEntity#wouldNotSuffocateAtTargetPose` - `LivingEntity#aiStep` now uses lerp helper methods - Removed method `LivingEntity#getMeleeAttackReferencePosition()` #### Mob - New constant `DEFAULT_ATTACK_REACH` - New method `Mob#getAttackBoundingBox` - Removed method `Mob#getMeleeAttackRangeSqr` - Replaced with `Mob#isWithinMeleeAttackRange` - Removed method `Mob#getPerceivedTargetDistanceSquareForMeleeAttack` #### Attributes - New attribute `MAX_ABSORPTION` - `AttributeInstance#removeModifier(AttributeModifier)` has been made private - `AttributeModifier$Operation` now has a `Codec` and implements `StringRepresentable` #### Player - New constants `DEFAULT_MAIN_HAND` and `DEFAULT_MODEL_CUSTOMIZATION` - New method `Player#canPlayerFitWithinBlocksAndEntitiesWhen` - Most player pose checks now use this method - Removed method `Player#setAbsorptionAmount` - Replaced with protected `Player#internalSetAbsorptionAmount` #### AI - Melee attack goals now check AABB - New method `MeleeAttackGoal#canPerformAttack` - Removed method `MeleeAttackGoal#getAttackReachSqr` - Removed double parameter from `MeleeAttackGoal#checkAndPerformAttack` - Most entities now use `MeleeAttackGoal` directly rather than subtyping it - `FollowTemptation` constants have changed - Breeding goals/behaviors now check and remember `isPanicking` - Vehicle checks have been replaced by `hasControllingPassenger` checks - Gossip weights have been changed - `GroundPathNavigation#createPath` now returns no path if the given blockPos has no chunk - Striders no longer have a PanicGoal field - Removed method `PathNavigation#isInLiquid()` - Replaced with `Entity#isInLiquid` ### Mob Effects - Mob effects in general have been refactored - Several changes to `MobEffect` - Addition of `onEffectStarted`, `shouldApplyEffectTickThisTick` - Removal of `byId`, `getId`, `getIdFromNullable`, `getAttributeModifierValue`, `isDurationEffectTick` - Removal of hardcoding in `applyEffectTick` and `applyInstantaneousEffect` - All uses of `AttributeModifier` were changed to `AttributeModifierTemplate` - `addAttributeModifier` remains in place as usual - NBT keys in `MobEffect` were changed - "Ambient" -> "ambient" - "Amplifier" -> "amplifier" - "Duration" -> "duration" - "FactorCalculationData" -> "factor_calculation_data" - "HiddenEffect" -> "hidden_effect" - "Id" -> "id" - "ShowIcon" -> "show_icon" - "ShowParticles" -> "show_particles" - Mob effects now properly use classes for functionality, replacing the hardcoding in `MobEffect`; some of these already existed and were modified in accordance with the changes to `MobEffect` - `AbsorptionMobEffect` - `AttackDamageMobEffect` (strength and weakness) - `BadOmenMobEffect` - `HealOrHarmMobEffect` (instant damage and instant health) - `HealthBoostMobEffect` - `HungerMobEffect` - `PoisonMobEffect` - `RegenerationMobEffect` - `SaturationMobEffect` - `WitherMobEffect` - New `AttributeModifierTemplate` interface for creating `AttributeModifier`s ### Codecs & Serialization - New class `CraftingRecipeCodecs` - New miscellaneous codecs in `ExtraCodecs` - `GsonHelper` methods have been converted to return Holders - `Ingredient`, `Ingredient.Value` and subclasses were changed to use `Codec`s - Recipe serializers were changed to use `Codec`s - Various classes and serializers for advancements were changed to use `Codec`s - Various classes and serializers for loot tables were changed to use `Codec`s - Various classes and serializers for structures and other worldgen-related stuff were changed to use `Codec`s ### Registries - `registerMapping` no longer exists - Mob effects, enchantments, potions and block entity types now have intrusive holders ### Options & Skins - `KeyboardHandler`, `MouseHandler` and `Options` have been refactored - The way skins are loaded has been tweaked - The new `PlayerSkin` record holds information about a player's skin, model and textures - `DefaultPlayerSkin` has been refactored to use `PlayerSkin` - `SkinManager` has been almost entirely rewritten ### Commands - New `CommandHistory` type for storing client command history - Command arguments have been refactored to support new holder types ### Menus - The old `RecipeHolder` has been renamed to `RecipeCraftingHolder` - Crafting menus have been refactored to use `RecipeHolder<?>` (see the Recipes section below) - `AbstractFurnaceMenu` progress methods now return `float` - `BeaconMenu` now has convenience methods for effect encoding/decoding - This uses `BuiltInRegistries.MOB_EFFECT` - `InventoryMenu` no longer implements `Equipable` - `SmithingMenu` now uses `OptionalInt` instead of `Optional<Integer>` - New `Slot#setByPlayer` overload accepts an additional ItemStack - This appears to be used for the previous item? ### GUIs - Most graphical elements have been separated into separate images - HUD Widget rendering has been refactored - HeartType now has multiple ResourceLocations for each variant of icon - New GuiSpriteManager type handles scaling and UV coordinates for sprites - Textures are combined into a single texture atlas - GuiGraphics now has a GuiSpriteManager - blit methods are now suffixed with Sprite - Almost all methods are implemented in terms of SpriteManager - GUI component rendering has been refactored - Debug overlay has been separated into separate components - Chart types inherit from AbstractDebugChart (Bandwidth, FPS, Ping, TPS) - New components: - LoadingDotsWidget renders a component + dots with a specified font - PlayerSkinWidget renders a player model - SpriteIconButton renders different types of buttons - Deleted components: - TextAndImageButton - New WidgetSprites type holds different sprites for different widget states (hovered, focused, disabled, etc) - Tabs no longer have a tick method - Recipe and Advancement toast components now use their respective Holder type - New layout types have been added: - CommonLayouts provides for labeled elements - EqualSpacingLayour provides for equal spacing between elements - Existing layout types have been refactored: - LinearLayout - Screen now renders the background in its render() method - renderBackground now has mouse x/y and partial tick parameters - Advancement widgets have been refactored to use their holder and node types - New ServerReconfigScreen displayed during connection - New report screen base type for all report screens ### Multiplayer & Networking - New ChunkBatchSizeCalculator type for calculating chunk batch sizes for networking - Client chunk caching now uses this type - ClientAdvancements has been refactored to use tree/holder/node types - As has PlayerAdvancements and ServerAdvancementManager on the server - New ClientCommonPacketListenerImpl type now handles some networking with subtypes: - ClientConfigurationPacketListenerImpl handles configuration when connecting - ClientHandshakePacketListenerImpl handles authorization and branding - ClientPacketListener handles directing to the correct implementation as well as gameplay - Player skin lookup in PlayerInfo has changed - LocalPlayer has been refactored: - Server brand is removed - Added individual limited crafting - Recipe highlight works using RecipeHolder - Connection and ConnectionProtocol have been refactored a lot - There are a bunch of new convenience methods on FriendlyByteBuf - New PacketFlowValidator type validates packets - New Utf8String type for reading/writing UTF-8 encoded strings - New VarInt type for reading/writing VarInts - New VarLong type for reading/writing VarLongs - ChatDecorator no longer returns a CompletableFuture, just a Component - New debug payloads for debug renderers and gametests #### Server - New ServerInfo interface contains server info as shown in the server list - ServerInterface now inherits this interface - ServerScoreboard has been refactored to use DisplaySlot - AdvancementVisibilityEvaluator now uses AdvancementNode and Optional - ChunkHolder now has a syncing dependency - ChunkMap has been refactored to use ChunkTrackingView - new ChunkTrackingView interface for tracking which chunks a player has loaded - ServerPlayer has new fields and methods - Recipe methods have been refactored to use RecipeHolder - Chunk tracking is no longer handled here - New ConfigurationTask interface for handling configuration tasks for a connection - New PlayerChunkSender type for batch-sending chunks to a player - New CompositePackResources type for composing one or more packs into a single collection - PackMetadataSectionSerializer has been deleted, now serialised using codecs ### Rendering - BEWLR skull rendering has been refactored - GameRenderer.render now checks if the game load has finished - Mangrove logs no longer have an entry in ItemBlockRenderTypes - ItemInHandRenderer no longer changes texture for player skin directly - LevelRenderer now works in terms of sections rather than chunks - Section occlusion is handled using a graph - various fields and methods have been removed - Lots of refactoring based on sections - RenderBuffers also operates in terms of sections rather than chunks - Armor render types have been changed slightly - New SectionOcclusionGraph type handles updating chunks in frustrum for rendering - New armor trim render type and sheet in Sheets - ViewArea has been refactored in terms of sections rather than chunks - SkullBlockRenderer uses a different method to look up the player's skin - ChunkRenderDispatcher has been refactored in terms of sections rather than chunks and renamed SectionRenderDispatcher - Debug renderers have been refactored: - Many renderers now use payloads from networking to compute information - GameEventListenerRenderer now uses ResourceKey - StructureRenderer uses ResourceKey instead of DimensionType - EntityRendererDispatcher and EntityRenderers now use PlayerSkin.Model for looking up player skin types - Parts of player skins (e.g. capes, elytras, etc) have been refactored to use PlayerSkin type - SpriteLoader has been refactored - runSpriteSuppliers takes a List of Functions instead of Suppliers - there is a new set of MetadataSectionSerializers - TextureAtlas now has a missing texture sprite - TextureAtlasSprite no longer divides UV coordinates by 16 - SpriteResourceLoader is now an interface - New SpriteSourceList type for retrieving sprites from a ResourceManager - BuiltInPackSource now has a DirectoryValidator parameter ### Resources - TextureAtlasHolder has been refactored, now has a set of metadata sections - New client resource metadata can be specified: - GuiMetadataSection handles GUI scaling: - stretch for stretching - tile for tiling - nine_slice for nine-slicing - Built-in models have been refactored slightly ### Data #### Advancements - Most fields have been changed to use `Optional` instances - There's a new type for modelling the entire tree #### Recipes - New record `RecipeHolder` which stores an id and a `Recipe` - Most types now use `RecipeHolder` instead of `Recipe` directly - `AbstractCookingRecipe#category` was made protected - Removed method `Recipe#getId` - Consequently, most recipe classes' `id` fields and constructor parameters were removed as well - Removed method `DecoratedPotRecipe#createDecoratedPotItem` #### Data Generation - Some block families have been renamed - New static saveStable method on DataProvider using codecs - AdvancementProvider and AdvancementSubProvider now use AdvancementHolder - FinishedRecipe getter methods have dropped their 'get' prefix - advancementId now uses AdvancementHolder - RecipeBuilder has been refactored: - uses Criterion\<?> instead of CriterionTriggerInstance - uses RecipeOutput interface instead of Consumer - New RecipeOutput interface allows building advancements too - RecipeProvider has been refactored to use RecipeOutput interface and AdvancementHolder - Recipe builders no longer have an advancement field - Instead they have a map of criterion - A default advancement is added in save() - This contains the has\_the\_recipe criterion by default - The criterion are added to this advancement - New damage type tags for not applying knockback and always killing armor stands ### Gametests - Some methods in GameTestHelper have been deprecated - DisplaySlot??? - ResourceMetadata??? ### Miscellaneous - New shared constants: `DEBUG_UNLOCK_ALL_TRADES` and `MILLIS_PER_TICK` - New `ArrayListDeque` type - New `SampleLogger` class - New `PngInfo` record - `RandomSequences` was changed - Now uses the world seed and an independent salt value - Uses `DirtyMarkingRandomSource` internally, which marks itself dirty after generating a random value - Some other minor changes - Initial game startup has changed with `Minecraft.GameLoadCookie` - Removed `Stats#getTranslationKey` - `Stats#getDisplayName` is used instead - Several minor changes to the profiler and datafixers - `FrameTimer` and `TimeStamped` have been removed NeoForge Changes ----------------- ### NeoGradle - Update to NeoGradle 7 - `build.gradle` is now significantly shorter - The only things that should be changed are the Minecraft and Forge versions. Things like the mod id, group etc. are no longer needed - Multi-mod setups do not work at the moment, please use multiple projects instead. It has not yet been decided if multi-mod setups will be coming back or not - Mixingradle has been replaced with the NeoGradle mixin plugin - NeoGradle 7 is natively compatible with Gradle, which means things like configuration caches can be used - Deobfuscation is gone, `fg.deobf` is not needed anymore - To update, simply copypaste the example `build.gradle` at https://github.com/neoforged/NeoGradle/blob/FG_7.0/examples/runs/build.gradle and adapt as needed - If you're using mixins, use the example `build.gradle` at https://github.com/neoforged/NeoGradle/blob/features/mixin/examples/mixin/build.gradle instead - DeferredRegister now uses holders and vanilla registries internally - Mods now need to declare which side they aim to run on. This doesn't affect them at runtime. ### DeferredRegister - RegistryObject has been deprecated, pending removal. - The replacement is DeferredHolder. This works much like any other holder, except it is dynamically retrieved from registries as needed. - DeferredHolder implements Holder, so it can be directly passed to any vanilla APIs expecting a holder: - Tag data generation ### Networking - NetworkEvent.Context has had its supplier wrapper removed - 'consumer' was removed in favour of explicit mainThread/networkThread - SimpleChannel#simpleMessageBuilder was added along with SimpleMessage, reducing boiler-plate needed for message registration to just the decoder (as encoder, and network/main thread handlers are in that interface) ### GLMs - GLMs now support forge:conditions, GlobalLootModifierProvider now has add overloads with a varag condition array / condition list - GLMs can now decode holders as they have a registry ops available