Random Item Generator Resurrected

Adds three blocks that drops random items, spawn random mobs, or gives random enchanted books — complete with blacklist and whitelist

File Details

RIGR 2.0.1

  • R
  • Jul 1, 2026
  • 57.73 KB
  • 91
  • 1.20.1+1
  • Forge

File Name

random_item_generator_resurrected-2.0.1.jar

Supported Versions

  • 1.20.1
  • 1.20

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:rigr-935089:8353560")
Curse Maven does not yet support mods that have disabled 3rd party sharing

Learn more about Curse Maven

Random Item Generator Resurrected — NeoForge 1.21.1 → Forge 1.20.1 Port

RIGR.java (main mod class)

  • net.neoforged.*net.minecraftforge.* package roots throughout.
  • Removed constructor-injected IEventBus/ModContainer (a NeoForge-only pattern). Mod constructor is now no-arg; the event bus is retrieved via FMLJavaModLoadingContext.get().getModEventBus().
  • DeferredHolderRegistryObject.
  • DeferredRegister.createBlocks(MODID) / .createItems(MODID) (NeoForge sugar methods) → explicit DeferredRegister.create(ForgeRegistries.BLOCKS, MODID) / create(ForgeRegistries.ITEMS, MODID).
  • Config registration moved from the injected ModContainer to ModLoadingContext.get().registerConfig(...).

RIGConfig.java

  • net.neoforged.neoforge.common.ModConfigSpecnet.minecraftforge.common.ForgeConfigSpec (Forge's original, pre-rename class — API is otherwise identical: Builder, push/pop, defineList, build all unchanged).
  • isEnchantAllowed(Holder<Enchantment>)isEnchantAllowed(Enchantment). In 1.20.1 enchantments aren't a Holder-wrapped dynamic registry entry; ID lookup now goes through ForgeRegistries.ENCHANTMENTS.getKey(ench).
  • Legacy alias methods isEnchantBlacklisted/isEnchantModBlacklisted updated to match the new Enchantment parameter type.

ItemBlock.java

  • Removed the Holder<Enchantment> registry-lookup dance for Silk Touch/Fortune. In 1.20.1, Enchantments.SILK_TOUCH and Enchantments.BLOCK_FORTUNE are plain Enchantment objects usable directly with EnchantmentHelper.getItemEnchantmentLevel(...).
  • Enchantments.FORTUNEEnchantments.BLOCK_FORTUNE (renamed in 1.20.1).

EntityBlock.java

  • net.neoforged.bus.api.SubscribeEventnet.minecraftforge.eventbus.api.SubscribeEvent.
  • @EventBusSubscriber@Mod.EventBusSubscriber, with explicit bus = Mod.EventBusSubscriber.Bus.MOD.
    • Bug fix: Forge's default bus for @Mod.EventBusSubscriber is the Forge/game bus, not the mod bus. FMLCommonSetupEvent only fires on the mod bus, so without this the listener silently never ran, RANDOM_ENTITIES stayed permanently empty, and — because both the mob-spawn branch and the Silk Touch drop branch were nested inside if (!RANDOM_ENTITIES.isEmpty())neither mob spawning nor Silk Touch drops ever worked.
  • Same Holder<Enchantment> → plain Enchantment simplification as ItemBlock, in both onDestroyedByPlayer and getDrops.
  • Enchantments.FORTUNEEnchantments.BLOCK_FORTUNE.

EnchantsBlock.java

  • net.minecraft.tags.EnchantmentTags doesn't exist in 1.20.1 (curse tagging is a later-version feature). Curse filtering now uses Enchantment#isCurse().
  • Enchantment pool no longer comes from level.registryAccess().registryOrThrow(Registries.ENCHANTMENT) (a dynamic/datapack registry in 1.21). It's now sourced from ForgeRegistries.ENCHANTMENTS.getValues(), since enchantments are a static Forge registry in 1.20.1.
  • EnchantmentInstance now built directly from Enchantment, not Holder<Enchantment>.
  • Same Silk Touch/Fortune simplification and rename as the other blocks.

LootBlock.java

  • Registries.LOOT_TABLE doesn't exist in 1.20.1 — loot tables aren't a queryable registry until 1.21. Dynamic enumeration of all registered loot tables was removed entirely.
  • server.getServer().reloadableRegistries().getLootTable(chosen)server.getServer().getLootData().getLootTable(chosen) (1.20.1's LootDataManager API).
  • Pool type changed from List<ResourceKey<LootTable>> to List<ResourceLocation> to match the above.
  • Known limitation: the loot pool is now built solely from the hardcoded vanilla fallback list (15 vanilla chests/... tables). Modded loot tables are never included, since there's no public API in Forge 1.20.1 to enumerate them.

RIGStats.java

  • net.neoforged.*net.minecraftforge.* package roots.
  • @EventBusSubscriber@Mod.EventBusSubscriber, also given explicit bus = Mod.EventBusSubscriber.Bus.MODRegisterEvent is a mod-bus event, same underlying issue as EntityBlock. Left un-fixed, ITEM_BLOCK_USES etc. would have stayed null, risking an NPE on sp.awardStat(...).
  • ResourceLocation.fromNamespaceAndPath(...) (1.21-only) → new ResourceLocation(...) constructor (deprecated-for-removal in 1.20.1 but functional; produces a compiler warning, not an error).

Cross-cutting notes

  • Modded items, mobs, and enchantments are all picked up automatically (Item Block, Entity Block, Enchants Block all read from shared cross-mod registries).
  • Modded loot tables are not picked up (Loot Block) — this is a hard limitation of Forge 1.20.1's loot table API, not a bug.
  • File structure was kept as one class per block type (not merged) — standard practice, no functional difference.