Skip to content

Arc-Stuido/ReForged

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReForged

ReForged Logo

πŸ‡¨πŸ‡³ δΈ­ζ–‡η‰ˆ | πŸ‡¬πŸ‡§ English

Minecraft Forge Java

A compatibility bridge that enables NeoForge mods to run seamlessly on Minecraft Forge 1.21 without any modifications.

πŸ“– Overview

ReForged is an innovative runtime adapter that bridges the gap between NeoForge and Forge modloaders. It dynamically loads NeoForge mods and translates their API calls to Forge equivalents using advanced bytecode transformation techniques.

Author: Mai_xiyu
Version: 1.0.0
License: All Rights Reserved

✨ Key Features

  • πŸ”„ Zero JAR Modification β€” NeoForge mods work without repackaging or rebuilding
  • πŸš€ Dynamic Loading β€” Runtime discovery and loading of NeoForge mods
  • πŸ”§ Bytecode Transformation β€” ASM-powered translation of NeoForge API calls to Forge
  • 🎯 Event Bus Bridging β€” Transparent event system compatibility
  • πŸ“¦ Resource Integration β€” NeoForge mod assets (textures, models, recipes) automatically available
  • βš™οΈ Automatic Configuration β€” Seamless conversion of neoforge.mods.toml to Forge format
  • 🎨 Comprehensive Patching β€” 91 Mixin patches for edge case compatibility
  • πŸ› οΈ API Shims β€” Drop-in replacements for DeferredRegister, CreativeTabs, Attachments, and more

πŸ—οΈ Technical Architecture

ReForged implements a sophisticated multi-layer compatibility system:

Loading Pipeline

ReForged Initialization
    ↓
Scan mods/ folder for NeoForge JARs (neoforge.mods.toml)
    ↓
For each NeoForge mod:
    β€’ Convert metadata to Forge format
    β€’ Create isolated ClassLoader
    β€’ Transform bytecode with ASM
    β€’ Remap NeoForge API references to shim classes
    β€’ Instantiate mod with bridged event bus
    ↓
Register mod resources as Minecraft resource packs

Core Components

Component Purpose
NeoForgeModLoader Discovers and instantiates NeoForge mods at runtime
BytecodeRewriter ASM-based class transformation engine
ReForgedRemapper Rewrites NeoForge class references to Forge equivalents
NeoForgeEventBusAdapter Dynamic proxy bridging event bus systems
Shim Layer Drop-in API replacements for NeoForge classes
Mixin System 91 patches for Minecraft/Forge compatibility

πŸ“¦ Installation

  1. Install Minecraft 1.21 with Forge 51.0.33 or higher
  2. Download ReForged mod JAR
  3. Place both ReForged and your NeoForge mods into the .minecraft/mods/ folder
  4. Launch the game β€” ReForged will automatically detect and load NeoForge mods

That's it! No configuration required.

πŸ”¨ Building from Source

Prerequisites

  • Java 21 or higher
  • Git

Build Commands

# Clone the repository
git clone https://github.com/Mai-xiyu/ReForged.git
cd ReForged

# Build the mod
./gradlew build

# The compiled JAR will be in build/libs/

Development Commands

./gradlew runClient        # Launch game client
./gradlew runServer        # Launch dedicated server
./gradlew runData          # Generate data/assets
./gradlew runGameTestServer # Run game tests

πŸ› οΈ How It Works

1. Bytecode Remapping

ReForged uses ASM (Java bytecode manipulation framework) to rewrite class references:

  • net.neoforged.neoforge.common.NeoForge β†’ org.xiyu.reforged.shim.NeoForgeShim
  • net.neoforged.bus.api.IEventBus β†’ Custom proxy wrapper
  • Event registrations β†’ Forwarded to Forge's event bus

2. Event System Bridge

When a NeoForge mod registers an event listener:

NeoForge.EVENT_BUS.register(listener);

ReForged intercepts this and:

  • Analyzes the listener for @SubscribeEvent annotations
  • Registers the handler on Forge's MinecraftForge.EVENT_BUS
  • Wraps/unwraps event objects as needed for compatibility

3. Resource Pack Integration

NeoForge mod JARs are automatically registered as Minecraft resource packs, making their:

  • Textures (assets/)
  • Models
  • Recipes (data/)
  • Tags
  • Other data files

...immediately available to the game.

πŸ“‹ System Requirements

  • Minecraft: 1.21
  • Forge: 51.0.33 or higher
  • Java: 21 or higher

🀝 Compatibility

