Grimoire of Gaia

Grimoire of Gaia

5M Downloads

[mod compatibility with Morph] Game crashes when holding the right-click button in the form of ranged mobs (solution provided)

dragon-evol opened this issue ยท 2 comments

commented

General Info

  • I am running a modpack
  • I can reproduce this issue consistently
    • In single player
    • In multiplayer
  • I have searched for this issue previously and it was either (1) not previously reported, or (2) previously fixed and I'm having the same problem.
  • I am crashing and can provide my crash report(s)
  • I am using the latest version of the mod

Client Info

  • Minecraft Version:1.12.2

  • Forge Version: 14.23.5.2768

  • Mod Version: 1.6.7

  • Java Version: 1.8.0_181

Issue Description

As the title said. However it's fine when doing the same thing (holding the right-click button, such as eating) morphed into melee attack mobs.

Reproduce Steps

1.Have GromoireOfGaia 1.6.7 and Morph 7.1.2 and iChunUtil 7.1.4 loaded.
2.Kill a ranged mob (like Anubis), morph into it and eat a golden apple (shoot an arrow may also work).

Additional Information

Actually I have gone through the codes and find that it's because the methods in the interface IRangedAttackMob remained abstract, thus crashing the game when someone try to call it.
In the vanilla Minecraft, the AbstractSkeleton class in net.minecraft.entity.moster also implemented the interface and covered the methods in it.
So, I think since those mobs who use the methods all have the @OverRide tag, I can just implement the interface to EntityMobHostileBase and cover the methods in a trivial way so it will solve the problem without affecting the performance.
I made some changes, tested it, and it seems that the crash thing has gone, so I suppose it works.
The changes are listed below, with the altered EntityMobHostileBase as attached file.
The methods are at the bottom of the class. (for the sake of convenience)
(since I never officially learned java, just used some deduction and comparison, please tell me if I'm fixing it in the right way :) )
Hope that little issue will be fixed in the next version!

public abstract class EntityMobHostileBase extends EntityMob implements IRangedAttackMob {

	@SideOnly(Side.CLIENT)
	public boolean isSwingingArms()
	{
		return false;
	}

	public void setSwingingArms(boolean swingingArms)
	{
	}

	public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor)
	{
	}

}

EntityMobHostileBase.zip

commented

I'll look into it.

Thanks for attempting to solve it yourself. It makes the job much more easier for me as if you posted the issue alone I would probably have been dumbfounded by it. Mod compatibility issues is not my forte.

commented

Implemented in the 1.6.8 update.

I just hope this fix does not open up the possibility of additional conflicts with other mods.