Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility: Skulltaker vs. subclassed (variant) mobs #86

Open
Reassembly opened this issue Sep 30, 2015 · 2 comments
Open

Compatibility: Skulltaker vs. subclassed (variant) mobs #86

Reassembly opened this issue Sep 30, 2015 · 2 comments

Comments

@Reassembly
Copy link

It appears that the code for checking whether the Axe of the Skulltaker drops heads uses the construction "event.entityLiving.getClass() == Entity[XXXX].class" to handle the addition of extra head drops. When used with FatherToast's Special Mobs mod (and potentially other mods), the Skulltaker's head-drop code never triggers.

This is because Special Mobs (by default) replaces vanilla mobs with versions subclassed from the original, which allows for not only the "Special" variants the mod adds, but enhancements to non-"Special" mobs (i.e. randomized size, health regeneration, spawning & AI tweaks, etc.).

If Forbidden Magic's Skulltaker code instead used the construction "event.entityLiving instanceof Entity[XXXX]" for zombies, skeletons, and creepers - as is aready done elsewhere in the code - then the Skulltaker would be able to properly harvest skulls from these subclassed mob types, and from other mods which add variant mob types.

@SpitefulFox
Copy link
Owner

I use getClass() instead of instanceof for beheadings because I didn't want it dropping inappropriate heads for entities that are descended from, but not actually, those mobs. For example, dropping zombie heads from zombie pigmen because zombie pigmen extend regular zombies.

@Reassembly
Copy link
Author

That's a fair enough reason - looking at the Forge docs, I see that there's actually several vanilla mob types which subclass from other instantiated types (such as cave spiders and magma cubes - but not giant zombies, strangely). However, that still leaves the Skulltaker incompatible with mods which replace vanilla mobs with enhanced subclasses. True, zombie pigmen shoudn't drop plain zombie heads - but overworld zombies which have, say, +/-10% height, a chance to spawn with equipment/buffs, and/or improved pathfinding, are still essentially zombies, and should still drop heads as such.

In addition, no vanilla mobs at all subclass from skeletons or creepers, and golem/slime/spider heads don't even exist in vanilla. The zombie vs. pig-zombie issue is pretty much an isolated edge-case, but using basic class-equality for all three mob "head checks" does break compatibility with other mob-altering mods unnecessarily. (Particularly for wither skeleton skulls...)

I'm not too inconvenienced, since Botania's elementium axe has a similar purpose, and does use instanceof, so I still have a means of collecting heads. ...although come to think of it, that would make the elementium axe subject to the problem you're avoiding...! (Checked: Yes indeed. Guess I'll report that too.)

The problems with both implementations (FM's & Botania's) could still be addressed by using, say, "(event.entityLiving instanceof EntityZombie) && !(event.entityLiving instanceof EntityPigZombie)". As described above, the zombie vs. pig-zombie distinction is the only case you'd even need to add the second instanceof-check - skeletons and creepers could be handled with a single instanceof clause each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants