Skip to content

Backport Random Loot 2 to Minecraft 1.12.2#22

Open
TheMarstonConnell wants to merge 5 commits into1.21.xfrom
1.12.2-backport
Open

Backport Random Loot 2 to Minecraft 1.12.2#22
TheMarstonConnell wants to merge 5 commits into1.21.xfrom
1.12.2-backport

Conversation

@TheMarstonConnell
Copy link
Copy Markdown
Owner

Summary

Backports Random Loot 2 from NeoForge 1.21.11 to Forge 1.12.2.

Changes

  • Build System: Converted to RetroFuturaGradle 1.4.1 for 1.12.2 compatibility
  • Data Storage: Replaced DataComponents with NBT-based storage (LootNBT.java)
  • All 39 Modifiers: Ported with 1.12.2 API translations
  • Dynamic Textures: Implemented via ItemPropertyGetter for 91 tool textures
  • Trait Modification: Anvil recipes replace smithing table (30 XP cost)
  • Loot Tables: Cases spawn in dungeon chests via LootTableLoadEvent
  • Melting Fix: Uses HarvestDropsEvent for reliable auto-smelting

Removed (1.12.2 incompatible)

  • Template items (MOD_ADD/MOD_SUB)
  • NeoForge-specific recipe system
  • DataComponents system

Testing

Tested on Apple Silicon Mac via Rosetta with x86_64 Java 8. Core functionality verified:

  • Tool generation with random textures
  • Modifier system (Veiny, Melting confirmed working)
  • Goodness progression system
  • Dynamic texture display

Build

./gradlew build
# Output: build/libs/randomloot-1.0.0-1.12.2.jar

- Convert from NeoForge 1.21.11 to Forge 1.12.2 (14.23.5.2860)
- Replace DataComponents with NBT-based storage (LootNBT.java)
- Port all 39 modifiers with 1.12.2 API translations
- Implement dynamic texture system with ItemPropertyGetter
- Add anvil recipe handler for trait modification (30 XP cost)
- Add loot table injection for dungeon chests
- Update build system to RetroFuturaGradle 1.4.1
- Fix stat tracking for goodness progression
- Convert lang files from JSON to .lang format
Use HarvestDropsEvent to intercept drops before they spawn instead of
trying to find dropped items after the fact. This ensures consistent
smelting behavior.
Add @Mod.EventBusSubscriber annotation and make methods static
so the event handler is properly registered with Forge.
Corrected tagNames:
- teleportuse -> void_touched
- torchplace -> torch_place
- dirtplace -> dirt_place
- fireplace -> fire_place
- fireball -> flame_thrower
- charging -> charged
- orefinder -> detecting
- spawnerfinder -> spawner
- draining -> necrotic

Added missing recipes for absorption and soulbound.
@claude
Copy link
Copy Markdown

claude Bot commented Jan 26, 2026

Code review

Issue found: Potential NullPointerException in Soulbound.isOwner()

The LootNBT.getOwnerUUID() method can return null when the NBT key does not exist (see LootNBT.java:167-170), but the code at Soulbound.java:114-115 calls .isEmpty() on the returned value without a null check.

Impact: This will cause a NullPointerException crash whenever a tool with the Soulbound modifier is used and does not have an ownerUUID set in its NBT data.

Suggested fix: Change line 115 to check for null:

if (ownerUUID == null || ownerUUID.isEmpty()) {

Register old item IDs (tools, cases, armor) so they don't disappear when
players upgrade from the original 1.12 mod. When held in hand, legacy items
convert to a case with a thank you message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant