if (clickedEntity.get(Human.class) != null && !VanillaConfiguration.PLAYER_PVP_ENABLED.getBoolean()) {
return;
}
Living clicked = clickedEntity.get(Living.class);
if (clicked != null) {
//TODO: Reimplement exhaustion values
int damage = 1;
if (holding != null && holdingMat instanceof VanillaMaterial) {
damage = ((VanillaMaterial) holdingMat).getDamage();
if (holdingMat instanceof Tool) {
// This is a bit of a hack due to the way Tool hierarchy is now (Only Swords can have a damage modifier, but Sword must be an interface and therefore is not able to contain getDamageModifier without code duplication)
damage += ((Tool) holdingMat).getDamageBonus(clickedEntity, holding);
// player.getInventory().getQuickbar().getCurrentSlotInventory().addData(1); TODO: Reimplement durability change
}
}
//Potion modification
if (holdingMat.equals(VanillaMaterials.AIR)) {
Effects effect = playerEnt.add(Effects.class);
if (effect.contains(EntityEffectType.STRENGTH)) {
damage += 3;
}
if (effect.contains(EntityEffectType.WEAKNESS)) {
damage -= 2;
}
}
//END Potion modification
// Damage the clicked entity
if (damage > 0 && !PlayerUtil.isCreativePlayer(clickedEntity) && !clicked.getHealth().isDead()) {
clicked.getHealth().damage(damage, new PlayerDamageCause(playerEnt, DamageType.ATTACK), damage > 0);
}
}
} else {
event = new PlayerInteractEntityEvent(playerEnt, clickedEntity, clickedEntity.getPhysics().getPosition(), Action.LEFT_CLICK);
if (Spout.getEventManager().callEvent(event).isCancelled()) {