mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Combat fix
This commit is contained in:
parent
76536f0a18
commit
145b2432e0
@ -14,7 +14,7 @@ Version 2.1.125
|
||||
|
||||
Version 2.1.124
|
||||
Repair/Salvage can now be set to use vanilla blocks that already do something and that vanilla functionality will be disabled by mcMMO (you could use vanilla-anvils instead of iron_blocks for repair now)
|
||||
Added Gold_Nugget to Mining's Bonus_Drops in config.yml (edit your config)g
|
||||
Added Gold_Nugget to Mining's Bonus_Drops in config.yml (edit your config)
|
||||
Added Piglin to experience.yml combat XP tables with a value of 2.0 (edit your config)
|
||||
Added Hoglin to experience.yml combat XP tables with a value of 4.0 (edit your config)
|
||||
Added Zombified_Piglin & Zombie_Pigman to experience.yml combat XP tables with a value of 3.0 (edit your config)
|
||||
|
@ -301,8 +301,9 @@ public final class CombatUtils {
|
||||
*
|
||||
* @param event The event to run the combat checks on.
|
||||
*/
|
||||
public static void processCombatAttack(EntityDamageByEntityEvent event, Entity damageSourceEntity, LivingEntity target) {
|
||||
EntityType entityType = damageSourceEntity.getType();
|
||||
public static void processCombatAttack(EntityDamageByEntityEvent event, Entity painSourceRoot, LivingEntity target) {
|
||||
Entity painSource = event.getDamager();
|
||||
EntityType entityType = painSource.getType();
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (Misc.isNPCEntityExcludingVillagers(target)) {
|
||||
@ -318,7 +319,7 @@ public final class CombatUtils {
|
||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||
|
||||
if (acrobaticsManager.canDodge(target)) {
|
||||
event.setDamage(acrobaticsManager.dodgeCheck(damageSourceEntity, event.getDamage()));
|
||||
event.setDamage(acrobaticsManager.dodgeCheck(painSourceRoot, event.getDamage()));
|
||||
}
|
||||
|
||||
if (ItemUtils.isSword(player.getInventory().getItemInMainHand())) {
|
||||
@ -328,25 +329,24 @@ public final class CombatUtils {
|
||||
|
||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||
|
||||
if (swordsManager.canUseCounterAttack(damageSourceEntity)) {
|
||||
swordsManager.counterAttackChecks((LivingEntity) damageSourceEntity, event.getDamage());
|
||||
if (swordsManager.canUseCounterAttack(painSource)) {
|
||||
swordsManager.counterAttackChecks((LivingEntity) painSource, event.getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (damageSourceEntity instanceof Player && entityType == EntityType.PLAYER) {
|
||||
Player player = (Player) damageSourceEntity;
|
||||
if (painSourceRoot instanceof Player && entityType == EntityType.PLAYER) {
|
||||
Player player = (Player) painSourceRoot;
|
||||
|
||||
if (UserManager.getPlayer(player) == null) {
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer attackingPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (target instanceof Tameable) {
|
||||
if (heldItem.getType() == Material.BONE) {
|
||||
TamingManager tamingManager = attackingPlayer.getTamingManager();
|
||||
TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager();
|
||||
|
||||
if (tamingManager.canUseBeastLore()) {
|
||||
tamingManager.beastLore(target);
|
||||
@ -390,10 +390,10 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
else if (entityType == EntityType.WOLF) {
|
||||
Wolf wolf = (Wolf) damageSourceEntity;
|
||||
Wolf wolf = (Wolf) painSource;
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
|
||||
if (tamer != null && tamer instanceof Player && PrimarySkillType.TAMING.shouldProcess(target)) {
|
||||
if (tamer instanceof Player && PrimarySkillType.TAMING.shouldProcess(target)) {
|
||||
Player master = (Player) tamer;
|
||||
|
||||
if (!Misc.isNPCEntityExcludingVillagers(master) && PrimarySkillType.TAMING.getPermissions(master)) {
|
||||
@ -402,10 +402,10 @@ public final class CombatUtils {
|
||||
}
|
||||
}
|
||||
else if (entityType == EntityType.ARROW || entityType == EntityType.SPECTRAL_ARROW) {
|
||||
Projectile arrow = (Projectile) damageSourceEntity;
|
||||
Projectile arrow = (Projectile) painSource;
|
||||
ProjectileSource projectileSource = arrow.getShooter();
|
||||
|
||||
if (projectileSource != null && projectileSource instanceof Player && PrimarySkillType.ARCHERY.shouldProcess(target)) {
|
||||
if (projectileSource instanceof Player && PrimarySkillType.ARCHERY.shouldProcess(target)) {
|
||||
Player player = (Player) projectileSource;
|
||||
|
||||
if (!Misc.isNPCEntityExcludingVillagers(player) && PrimarySkillType.ARCHERY.getPermissions(player)) {
|
||||
|
Loading…
Reference in New Issue
Block a user