Metamorph

Metamorph

4M Downloads

MorphEvent isn't fired when player entering world

PinkaLulan opened this issue · 2 comments

commented

Metamorph-1.1.4-1.10.2

I have something to do on player morphing, but MorphEvent.Pre or Post isn't fired when a player enter a world with a morph.

If a player morphs by morph gui, the event is working fine.
But if the player leave and rejoin the world with a morph, the event isn't fired.

I force the player demorph on leaving world for now.

The morph entity id are different on client and server side, I can't get morph entity by entity id.
How to get the current morph entity of the player?

commented
  1. I'll look into that, I guess that I don't use MorphAPI.morph(EntityPlayer player, AbstractMorph morph, boolean force) when initially setting the morph of the player upon joining the world. 🤔

The morph entity id are different on client and server side

Hm, weird. They should be same on both sides.

How to get the current morph entity of the player?

Something like this:

AbstractMorph morph = IMorphing.get(player).getCurrentMorph();
commented

I use this to print entity id in PlayerTickEvent:

IMorphing im = Morphing.get(event.player);
if (im != null && im.getCurrentMorph() instanceof EntityMorph) {
EntityMorph em = (EntityMorph) im.getCurrentMorph();
if (em != null && em.getEntity() != null)
{
if (event.player.world.isRemote) {
LogHelper.debug("CLIENT SIDE EID: "+em.getEntity().getEntityId());
}
else {
LogHelper.debug("SERVER SIDE EID: "+em.getEntity().getEntityId());
}
}
}

version:
minecraft 1.10.2
forge 1.10.2-12.18.3.2221
metamorph-1.1.4-1.10.2