跳到正文

MesdagPortLib

作者:westernat233

To port mod from a version to another version

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

MesdagPortLib

A forward-porting library that brings modern Minecraft (1.21+) API features back to
Forge 1.20.1. Think of it as a bridge that lets mod developers use NeoForge-style APIs while
targeting the stable 1.20.1 Forge ecosystem.


✨ Key Features

♜ 17 New Player & Entity Attributes

All networked and synced automatically. Each attribute has a sentiment indicator (
positive/neutral/negative) with colored tooltips:

Attribute Default Description
player.block_break_speed 1.0 Block breaking speed multiplier
generic.burning_time 1.0 Burning time multiplier
generic.explosion_knockback_resistance 0.0 Explosion knockback resistance
generic.fall_damage_multiplier 1.0 Fall damage multiplier
generic.flying_speed 0.4 Creative flight speed
generic.jump_strength 0.42 Jump height
generic.max_absorption 0.0 Maximum absorption health
player.mining_efficiency 0.0 Mining speed modifier
generic.movement_efficiency 0.0 Movement efficiency
generic.oxygen_bonus 0.0 Underwater breathing bonus
generic.safe_fall_distance 3.0 Safe fall distance
generic.scale 1.0 Entity scale (0.0625 ~ 16.0)
player.sneaking_speed 0.3 Sneaking movement speed
player.submerged_mining_speed 0.2 Underwater mining speed
player.sweeping_damage_ratio 0.0 Sweeping edge damage ratio
generic.water_movement_efficiency 0.0 Water movement efficiency
player.creative_flight false Boolean: enable creative flight

Attributes are automatically added to all living entities via
PortEntityAttributeModificationEvent.

📊 Data Map System

A JSON-driven data system ported from 1.21 — attach typed, codec-backed values to any registry
entry:

  • Data-driven — define values in data/<namespace>/data_maps/ JSON files
  • Tag & conditional support — apply to tags, use conditional predicates
  • Merge & remove — multi-source merging with removal strategies
  • Network sync — automatic client-server negotiation and sync

Built-in data maps:

  • Compostables (portlib:compostables) — override compost chances and villager behavior
  • Furnace Fuels (portlib:furnace_fuels) — define custom fuel burn times

📦 Data Component System

Type-safe persistent data on ItemStacks, modeled after 1.21’s data components:

  • Codec-based persistence + StreamCodec-based network sync
  • Patch-based partial updates
  • PortModifyDefaultComponentsEvent for setting default components

🔗 Attachment System

NeoForge-style data attachments for entities, block entities, and levels:

  • Serializable attachments with copy-on-death support
  • Per-player sync with StreamCodec
  • Level attachments persisted to save data

🎯 220+ Ported Events

A comprehensive event system wrapping Forge events into a clean, caller-isolated API:

  • Player (34): PortPlayerHeartTypeEvent, PortSweepAttackEvent, PortCriticalHitEvent,
    PortArrowLooseEvent, PortItemTooltipEvent, PortAnvilRepairEvent,
    PortTradeWithVillagerEvent, etc.
  • Living Entity (33): PortLivingShieldBlockEvent, PortLivingIncomingDamageEvent,
    PortLivingDrownEvent, PortLivingUseTotemEvent, PortMobDespawnEvent,
    PortBabyEntitySpawnEvent, etc.
  • Client (60+): PortRenderLevelStageEvent, PortRenderTooltipEvent, PortRenderHandEvent,
    PortRenderArmEvent, PortRegisterGuiLayersEvent, PortRegisterKeyMappingsEvent,
    PortComputeFovModifierEvent, PortSelectMusicEvent, etc.
  • World/Block/Item: PortBlockDropsEvent, PortExplosionKnockbackEvent, PortPistonEvent,
    PortItemExpireEvent, PortChunkWatchEvent, etc.
  • Brewing/Enchanting: PortPotionBrewEvent, PortEnchantmentLevelSetEvent
  • Village: PortVillagerTradesEvent, PortWandererTradesEvent

Events are dispatched on the caller mod’s own event bus, keeping mod isolation clean.

🌐 Network System

  • Bundled packets — multiple logical packets in one physical message
  • Rich send targets (tracking entity, tracking chunk, dimension, near players)
  • Registry-aware FriendlyByteBuf extensions
  • VarInt/VarLong/UTF-8 codec utilities

🧩 Interface Injection

45+ vanilla classes gain new methods through interface injection + coremods:

  • Holder<T> → is(), getKey(), getRegisteredName(), getData()
  • ItemStack → setData(), getData(), data component manipulation
  • LivingEntity → getAttribute(Holder<Attribute>), removeEffectsCuredBy()
  • Registry / IForgeRegistry → extended lookup methods
  • Entity / Player / Block / Item → various extension methods

🏷 Common Tag Generation

c: namespace tags (chests, cobblestones, ores, sands, storage_blocks, etc.) for
cross-mod compatibility.


🎮 For Players

PortLib itself adds no gameplay content — it is a library mod. Install it if another mod
requires it. You will see 17 new attributes on your player and entities, but they only take effect
when modified by other mods.

常见问题

MesdagPortLib 支持哪些 Minecraft 版本?

MesdagPortLib 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

MesdagPortLib 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

westernat233 的其他作品

查看全部 →