#633: Add LivingEntity#attack, LivingEntity#swingMainHand, LivingEntity#swingOffHand

This commit is contained in:
konsolas 2020-02-19 23:04:55 +00:00 committed by md_5
parent d5ef2eab9e
commit f7ab30557e

View file

@ -32,6 +32,7 @@ import net.minecraft.server.EntityTippedArrow;
import net.minecraft.server.EntityTypes;
import net.minecraft.server.EntityWither;
import net.minecraft.server.EntityWitherSkull;
import net.minecraft.server.EnumHand;
import net.minecraft.server.GenericAttributes;
import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList;
@ -583,6 +584,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).isNoAI(): false;
}
@Override
public void attack(Entity target) {
Preconditions.checkArgument(target != null, "target == null");
getHandle().B(((CraftEntity) target).getHandle()); // PAIL rename attack
}
@Override
public void swingMainHand() {
getHandle().a(EnumHand.MAIN_HAND); // PAIL rename swingHand
}
@Override
public void swingOffHand() {
getHandle().a(EnumHand.OFF_HAND); // PAIL rename swingHand
}
@Override
public void setCollidable(boolean collidable) {
getHandle().collides = collidable;