ReForged aims to provide broad compatibility with NeoForge mods, but some limitations may apply:

  • βœ… Most NeoForge API features supported
  • βœ… Event systems fully bridged
  • βœ… Registry systems (DeferredRegister) compatible
  • βœ… Creative tabs and item groups work
  • βœ… Network packets handled
  • ⚠️ Some advanced NeoForge-exclusive features may not be available
  • ⚠️ Mods with deep NeoForge integration may require additional patches

🎯 Mod Scale & Type Compatibility Guide

The table below outlines the expected compatibility for different types and scales of NeoForge mods on ReForged.

Mod Type Typical Examples Expected Compat Notes
Item / Block mods New ores, decorations, tools & weapons βœ… Excellent DeferredRegister, CreativeTabs, item properties, food components are fully bridged
Worldgen mods Custom ore veins, structures, biome modifiers βœ… Good BiomeModifier/StructureModifier framework implemented; datapack-driven generation works
Recipe / Crafting extensions Custom recipe types, conditional recipes βœ… Good ICondition system and custom RecipeSerializer available
Capability / Attachment mods Energy, fluid, item storage βœ… Good IEnergyStorage/IFluidHandler/IItemHandler fully implemented; AttachmentType bridges to Forge Capability
Network / Payload mods Custom payload communication βœ… Good PayloadRegistrar registration and bidirectional reply() implemented
Client rendering mods Custom models, particles, HUD overlays ⚠️ Partial Basic model loading (OBJ/JSON), RenderType registration, GUI events available; deep BakedModel transforms and custom shaders may need adaptation
Info / Tooltip mods Jade, WTHIT, JEI plugins ⚠️ Partial Depends on how deeply the mod relies on NeoForge extension interfaces; Jade has a dedicated Mixin patch
Large content mods Mekanism, Create, etc. ⚠️ Partial DataMap, BiomeModifier codecs, attribute modifier events, RenderBuffers injection, DimensionSpecialEffects injection, GUI layer ordering, Flywheel GPU rendering pipeline all implemented; most core features run, some edge paths may need extra patches
Core / Low-level mods Custom ModLoader extensions, ServiceLoader overrides ❌ Unsupported Mods that manipulate FML internals or NeoForge bootstrap stages cannot be shimmed

Scale Reference:

  • Small mods (< 50 classes): Only use DeferredRegister, event listeners, simple Capabilities β†’ most will run out of the box.
  • Medium mods (50–300 classes): Include custom networking, client rendering, datagen, conditional recipes β†’ core features mostly work, some advanced features may need adaptation.
  • Large mods (300+ classes): Deep use of DataMaps, custom HolderSets, multiblock entity sync, complex render pipelines β†’ case-by-case evaluation needed, some functionality may be missing.

Rule of thumb: If a NeoForge mod's core functionality only relies on the registry system + event bus + basic Capabilities (item/energy/fluid), it will most likely work on ReForged. The heavier a mod's reliance on NeoForge-exclusive deep vanilla patches, the higher the compatibility risk.

πŸ“Š Current Progress Snapshot

Latest implementation snapshot, approximate as of 2026-04-27.

Subsystem Weight Completion Weighted Score
Mod loading pipeline 20% 88% 17.6
Event system 20% 98% 19.6
Registry system 15% 95% 14.25
Capability system 10% 95% 9.5
Network / Payload 8% 84% 6.72
Extension / Common API 12% 97% 11.64
Client side 10% 98% 9.8
Mixin coverage 5% 96% 4.8
Total 100% ~94%

Recent Changes (03-09 to 04-27)

Phase 1 (03-09 β†’ 03-10): Core Event & API Framework

  • Event system (major): Added 60 Forge wrapper constructors enabling automatic event bridging via NeoForgeEventBusAdapter. Covers server lifecycle, entity, living, player, level, village, brewing, enchanting, and grindstone events.
  • ClientHooks: Expanded from 18 β†’ 108 methods with full ForgeHooksClient delegation.
  • EventHooks / CommonHooks: Added ~27 missing methods.
  • Client + Common event wrappers (~60): Full coverage for rendering, input, lifecycle, entity, chunk events.
  • Registry system: Implemented DataMap system, HolderSetType codecs, DeferredHolder tag resolution.

