#1468: Expand riptiding API

By: ShreyasAyyengar <shreyas.ayyengar@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2024-09-07 18:08:13 +10:00
parent 106225f127
commit 7657f347d2
3 changed files with 36 additions and 6 deletions

View file

@ -160,6 +160,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
getHandle().stopSleepInBed(true, setSpawnLocation);
}
@Override
public void startRiptideAttack(int duration, float damage, ItemStack attackItem) {
Preconditions.checkArgument(duration > 0, "Duration must be greater than 0");
Preconditions.checkArgument(damage >= 0, "Damage must not be negative");
getHandle().startAutoSpinAttack(duration, damage, CraftItemStack.asNMSCopy(attackItem));
}
@Override
public Location getBedLocation() {
Preconditions.checkState(isSleeping(), "Not sleeping");

View file

@ -656,6 +656,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().isAutoSpinAttack();
}
@Override
public void setRiptiding(boolean riptiding) {
getHandle().setLivingEntityFlag(EntityLiving.LIVING_ENTITY_FLAG_SPIN_ATTACK, riptiding);
}
@Override
public boolean isSleeping() {
return getHandle().isSleeping();