p1ut0nium-git / Rough-Mobs-Revamped

Rough Mobs Revamped for Minecraft
https://www.curseforge.com/minecraft/mc-mods/rough-mobs-revamped
4 stars 8 forks source link

[Bug] - Crash null pointer (enchantment on null entry?) #7

Closed 0xebjc closed 4 years ago

0xebjc commented 4 years ago

I think that now that there is a

here's the backtrace, I can submit the full crash log if you want, but I'm looking at your 2 TODO's in the EquipHelper and thinking that since the entry can be returned as null: then the enchantment function is trying to enchant a null.

            // If entity is in wrong dimension, then don't return entries
            if (!isDimension(entity, dimension)) {
                entry = null;
                return entry;
            }
Caused by: java.lang.NullPointerException
    at knightminer.inspirations.tools.enchantment.EnchantmentAxeLooting.func_92089_a(EnchantmentAxeLooting.java:25) ~[EnchantmentAxeLooting.class:?]
    at de.lellson.roughmobs2.misc.EquipHelper$EquipmentPool.getRandom(EquipHelper.java:353) ~[EquipHelper$EquipmentPool.class:1.12.2-2.2.7]
    at de.lellson.roughmobs2.misc.EquipHelper$EquipmentApplier.equipEntity(EquipHelper.java:158) ~[EquipHelper$EquipmentApplier.class:1.12.2-2.2.7]
    at de.lellson.roughmobs2.features.SkeletonFeatures.addFeatures(SkeletonFeatures.java:122) ~[SkeletonFeatures.class:1.12.2-2.2.7]
    at de.lellson.roughmobs2.RoughApplier.onEntitySpawn(RoughApplier.java:155) ~[RoughApplier.class:1.12.2-2.2.7]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1083_RoughApplier_onEntitySpawn_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
    at net.minecraft.world.World.func_72838_d(World.java:1209) ~[amu.class:?]
    at net.minecraft.world.WorldServer.func_72838_d(WorldServer.java:1058) ~[oo.class:?]
    at net.minecraft.world.WorldEntitySpawner.func_77192_a(WorldEntitySpawner.java:160) ~[anb.class:?]
    at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:203) ~[oo.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:756) ~[MinecraftServer.class:?]
0xebjc commented 4 years ago

I pulled your latest 2.2.8 and compiled, no crashes so far, but the probability of equipment seems off, I've set to 1 (always equip) for weapons and armor and it is still random and not always equipping items, what seems to be happening is that one piece or armor always gets equipped, but not the whole set, maybe that was the reason for the those loops (int =10, or int =100) that you have TODO's ro work out?

p1ut0nium-git commented 4 years ago

Yeah that could be it. I will have a look at it later today.