Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Forge distinguishes between "onLivingAttack" and "onPlayerAttack" while patchwork doesn't. #114

@kitlith

Description

@kitlith

YarnForge's ForgeHooks:

        public static boolean onLivingAttack(LivingEntity entity, DamageSource src, float amount) {
                return entity instanceof PlayerEntity || !MinecraftForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, amount));
        }

        public static boolean onPlayerAttack(LivingEntity entity, DamageSource src, float amount) {
                return !MinecraftForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, amount));
        }

Patchwork's EntityEvents:

	public static boolean onLivingAttack(LivingEntity entity, DamageSource src, float damage) {
		return MinecraftForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, damage));
	}

The LivingEntity mixin ends up not checking if the entity is instanceof PlayerEntity while forge does. For all I know there's a reason for this, but it's not documented if there is a reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions