Epic Fight

Epic Fight

18M Downloads

[Bug|Crash]: Possible regression in BrainRecomposer by 20.8.11 when patch some custom entities

0101a1a opened this issue ยท 1 comments

commented

Please check if a similar issue has already been reported.

  • I checked this type of issue has never been reported.

Please check you're using proper versions.

  • I checked all of them in the right version.

Please check if this issue's from out of our area

  • I understood the problem.

The name of the mod

https://www.curseforge.com/minecraft/mc-mods/minecraft-comes-alive-reborn

After all of these, please check if you're just pressing the ok buttons to skip this process.

  • I read the checklist and I promise I'll provide all the information that is needed to fix the issue

Minecraft Version

1.20.1

The Issue

The steps to reproduce has more minimal steps. I managed to get MCA entities working with Epic fight using an older version of Epic fight.

I suspect a regression in 20.8.11 since I didn't have this issue with 20.8.10. More specifically, this commit d821a4b#diff-66cb1ed73fcd0389db94fd8e391edf91df529869ea7b6d57bcc3a2e8e3366368L3-L45 (likely only the changes to RenderEngine are related) is causing this crash:

java.lang.NullPointerException: Cannot invoke "yesman.epicfight.world.entity.ai.brain.BrainRecomposer$BrainRecomposeFunction.recomposeBrain(net.minecraft.world.entity.ai.Brain, yesman.epicfight.world.entity.ai.behavior.AnimatedCombatBehavior, yesman.epicfight.world.entity.ai.behavior.MoveToTargetSinkStopInaction)" because the return value of "java.util.Map.get(Object)" is null
	at TRANSFORMER/[email protected]/yesman.epicfight.world.entity.ai.brain.BrainRecomposer.recomposeBrainByType(BrainRecomposer.java:31)
	at TRANSFORMER/[email protected]/yesman.epicfight.world.capabilities.entitypatch.CustomHumanoidMobPatch.setAIAsInfantry(CustomHumanoidMobPatch.java:47)
	at TRANSFORMER/[email protected]/yesman.epicfight.world.capabilities.entitypatch.HumanoidMobPatch.initAI(HumanoidMobPatch.java:68)
	at TRANSFORMER/[email protected]/yesman.epicfight.world.capabilities.entitypatch.MobPatch.onJoinWorld(MobPatch.java:56)
	at TRANSFORMER/[email protected]/yesman.epicfight.world.capabilities.entitypatch.MobPatch.onJoinWorld(MobPatch.java:40)
	at TRANSFORMER/[email protected]/yesman.epicfight.events.EntityEvents.spawnEvent(EntityEvents.java:94)
	at TRANSFORMER/[email protected]/yesman.epicfight.events.__EntityEvents_spawnEvent_EntityJoinLevelEvent.invoke(.dynamic)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.entity.PersistentEntitySectionManager.addEntity(PersistentEntitySectionManager.java:79)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.entity.PersistentEntitySectionManager.lambda$processPendingLoads$11(PersistentEntitySectionManager.java:260)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.entity.PersistentEntitySectionManager.processPendingLoads(PersistentEntitySectionManager.java:259)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.entity.PersistentEntitySectionManager.tick(PersistentEntitySectionManager.java:269)
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:355)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:893)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:814)
	at TRANSFORMER/[email protected]/net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:89)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:661)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:251)
	at java.base/java.lang.Thread.run(Thread.java:840)

The mods are only Epic fight and MCA reborn and I checked and it's likely that this issue is not from MCA reborn since it work previously with earlier versions of Epic fight.

More Context

I'm trying to get MCA reborn working with Epic fight (related Luke100000/minecraft-comes-alive#575), so I disabled their custom entities (Luke100000/minecraft-comes-alive#851 (comment)) by setting Squidwards to true in config/mca.json.

Optionally, to make their villagers looks like a player so the Epic fight player animation play well with it, use this resource pack:

SteveVillagers.zip

This minimal datapack to use the player model for the male villagers:

EpicFightMcaVillagers.zip

{
  "model": "epicfight:entity/biped",
  "armature": "epicfight:entity/biped",
  "renderer": "player",
  "isHumanoid": true,
  "faction": "villager",
  "attributes": {
    "impact": 0.5,
    "armor_negation": 0.0,
    "max_strikes": 1,
    "chasing_speed": 1.2,
    "scale": 1.0
  },
  "default_livingmotions": {
    "idle": "epicfight:biped/living/idle",
    "walk": "epicfight:biped/living/walk",
    "chase": "epicfight:biped/living/walk",
    "mount": "epicfight:biped/living/mount",
    "fall": "epicfight:biped/living/fall",
    "death": "epicfight:biped/living/death"
  },
  "stun_animations": {
    "short": "epicfight:biped/combat/hit_short",
    "long": "epicfight:biped/combat/hit_long",
    "knockdown": "epicfight:biped/combat/knockdown",
    "fall": "epicfight:biped/living/landing",
    "neutralize": "epicfight:biped/skill/guard_break1"
  },
  "combat_behavior": []
}

When running the game with Epic fight 20.8.10, everything run as expected, when using 20.8.11 or the latest version, the game will either crash or reproduce an exception that prevent the rendering of the villager entity (it has the same stack trace though).

I managed to get it working with 20.8.10:

EpicFightMcaReborn.mp4

While they don't use the Epic fight sword animations, but that's not Epic fight issue, likely MCA reborn and will attempt to fix it after this issue.

With 20.8.11 or newer versions:

Caused by: java.lang.NullPointerException: Cannot invoke "yesman.epicfight.world.entity.ai.brain.BrainRecomposer$BrainRecomposeFunction.recomposeBrain(net.minecraft.world.entity.ai.Brain, yesman.epicfight.world.entity.ai.behavior.AnimatedCombatBehavior, yesman.epicfight.world.entity.ai.behavior.MoveToTargetSinkStopInaction)" because the return value of "java.util.Map.get(Object)" is null

When creating a new world instead, it doesn't crash the game but with the exact same error in the console and the entity is completely hidden:

Image

It's worth mentioning when using the preset like the wither skeleton instead of full setup, it worked even on newer versions, but the model is very broken, and I'm not able to customize anything.

My goal is to get the two mods working together, maybe as an add-on or fork MCA reborn.

Other issues but not directly related:

Steps to Reproduce

I don't think the issue is related to MCA reborn although I'm not sure on how to reproduce with more minimal steps or without MCA reborn.

  1. Use Minecraft 1.20.1, recommended forge version 4.7.3.0, latest version of Epic fight 20.9.7.
  2. Install MCA reborn (version doesn't matter).
  3. Set Squidwards to true in config/mca.json (or download the updated file mca.json).
  4. Install this pack (should be applied both as datapack and resourcepack) EpicFightMcaCompat.zip.
  5. Run the game, create a new world, run /summon mca:male_villager.
  6. The entity is hidden or the game crashes, you will get the following error in console in both cases:
Caused by: java.lang.NullPointerException: Cannot invoke "yesman.epicfight.world.entity.ai.brain.BrainRecomposer$BrainRecomposeFunction.recomposeBrain(net.minecraft.world.entity.ai.Brain, yesman.epicfight.world.entity.ai.behavior.AnimatedCombatBehavior, yesman.epicfight.world.entity.ai.behavior.MoveToTargetSinkStopInaction)" because the return value of "java.util.Map.get(Object)" is null
  1. Use Epic fight 20.8.10 instead, summon another one /summon mca:male_villager, the entity use Epic fight animations as expected.
commented

See the PR #1935 for a hotfix.