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

Target Blocker Friendly Fire Crash #17

Open SandwichHorror opened 4 years ago

SandwichHorror commented 4 years ago

The game tends to brick itself when a creature shoots or otherwise attacks a blacklisted target (skeleton to skeleton, wither vs. wither skeleton, etc). Note that I am also running Epic Siege Mod and Special AI. Epic Siege certainly modifies mobs' behavior universally, but it's not updated very often at all. It seems the entity is causing a ticking error because it wants to retaliate, but cannot. If this is something that can possibly be fixed on your end (rather than the other mob mods) I would greatly appreciate it!

Description: Ticking entity

java.lang.NullPointerException
    at net.minecraft.entity.Entity.isOnSameTeam(Entity.java:2315)
    at net.minecraft.entity.ai.EntityAIHurtByTarget.alertOthers(SourceFile:57)
    at net.minecraft.entity.ai.EntityAIHurtByTarget.startExecuting(SourceFile:38)
    at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(SourceFile:102)
    at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:885)
    at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2359)
    at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:678)
    at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:45)
    at net.minecraft.entity.monster.AbstractSkeleton.onLivingUpdate(AbstractSkeleton.java:144)
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2179)
    at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:377)
    at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:50)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1996)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:832)
    at net.minecraft.world.World.updateEntity(World.java:1958)
    at net.minecraft.world.World.redirect$updateEntity$zck000(World.java:5623)
    at net.minecraft.world.World.updateEntities(World.java:1762)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:613)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:767)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:279)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
    at java.lang.Thread.run(Unknown Source)
p1ut0nium-git commented 4 years ago

Send me your rough mobs config and tell me what mods and versions you are using and i will look. Into it. Thanks.

SandwichHorror commented 4 years ago

For relevant AI-tweaking mods, Latest 1.12.2 versions of: Epic Siege Mod SpecialAI Zombie Awareness/Coroutil Rough Mobs Revamped (obviously)

I removed most of the offending mobs, but added back in the wither skeleton and wither relations so you can test it. Had to change the cfg to txt to upload it here.

SandwichHorror commented 4 years ago

roughmobsrevamped.txt

p1ut0nium-git commented 4 years ago

Thanks. I’ll look into this.

democat3457 commented 4 years ago

bump

SandwichHorror commented 4 years ago

When the Ender Dragon or Wither are put into the target blocker, it doesn't actually work. The Ender Dragon ends up aggroing all the endermen on the island, it's pretty chaotic.

democat3457 commented 4 years ago

Issue appears to be caused by these two lines in the EntityAIHurtByTarget file (while trying to alert others):

for(EntityCreature entitycreature : this.taskOwner.world.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).grow(d0, 10.0D, d0))) {
         if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && (!(this.taskOwner instanceof EntityTameable) || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner()) && !entitycreature.isOnSameTeam(this.taskOwner.getRevengeTarget())) {
For each entity in a 10-block area,
if the entity is not me and the entity isn't attacking anyone and 
   I'm not tameable OR
       my owner is the entity's owner and the entity isn't on the same team as my target

However, the game throws a NPE because the entity that was attacked has no target - i.e., one of the AI mods set the revenge target to null - causing the game to pass a null target to the isOnSameTeam method and throwing a NPE.

democat3457 commented 4 years ago

I will say, the original issue isn't fixed yet - only the comment about bosses not working has been fixed.

p1ut0nium-git commented 4 years ago

Accidentally closed issue

p1ut0nium-git commented 4 years ago

After spending some time digging on this tonight, I've determined this is clearly caused by one of the other mods mentioned above (I don't know which), and not Rough Mobs Revamped. There are two options at this point: either the fix can be done in the offending mods listed above, or I can try to figure something out in Rough Mobs that solves the problem when these mods are installed.

I'll have to do more digging and maybe I'll get to it, but if anyone else want to take a stab at it feel free. I'm crazy busy with work at the moment, and don't know when I'll get to it if ever. As it stands, the feature seems to work fine without the other mods installed, so this really isn't a bug with Rough Mobs per se. I'll leave the issue report open though until a solution is found.

democat3457 commented 4 years ago

Unfortunately, neither mods are open-source (lookin at you funwayguy) so it makes it a tad harder to troubleshoot. If the issue was indeed caused by Rough Mobs, then it'd have to be such that Rough Mobs gets its onTarget event called exactly when the EntityAIHurtByTarget task executes, which would cause the revenge target to be set to null immediately after the task's shouldExecute method is called, causing the NPE.

SandwichHorror commented 4 years ago

If this helps matters at all, the combination of a "fight-starting" item and a Forge setting to instantly despawn ticking crashed entities (versus bricking the world) allowed me to do some more testing.

Regardless of whether it had been damaged already, when making a mob aggro to another mob it is supposed to be forbidden from attacking, (example config: zombie blocked from attacking skeleton) it instantly despawned as per the ticking entity crash.

This makes me think that this issue has to do specifically with target selection rather than damage affecting that target selection.

In an ideal world, if the mob developed an "illegal" aggro, it would immediately reset to have no current target whatsoever.

democat3457 commented 4 years ago

In an ideal world, if the mob developed an "illegal" aggro, it would immediately reset to have no current target whatsoever.

Well yeah, that's exactly what's happening currently. However, it resets it just a tad too early/late, since it happens right after the AI task chooses to execute and right before the AI task uses the target.

onekum commented 3 years ago

Hi, I've had this problem myself and through tons of trial and error, I found that the issue lies with Special AI. In my testing, every other AI mod mentioned here works with Rough Mobs Revamped. I still don't know why Special AI breaks it, though.

CalaMariGold commented 3 years ago

Any update on this? Does it being incompatible with SpecialAI help narrow down the source of the issue?

blakmont commented 3 years ago

Having the same crash with this feature on, only relevant AI changing mod besides this one being AIImprovements. Playing on latest 1.12.2

p1ut0nium-git commented 2 years ago

I am back online and will investigate.

democat3457 commented 2 years ago

👀 thanks for looking into this again!

reddvilzz commented 2 years ago

Hi there any updates on this?