Enchanting Plus

Enchanting Plus

14M Downloads

Vanilla loot generation: IllegalArgumentException: bound must be positive

Ivorforce opened this issue ยท 2 comments

commented

Linking this up with Ivorforce/RecurrentComplex#92

Is it possible that this is caused by your mod?

commented

Yes, thank you for reporting this.

commented

So, after looking into this issue further, it seems like Vanilla's system is using a negative value as the total weight. Not sure if I am adding the loot entry wrong, or if this is a bug with vanilla/forge. Would really appreciate some feedback from others on this issue.

    @SubscribeEvent
    public void onLootTableLoad (LootTableLoadEvent event) {

        if (ConfigurationHandler.allowScrollLoot && event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {

            final LootPool pool2 = event.getTable().getPool("pool2");

            if (pool2 != null)
                pool2.addEntry(new LootEntryItem(ContentHandler.itemScroll, ConfigurationHandler.scrollWeight, 0, new LootFunction[] { new ItemScroll.Function() }, new LootCondition[0], "eplus:dungeon_scroll"));
        }
    }

Quote from Malorolam

Found the issue, [13:06:29] [Server thread/INFO] [FML]: [LOOTBAGS]: 1xitem.eplus.scroll@0:1:1:2147483647 is causing an integer overflow, making the table have a negative total weight, making it seem as though it's erroring. Next version will ensure that similar issues cannot occur anymore.