promotional bannermobile promotional banner

HarryPotter

A magical Minecraft mod that brings the wizarding world of Harry Potter to life with wands, spells, Ollivanders wand shops, and spell vendors including Grindelwald.

File Details

harrypottermod-0.0.3.jar

  • R
  • Jan 12, 2026
  • 1.33 MB
  • 33
  • 1.21.1
  • NeoForge

File Name

harrypottermod-0.0.3.jar

Supported Versions

  • 1.21.1

Curse Maven Snippet

NeoForge

implementation "curse.maven:harrypotter-mod-1426384:7450870"
Curse Maven does not yet support mods that have disabled 3rd party sharing

Learn more about Curse Maven

Added

  • Performance Monitoring: Added light source count tracking and memory leak safeguards
  • World Unload Cleanup: Automatic cleanup of all light sources when world unloads
  • Stale Light Cleanup: Automatic detection and removal of invalid light sources
  • PlayerCleanupHandler: New event handler for proper cleanup on player login/logout and world unload
  • Automatic mana regeneration tick counter cleanup on player disconnect
  • Lumos State Persistence: Lumos spell state is now saved to player data (NBT)
    • When you leave the game with Lumos active, it will automatically restore when you rejoin
    • State syncs on login with message: "§e✦ Lumos Restored ✦ §7(from previous session)"
    • Saves to ManaCapability for proper persistence across sessions
  • /diagonalley Command: Teleport to Diagon Alley with Ollivander's Wand Shop
    • Creates a magical platform at coordinates (10000, 100, 10000)
    • Automatically builds Ollivander's shop with purple/blackstone theme
    • Spawns Mr. Ollivander NPC (Wandmaker) inside the shop
    • Platform features checkerboard purple concrete and blackstone pattern
    • Shop includes glowstone lighting and welcoming message

Changed

  • PERFORMANCE: Optimized Lumos light system - Uses ConcurrentHashMap for thread safety
  • PERFORMANCE: Optimized wand checking - Uses lazy-initialized Set for O(1) lookup instead of multiple == checks
  • PERFORMANCE: Optimized mana regeneration - Runs every 5 ticks instead of every tick (80% CPU reduction)
    • Adjusted mana rates to compensate: 0.5 base, 0.25 standing bonus, 0.5 regen potion bonus
    • Still provides same effective rates: 2 mana/sec normal, 3 mana/sec standing, 1 mana/sec sprinting
  • Thread Safety: Changed ACTIVE_LUMOS Set to use ConcurrentHashMap.newKeySet() for thread-safe operations
  • Lumos Light Level: Reduced from 15 to 14 (torch brightness) for more balanced lighting

Removed

  • Village wand shop integration (was broken/not working properly)
    • Removed corrupted wand_shop.nbt file
    • Removed VillageAddition event handler
    • Removed StructureTemplatePoolAccessor mixin
    • Removed worldgen structure/template_pool/structure_set files
    • Replaced with /diagonalley command for immediate functionality
    • Change of Plans: Natural worldgen Diagon Alley structure will be properly implemented in v0.0.4+
      • Will include multiple buildings (Ollivander's, Flourish & Blotts, Apothecary, etc.)
      • Will use proper jigsaw structure system
      • Will naturally generate in plains biomes like a village
      • Current /diagonalley command provides immediate access until then

Fixed

  • CRITICAL: Fixed class loading order crash on game startup
    • Error: NullPointerException: Trying to access unbound value: ResourceKey[minecraft:item / harrypottermod:basic_wand]
    • Root cause: Wand items were being accessed during LambDynamicLights initialization, before items were registered
    • Solution: Implemented truly lazy initialization - wand cache is only initialized when first accessed in isHoldingWand(), not during initialize()
    • Added error handling with fallback to empty set if initialization fails
    • This ensures items are fully registered before any access attempts
  • CRITICAL: Fixed Lumos spell memory leak that caused infinite dynamic light sources to spawn
    • The bug caused LambDynamicLights spatial lookup to continuously resize (1024 → 2048 → 4096 → ... → 8388608)
    • This led to severe lag, freezing, and crashes when casting Lumos while moving, flying, or standing
    • Root cause #1: Bounding box was being recreated every tick even when player hadn't moved blocks
    • Root cause #2: ACTIVE_LUMOS Set was never cleared when players logged out or worlds unloaded
    • Root cause #3: hasChanged() was reporting position changes, causing LambDynamicLights to recreate spatial lookup entries
    • This caused persistent memory leak when leaving and rejoining worlds, or even just moving around
    • Solution:
      • Only update bounding box when player actually moves to different block
      • Modified hasChanged() to ONLY report luminance changes, not position changes - this is the KEY fix
      • Position tracking is handled by lightAtPos() calculations instead
      • Clear ACTIVE_LUMOS Set on player login (PlayerLoggedInEvent) - ensures clean slate
      • Clear ACTIVE_LUMOS Set on player logout (PlayerLoggedOutEvent)
      • Clear all Lumos states on world unload (LevelEvent.Unload)
      • Clear all client light sources on world unload
      • Added circuit breaker that detects multiple light sources for single player and immediately clears all lights
      • Added PlayerCleanupHandler for proper resource cleanup on login/logout/world unload
      • Added debug logging for light source addition/removal to help diagnose future issues
  • Fixed village structure pool modification to work with Java 21 final fields
  • Fixed mixin accessor to properly use @Mutable annotation
  • Resolved structure generation crashes

Performance Improvements Summary

  • Lumos lighting: Prevented memory leak, added max light source limit (100), automatic cleanup
  • Mana regeneration: 80% CPU reduction by running every 5 ticks instead of every tick
  • Wand detection: O(1) lookup using lazy-initialized cached Set instead of 7 equality checks
  • Thread safety: Using ConcurrentHashMap for multi-threaded environments
  • Memory management: Automatic cleanup on world unload, player logout, and stale light detection