import { system, world, Entity, Player } from '@minecraft/server'

world.afterEvents.entityHitEntity.subscribe((event) => {
	let damagingEntity = event.damagingEntity;
	const player = event.damagingEntity
	if ((damagingEntity.typeId == 'minecraft:player' && damagingEntity.getComponent('inventory').container.getItem(player.selectedSlot).typeId == 'redstone:illager_axe_cleaver') == true) {
		const entity = event.hitEntity;
		entity.clearVelocity();
		entity.applyImpulse({ x: 0, y: -0.1, z: 0 });
	}
})