How ice129/engram-horror-mod works
Project type and purpose
• This is a Java-based Minecraft mod (“ENGRAM”) built on the Fabric mod loader.
• Its purpose is to inject horror mechanics into the vanilla Minecraft experience via custom entities, world events, configuration, networking, and client-side visual/audio hooks.
File structure
• Top-level Gradle build files and settings.gradle configure the build.
• src/main/java contains one package tree (horror.blueice129) subdivided into:
• Core mod classes (HorrorMod129.java, data generator)
• Client-only code (client/… for renderers, model registration, input hooks)
• Command definitions (command/DebugCommands.java)
• Configuration (config/ConfigManager.java, ModConfig.java, ConfigScreen.java)
• Data persistence (data/HorrorModPersistentState.java)
• Debug utilities (debug/LineOfSightChecker.java)
• Entity definitions (entity/…), AI goal implementations (entity/goals/...)
• Gameplay features (feature/…, e.g. BrightnessChanger, SmallStructureEvent)
• Integration adapters (integration/ModMenuIntegration.java)
• Mixin hooks into Minecraft internals (mixin/ExampleMixin.java)
• Networking (network/ModNetworking.java, packet handlers)
• Scheduled tasks (scheduler/…), tied to in-game ticks/world events
• Utility helpers (utils/…) for pathfinding, block placement, etc.
• src/main/resources delivers assets (textures), Fabric metadata (fabric.mod.json), mixin config, and data-pack templates (JSON under data/…).
README for additional insights
• Confirms it’s a single-mod plugin for Fabric.
• Lists multiplayer support, custom events, progressive horror features, and encourages contributions.
a. Main components
• Fabric Mod Loader
• Core Mod Module (HorrorMod129)
• Client Subsystem (renderers, input hooks, UI screens)
• Server Subsystem (world events, schedulers, entity spawning, persistent state)
• Entity & AI Engine (custom entity classes + goal registries)
• Feature Handlers (individual gameplay features)
• Configuration Manager & UI
• Data-Pack Generator (build-time JSON producer)
• Networking Layer (custom packets & channels)
• Mixin Layer (bytecode hooks into vanilla code)
• External Integration (e.g. ModMenu)
b. Relationships & interactions
– Fabric invokes Core Mod Module on game startup → registers event listeners, entities, network channels, data generators.
– Client Subsystem communicates with Core via Fabric’s client lifecycle events; listens for incoming network packets to trigger camera shakes or UI changes.
– Server Subsystem schedules tasks each tick → triggers Feature Handlers (e.g. spawn events), updates PersistentState, enqueues network payloads to clients.
– Entity & AI Engine uses Utils classes for movement, pathfinding, and registers custom AI Goals.
– Config Manager loads/writes ModConfig on disk; provides runtime parameters to features and schedulers; UI screens allow in-game editing via ModMenuIntegration.
– Data-Pack Generator runs during the Gradle build → emits JSON under data/horror_mod_129 for worldgen defaults.
– Mixin Layer patches vanilla methods as needed (e.g. to modify block breaking, camera effects).
– Networking Layer serializes SettingsTriggerPayload and other packets → ClientPacketHandler processes them on the client.
c. Architectural patterns & principles
• Event-driven design: Fabric event bus and schedulers
• Separation of concerns: clear split between client vs server behavior, config vs logic, data vs code
• Modular features: each horror effect encapsulated in its own class + scheduler
• Data-oriented setup: data generators and JSON templates for world changes
• Decorator/Adapter via Mixins to modify vanilla behavior without core forks
d. Key technologies/frameworks
– Java 17, Gradle
– Fabric API (lifecycle events, registry system)
– Fabric Mixin (bytecode injection)
– Minecraft’s built-in networking hooks
– Fabric Data Generators for JSON pack creation
– ModMenu integration (external mod UI)