Phase 2–4 (03-10 β†’ 03-28): Deep Compatibility & Create/Twilight Forest Support

  • EntityEvent.Size: Added pose/oldSize/newSize/newEyeHeight fields with getters/setters.
  • GuiGraphics 9-slice rendering: New GuiGraphicsExtensionMixin implementing blitWithBorder() (9-slice) and blitInscribed() (aspect-ratio preserving).
  • CommonHooks.extractLookupProvider: Multi-field-name retry (3 mapping names) + server fallback.
  • CommonHooks.tryDispenseShearsHarvestBlock: Full harvest logic via Forge's IForgeShearable.
  • BiomeModifier codecs: All 4 types (AddFeatures/RemoveFeatures/AddSpawns/RemoveSpawns) fully implemented with RecordCodecBuilder + RegistryCodecs.homogeneousList().
  • StructureModifier: NoneStructureModifier with real MapCodec.unit() codec.
  • ClientHooks event delegation: getDetachedCameraDistance() fires CalculateDetachedCameraDistanceEvent; onScreenshot() posts to NeoForge event bus.
  • DimensionSpecialEffects: Reflective injection of mod-registered effects into vanilla's static EFFECTS map β€” fixes Twilight Forest sky rendering.
  • RenderBuffers: Reflective injection of custom RenderType buffers into BufferSource.fixedBuffers β€” fixes Create's custom rendering.
  • IEntityWithComplexSpawn: Bridged to Forge's IEntityAdditionalSpawnData with RegistryFriendlyByteBuf ↔ FriendlyByteBuf default method adapters.

Phase 5 (03-28 β†’ 03-30): Final 5% Completion Push

  • ItemStack attribute modifier hook: New Mixin injects into both ItemStack.forEachModifier() overloads, routing through IItemStackExtension.getAttributeModifiers() to fire ItemAttributeModifierEvent β€” fixes Create's dynamic attribute modifications.
  • DataMap infrastructure: RegisterDataMapTypesEvent fired during commonSetup; new DataMapInitializer populates built-in DataMaps from vanilla ComposterBlock.COMPOSTABLES and ForgeHooks.getBurnTime() (compostable values, fuel burn times).
  • EventHooks event activation:
    • canEntityContinueSleeping() β†’ fires CanContinueSleepingEvent returning event result
    • getEnchantmentLevelSpecific() / getAllEnchantmentLevels() β†’ fires GetEnchantmentLevelEvent with modifiable enchantment map
    • getCustomSpawners() β†’ fires ModifyCustomSpawnersEvent with mutable spawner list
  • GetEnchantmentLevelEvent: Upgraded to carry a modifiable Map<Holder<Enchantment>, Integer> enchantment map.
  • ModifyCustomSpawnersEvent: Upgraded to carry a mutable List<CustomSpawner> spawner list.
  • RegisterGuiLayersEvent ordering fix: registerAbove()/registerBelow() now use ForgeLayeredDraw.addAbove()/addBelow() for correct Z-ordering β€” fixes Create goggle/schematic overlay display.

Phase 6 (03-30 β†’ 04-05): Create Accessor Bridge & Flywheel GPU Rendering Pipeline

  • Create Accessor Interface Bridge (33 interfaces): Complete BytecodeRewriter-based solution for all 33 Create accessor/extension interfaces. CHECKCAST redirects from NeoForge accessor types to vanilla MC target classes; INVOKEINTERFACE β†’ INVOKEVIRTUAL rewrites. 24 new Mixin files inject accessor method bodies into vanilla classes (e.g., LevelRendererAccessorMixin, ParticleEngineAccessorMixin, GameRendererAccessorMixin).
  • Flywheel Accessor Interface Bridge (10 interfaces): Same pattern applied to all 7 Flywheel accessor interfaces + 3 extension interfaces. Covers LevelRendererAccessor, AbstractClientPlayerAccessor, LightEngineAccessor, LayerLightSectionStorageAccessor, SkyDataLayerStorageMapAccessor, ModelPartAccessor, PoseStackAccessor, plus LevelExtension, PoseStackExtension, SkyLightSectionStorageExtension.
  • Flywheel Render Pipeline Hooks: FlywheelLevelRendererMixin injects into LevelRenderer.renderLevel() at 4 injection points (beginRender, beforeBlockEntities, beforeCrumbling, endRender). FlywheelRenderBridge uses reflection to invoke Flywheel's FlwBackend / VisualizationManagerImpl through the NeoModClassLoader boundary.
  • EventBusHelper Boolean ClassCast Fix: Rewrote postAndReturn() to bypass the IEventBus proxy entirely β€” calls NeoForgeEventBusAdapter.dispatchFallback() + MinecraftForge.EVENT_BUS.post() directly, eliminating ReloadLevelRendererEvent cannot be cast to Boolean.
  • SkyLightSectionStorage Extension: Complex mixin implementing Flywheel's flywheel$skyDataLayer(long) β€” traverses upward through light sections using FlywheelSkyStorageMapHelper (transformer-classloader interface) to bridge SkyDataLayerStorageMap's package-private fields.
  • AABB.INFINITE CoreMod: JavaScript coremod patches AABB class to add the INFINITE static field (NeoForge addition not present in Forge).
  • Standalone ModelResourceLocation: CoreMod fixes ModelResourceLocation.standalone() factory method for models without block state variants.
  • Verifier Stack Frame Fix: BytecodeRewriter now patches stack frame types to replace NeoForge accessor interface descriptors with vanilla MC class descriptors β€” fixes VerifyError from JVM bytecode verification.

