Skip to content

Friends&Foes compat (compat in general) #16

Description

@Faboslav

Hello there, i got the reported issue here:
Faboslav/friends-and-foes#145

That means when you create your female entities

var replacedEntity = (Illusioner) entity;
replacementEntity = new FemaleIllusioner(entity.level);
replacementEntity.setItemSlot(EquipmentSlot.MAINHAND, replacedEntity.getItemBySlot(EquipmentSlot.MAINHAND));

you are basically cancelling all of other mods custom entity setups, for example my illusioner illusion setup:

IllusionerEntity illusioner = (IllusionerEntity) (Object) this;
IllusionerEntity illusion = EntityType.ILLUSIONER.create(this.getWorld());

illusion.equipStack(EquipmentSlot.MAINHAND, new ItemStack(Items.BOW));
IllusionerEntityAccess illusionerAccess = (IllusionerEntityAccess) illusion;
illusionerAccess.friendsandfoes_setIsIllusion(true);
illusionerAccess.friendsandfoes_setIllusioner(illusioner);
illusionerAccess.friendsandfoes_setTicksUntilDespawn(ILLUSION_LIFETIME_TICKS);

illusion.setHealth(this.getMaxHealth());
illusion.copyPositionAndRotation(illusioner);
illusion.setTarget(illusioner.getTarget());

boolean teleportResult = illusionerAccess.friendsandfoes_tryToTeleport(x, y, z);

if (teleportResult) {
			this.getEntityWorld().spawnEntity(illusion);
			illusionerAccess.friendsandfoes_spawnCloudParticles();
}

You should always somehow keep all the original entity context/data and just add your additional data, so it is rendered as female.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions