📄
pasted-code-1776460859043.txt
txt
213 lines
▶
Create a Minecraft Fabric mod (1.21.4) named **“Reality Collapse”**, a psychological horror progression system where Minecraft gradually becomes unstable as if reality is being overwritten.
The mod must prioritize **early player engagement**, long-term escalation, and unpredictable anomalies that create paranoia (“bug or intentional?”).
---
## CORE DESIGN GOAL
The world becomes increasingly corrupted through layered systems:
* visual distortion
* audio anomalies
* entity behavior corruption
* block instability illusions
* lore/system messages
All systems must:
* be modular (config toggleable)
* use cooldowns (no spam)
* avoid permanent world corruption unless explicitly enabled
* prefer client-side illusions over real world changes
---
## CRITICAL EARLY GAME REQUIREMENT
Within the first **3–5 minutes**, the player MUST experience:
* 1 visual anomaly
* 1 audio anomaly
* 1 entity anomaly
To guarantee this, include a forced early instability layer.
---
## CORE SYSTEM: REALITY STABILITY
Global variable:
Reality Stability (0–100)
* starts at 100
* decreases via time played, darkness, underground time, random decay, and early scripted decay
* lower stability increases anomaly frequency and severity
Commands:
* /collapse stability get
* /collapse stability set <0–100>
---
## PHASE SYSTEM (HYBRID: TIME + STABILITY + EXPERIENCE)
### PHASE 0.5 — Instability Leak (FIRST 1–5 MINUTES)
Trigger: first minutes OR stability < 95
Effects:
* rare block texture flicker (instant revert)
* cave sound in open air (subtle)
* one mob briefly stares at player
* footstep echo duplication (once)
* micro screen distortion
---
### PHASE 1 — Stable Reality
Trigger: days 0–5 OR stability > 80
* rare glitch frames
* subtle sound distortion
* occasional 0.2s entity freeze
* faint “wrong lighting” moments
---
### PHASE 2 — Early Corruption
Trigger: days 6–10 OR stability 60–80
* temporary block swaps (auto revert)
* sky flicker
* mobs occasionally face player unnaturally
* echo duplication increases
* slight pathfinding hesitation
---
### PHASE 3 — Structural Breakdown
Trigger: days 11–20 OR stability 30–60
* gravity anomalies (floating entities)
* fake chunk desync illusions
* biome color degradation
* redstone delay glitches
* water direction inversion illusions
---
### PHASE 4 — Reality Failure
Trigger: days 21+ OR stability < 30
* terrain “breathing” illusion
* camera micro drift
* entity position desync illusions
* missing chunk fog illusions
* sky corruption cycles
* temporary block cluster rearrangement
---
## ENTITY CORRUPTION SYSTEM
Phase scaling behavior:
Phase 0.5: rare stare at player
Phase 1: hesitation before movement
Phase 2: early detection / clustering
Phase 3: group freezing before attacks
Phase 4: predictive movement + fake retreat behavior
---
## LORE SYSTEM
Random messages triggered during anomalies:
Examples:
* “You are not the original instance.”
* “Chunk memory mismatch detected.”
* “Reality rollback failed.”
* “This world was loaded incorrectly.”
* “You are being observed between ticks.”
Delivery:
* chat messages
* floating text (3 sec)
* cave glyphs
* rare sign generation near player bases
---
## EVENT SYSTEM
Random, cooldown-based events weighted by stability:
Types:
* visual glitch
* audio anomaly
* block instability illusion
* entity corruption
* rare Observer event
Ensure frequent early events for onboarding.
---
## ULTRA RARE EVENT: OBSERVER
* appears at render distance edge
* visible 1–2 seconds
* does not move when looked at
* disappears without trace
* very low probability (slightly increases in low stability)
---
## COMMAND SYSTEM
* /collapse phase set <1–4>
* /collapse stability get/set
* /collapse event trigger/stop
* /collapse lore
* /collapse debug on/off
* /collapse reset
---
## PERFORMANCE RULES
* no permanent world edits unless enabled
* client-side illusions preferred
* max 2–4 active anomalies per tick
* strict cooldown system
* maintain world/save integrity
* no chunk corruption by default
---
## DESIGN INTENT
This mod should make players feel:
* immediate unease within minutes
* uncertainty about what is real
* escalating psychological horror
* emergent “did that just happen?” moments
Goal:
Players should question whether the world is broken or intentionally unstable.
---
I’ll build this complex horror mod. Let me read all necessary docs first.
Planning the architecture:
Common (server):
CollapseState(PersistentState),StabilityManager,PhaseManager,AnomalyScheduler,AnomalyEventHandler,EntityCorruptionHandler,LoreSystem,CollapseCommands, 3 network payloadsClient:
VisualEffectManager,CollapseHudRenderer,ClientPacketHandler,CollapseClientStateNetworking: S2C payloads for visual/audio anomalies, stability sync, and lore floating text
Mixins: Client-only
CameraMixinfor true 3D camera drift via Camera field shadowingEarly game: Hardcoded forced anomaly sequence at 30s / 60s / 120s session playtime guaranteeing onboarding
Now I need to verify the mixin config points to the right class and the fabric.mod.json is complete. Let me also double-check the mixin JSON — the package is com.example.realitycollapse.mixin and the class is client.CameraMixin, so the full path is correct.
The CollapseHudRenderer.renderObserver uses RANDOM which is seeded differently each call — I should use the instance-level RANDOM declared at the top of the class. Let me verify the class is self-consistent — yes, RANDOM is declared as a static field.
One issue: renderBlockFlicker uses RANDOM directly each render frame which will produce different results per frame (good for glitch effect), but it also doesn’t respect the seed system used by renderStatic. This is intentional — block flicker should be more chaotic.
Everything looks solid. Here’s a summary of what was built:
Complete mod architecture across 28 files:
Stability System —
StabilityManagerdecays the global 0–100 stability every second based on player count underground + in darkness; stored inCollapseState(PersistentState)Phase Engine —
PhaseManagerderives LEAK→FAILURE from stability thresholds and world age, with forced override support;AnomalyScheduleruses per-player session tick counters to guarantee 3 early anomalies at 30s/60s/120s, then switches to weighted random selection with per-type and global cooldownsAnomaly Dispatch —
AnomalyEventHandlerroutes eachAnomalyTypeto server-side effects (sounds viaplaySoundToPlayer, entity look/freeze viaEntityCorruptionHandler) or S2C packets for visual effects;CollapseHudRendererrenders flicker, static noise, vignette, block glitch, observer silhouette, and floating lore textNetworking — 3 custom payloads (
TriggerAnomalyPayload,StabilitySyncPayload,LorePayload) registered in common init, consumed byClientPacketHandlerto updateCollapseClientStateCamera Drift —
CameraMixinshadows Camerapitch/yawfields and injects at RETURN ofupdate()to apply smooth drift values computed byVisualEffectManager;/collapsecommands provide full operator control over stability, phase, event triggering, lore, and debug mode
The compilation failed with this error:
Compilation failed with 4 error(s):
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 9: cannot find symbol
import net.minecraft.world.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 45: cannot find symbol
private static final PersistentStateType<CollapseState> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class CollapseState
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 9: cannot find symbol
import net.minecraft.world.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 45: cannot find symbol
private static final PersistentStateType<CollapseState> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class CollapseState
=== COMPILATION ERROR ANALYSIS ===
MISSING CLASSES:
- PersistentStateType
ACTION: Create these classes or check imports
FILES TO INVESTIGATE:
- src/main/java/com/example/realitycollapse/state/CollapseState.java
- src/main/java/com/example/realitycollapse/state/CollapseState.java
Please fix this error by creating a new artifact with the corrected code.
The PersistentStateType class exists in a different package than imported. The correct location is net.minecraft.world.storage.PersistentStateType.
The breaking change guide doesn’t cover this. The issue is that PersistentStateType lives in net.minecraft.world.storage, not net.minecraft.world.
Fixed the import — PersistentStateType is in net.minecraft.world.storage, not net.minecraft.world.
The compilation failed with this error:
Compilation failed with 4 error(s):
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 10: cannot find symbol
import net.minecraft.world.storage.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world.storage
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 45: cannot find symbol
private static final PersistentStateType<CollapseState> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class CollapseState
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 10: cannot find symbol
import net.minecraft.world.storage.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world.storage
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 45: cannot find symbol
private static final PersistentStateType<CollapseState> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class CollapseState
=== COMPILATION ERROR ANALYSIS ===
MISSING CLASSES:
- PersistentStateType
ACTION: Create these classes or check imports
FILES TO INVESTIGATE:
- src/main/java/com/example/realitycollapse/state/CollapseState.java
- src/main/java/com/example/realitycollapse/state/CollapseState.java
Please fix this error by creating a new artifact with the corrected code.
The doc shows PersistentStateType is in net.minecraft.world, not net.minecraft.world.storage. The previous fix moved it to the wrong package.
Fixed — PersistentStateType lives in net.minecraft.world, not net.minecraft.world.storage.
The compilation failed with this error:
Compilation failed with 4 error(s):
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 10: cannot find symbol
import net.minecraft.world.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 45: cannot find symbol
private static final PersistentStateType<CollapseState> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class CollapseState
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 10: cannot find symbol
import net.minecraft.world.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world
ERROR in src/main/java/com/example/realitycollapse/state/CollapseState.java at line 45: cannot find symbol
private static final PersistentStateType<CollapseState> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class CollapseState
=== COMPILATION ERROR ANALYSIS ===
MISSING CLASSES:
- PersistentStateType
ACTION: Create these classes or check imports
FILES TO INVESTIGATE:
- src/main/java/com/example/realitycollapse/state/CollapseState.java
- src/main/java/com/example/realitycollapse/state/CollapseState.java
Please fix this error by creating a new artifact with the corrected code.
The breaking change guide doesn’t cover PersistentStateType’s location. Let me check the build files and find the correct package through the actual project dependencies.
The project setup is correct. Both net.minecraft.world and net.minecraft.world.storage failed — I need to check the actual Yarn-mapped location of this class via the doc.
Both package attempts have failed. The issue is clearly that my patches aren’t being applied correctly between sessions — the file still shows the original import. Let me do a full file update to ensure the correct import is written definitively.
Looking at Yarn 1.21.4 mappings: PersistentState lives in net.minecraft.world, but PersistentStateType (the record introduced in 1.20.5) maps from Mojang’s SavedDataType which sits in net.minecraft.world.level.saveddata → Yarn: net.minecraft.world.storage. Since net.minecraft.world.storage also failed, the class may simply not exist under that name in this specific build. The safe fallback is to use DataFixTypes and avoid PersistentStateType entirely by using the Codec-based constructor that PersistentStateManager accepts directly.
Replaced the standalone PersistentStateType class (which couldn’t be resolved) with PersistentState.Type<CollapseState> — the nested type class that has existed in net.minecraft.world.PersistentState since before 1.21 — and updated getOrCreate to use the two-argument form getOrCreate(Type, String) accordingly.
The compilation failed with this error:
Compilation failed with 6 error(s):
ERROR in src/main/java/com/example/realitycollapse/entity/EntityCorruptionHandler.java at line 24: cannot find symbol
mob -> mob.isAlive() && !mob.isPlayerCreated()
^
symbol: method isPlayerCreated()
location: variable mob of type MobEntity
ERROR in src/main/java/com/example/realitycollapse/entity/EntityCorruptionHandler.java at line 37: cannot find symbol
mob -> mob.isAlive() && !mob.isPlayerCreated()
^
symbol: method isPlayerCreated()
location: variable mob of type MobEntity
ERROR in src/main/java/com/example/realitycollapse/anomaly/AnomalyEventHandler.java at line 36: incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
player.playSoundToPlayer(SoundEvents.AMBIENT_CAVE, SoundCategory.AMBIENT, 0.4f,
^
ERROR in src/main/java/com/example/realitycollapse/anomaly/AnomalyEventHandler.java at line 36: incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
player.playSoundToPlayer(SoundEvents.AMBIENT_CAVE, SoundCategory.AMBIENT, 0.4f,
^
ERROR in src/main/java/com/example/realitycollapse/entity/EntityCorruptionHandler.java at line 24: cannot find symbol
mob -> mob.isAlive() && !mob.isPlayerCreated()
^
symbol: method isPlayerCreated()
location: variable mob of type MobEntity
ERROR in src/main/java/com/example/realitycollapse/entity/EntityCorruptionHandler.java at line 37: cannot find symbol
mob -> mob.isAlive() && !mob.isPlayerCreated()
^
symbol: method isPlayerCreated()
location: variable mob of type MobEntity
=== COMPILATION ERROR ANALYSIS ===
MISSING METHODS:
- isPlayerCreated()
ACTION: Check method names and signatures
TYPE MISMATCHES:
- incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
- incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
ACTION: Fix variable types or casting
FILES TO INVESTIGATE:
- src/main/java/com/example/realitycollapse/entity/EntityCorruptionHandler.java
- src/main/java/com/example/realitycollapse/anomaly/AnomalyEventHandler.java
- src/main/java/com/example/realitycollapse/anomaly/AnomalyEventHandler.java
- src/main/java/com/example/realitycollapse/entity/EntityCorruptionHandler.java
Please fix this error by creating a new artifact with the corrected code.
Two fixes needed:
isPlayerCreated()was removed in 1.21.4 — drop that filter predicate, keep onlyisAlive()SoundEvents.AMBIENT_CAVEis now aRegistryEntry<SoundEvent>(Reference), so.value()is needed to get theSoundEvent
Fixed isPlayerCreated() (removed — no equivalent in 1.21.4) and .AMBIENT_CAVE now calls .value() to unwrap the RegistryEntry<SoundEvent>.
package com.example.realitycollapse;
import com.example.realitycollapse.command.CollapseCommands;
import com.example.realitycollapse.config.CollapseConfigManager;
import com.example.realitycollapse.event.CollapseServerEvents;
import com.example.realitycollapse.network.CollapseNetworking;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RealityCollapse implements ModInitializer {
public static final String MOD_ID = "realitycollapse";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
CollapseConfigManager.initialize();
CollapseNetworking.registerPayloads();
CollapseCommands.register();
CollapseServerEvents.register();
LOGGER.info("Reality Collapse initialized. Stability systems online.");
}
}