Phase 7 (04-27): Create/Flywheel Stability and Client API Convergence

  • Flywheel render stabilization: FlywheelRenderBridge now owns the client render coordination path for camera mode changes, render origin changes, GL state sync, fog/light uniform sync, deferred visual refresh, block entity visual lifecycle, and vanilla-render skip decisions.
  • Third-person stability: Removed the diagnostic third-person afterEntities short circuit and kept first/third person on the same state synchronization path, fixing the large black Flywheel geometry failure without relying on high-frequency logs.
  • Reload/re-entry recovery: Added bounded visual refresh behavior for renderer reloads, camera mode transitions, render-origin moves, and light/section invalidation so Create/Flywheel block entity visuals recover after F3+A, world re-entry, block updates, and lighting changes.
  • NeoForge fluid and decorator APIs: FluidType.wrap() is the single Forge-to-NeoForge fluid wrapper entry point; FluidInteractionRegistry now follows the NeoForge FluidType + Function<FluidState, BlockState> shape; item decorators are normalized to Forge IItemDecorator.
  • Recipe/data pack compatibility: NeoForge recipe conditions, fluid ingredients, conditional recipe codecs, and optional entity-type tag entries are normalized for Forge's loader, reducing safe-world creation warnings from Create data.
  • RegisterEvent classloader hardening: Neo mod loading now anchors to the game classloader and event callbacks temporarily use the NeoMod context classloader, reducing AppClassLoader/TransformingClassLoader splits during entity and registry initialization.
  • Model and overlay polish: Additional geometry now receives real section context, AO/model data bridging is retained, and Create factory panel vanilla overlay rendering is preserved so center item/count overlays can render on top of Flywheel visuals.

Notes

  • The percentages above are engineering estimates, not formal test pass rates.
  • 865 Java source files total, including 688 net.neoforged shim files and 100 mixin files, plus 10 JavaScript CoreMods.
  • Only 4 UnsupportedOperationException remain β€” all intentional by design (e.g. PartEntity.getAddEntityPacket(), ClientCommandSourceStack.getServer()).
  • The biggest remaining gaps are advanced entity sync protocols, NeoForge-exclusive deep vanilla patch behavior (e.g. PistonPushReaction extension), custom low-level loader integration, and uncovered edge paths in large mods beyond the Create/Flywheel validation matrix.

πŸ“ Project Structure

ReForged/
β”œβ”€β”€ src/main/java/org/xiyu/reforged/
β”‚   β”œβ”€β”€ Reforged.java              # Main mod entry point
β”‚   β”œβ”€β”€ core/                      # Mod loading and ASM transformation
β”‚   β”œβ”€β”€ shim/                      # API replacement layer
β”‚   β”œβ”€β”€ bridge/                    # Event and system bridges
β”‚   β”œβ”€β”€ asm/                       # Advanced bytecode manipulation
β”‚   β”œβ”€β”€ mixin/                     # Mixin patches for compatibility
β”‚   └── util/                      # Utility classes
β”œβ”€β”€ src/main/resources/
β”‚   β”œβ”€β”€ META-INF/
β”‚   β”‚   β”œβ”€β”€ mods.toml             # Forge mod metadata
β”‚   β”‚   └── accesstransformer.cfg # Access widening config
β”‚   β”œβ”€β”€ reforged.mixins.json      # Mixin configuration
β”‚   └── coremods/                 # JavaScript CoreMod patches
└── build.gradle                   # Build configuration

πŸ” License

All Rights Reserved Β© 2025-2026 Mai_xiyu

πŸ™‹ Support

If you encounter issues or have questions:

  1. Check if the NeoForge mod is compatible with Forge 1.21
  2. Verify Java 21 is installed
  3. Check the game logs for error messages
  4. Open an issue on the GitHub repository

🌟 Credits

Developed by Mai_xiyu

Special thanks to:

  • The Forge team for the Forge modding API
  • The NeoForge team for the NeoForge modding API
  • The ASM and Mixin communities for bytecode manipulation tools

Note: This is a community project and is not officially affiliated with or endorsed by the Forge or NeoForge teams.

About

ReForged - A compatibility bridge to run NeoForge mods on Minecraft Forge 1.21.1 without modification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors