3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

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

Dieser Commit ist enthalten in:
konsolas 2020-02-19 23:04:55 +00:00 committet von md_5
Ursprung d5ef2eab9e
Commit f7ab30557e

Datei anzeigen

@ -32,6 +32,7 @@ import net.minecraft.server.EntityTippedArrow;
import net.minecraft.server.EntityTypes; import net.minecraft.server.EntityTypes;
import net.minecraft.server.EntityWither; import net.minecraft.server.EntityWither;
import net.minecraft.server.EntityWitherSkull; import net.minecraft.server.EntityWitherSkull;
import net.minecraft.server.EnumHand;
import net.minecraft.server.GenericAttributes; import net.minecraft.server.GenericAttributes;
import net.minecraft.server.MobEffect; import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList; 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; 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 @Override
public void setCollidable(boolean collidable) { public void setCollidable(boolean collidable) {
getHandle().collides = collidable; getHandle().collides = collidable;