1
0
mirror of https://github.com/PaperMC/Paper.git synced 2025-04-06 12:06:50 +02:00

: Add missing Raider API and 'no action ticks'

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot 2023-06-23 09:58:59 +10:00
parent 3edbef0526
commit f0c9bae0f7
3 changed files with 59 additions and 0 deletions
paper-server/src/main/java/org/bukkit/craftbukkit

View File

@ -100,4 +100,8 @@ public final class CraftRaid implements Raid {
} }
}).collect(ImmutableList.toImmutableList()); }).collect(ImmutableList.toImmutableList());
} }
public net.minecraft.world.entity.raid.Raid getHandle() {
return handle;
}
} }

View File

@ -334,6 +334,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().invulnerableTime = ticks; getHandle().invulnerableTime = ticks;
} }
@Override
public int getNoActionTicks() {
return getHandle().getNoActionTime();
}
@Override
public void setNoActionTicks(int ticks) {
Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0");
getHandle().setNoActionTime(ticks);
}
@Override @Override
public EntityLiving getHandle() { public EntityLiving getHandle() {
return (EntityLiving) entity; return (EntityLiving) entity;

View File

@ -2,8 +2,10 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import net.minecraft.world.entity.raid.EntityRaider; import net.minecraft.world.entity.raid.EntityRaider;
import org.bukkit.Raid;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftRaid;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftSound; import org.bukkit.craftbukkit.CraftSound;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
@ -25,6 +27,27 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
return "CraftRaider"; return "CraftRaider";
} }
@Override
public void setRaid(Raid raid) {
getHandle().setCurrentRaid(raid != null ? ((CraftRaid) raid).getHandle() : null);
}
@Override
public Raid getRaid() {
return getHandle().getCurrentRaid() == null ? null : new CraftRaid(getHandle().getCurrentRaid());
}
@Override
public void setWave(int wave) {
Preconditions.checkArgument(wave >= 0, "wave must be >= 0");
getHandle().setWave(wave);
}
@Override
public int getWave() {
return getHandle().getWave();
}
@Override @Override
public Block getPatrolTarget() { public Block getPatrolTarget() {
return getHandle().getPatrolTarget() == null ? null : CraftBlock.at(getHandle().level(), getHandle().getPatrolTarget()); return getHandle().getPatrolTarget() == null ? null : CraftBlock.at(getHandle().level(), getHandle().getPatrolTarget());
@ -60,6 +83,27 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
getHandle().setCanJoinRaid(join); getHandle().setCanJoinRaid(join);
} }
@Override
public boolean isCelebrating() {
return getHandle().isCelebrating();
}
@Override
public void setCelebrating(boolean celebrating) {
getHandle().setCelebrating(true);
}
@Override
public int getTicksOutsideRaid() {
return getHandle().getTicksOutsideRaid();
}
@Override
public void setTicksOutsideRaid(int ticks) {
Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0");
getHandle().setTicksOutsideRaid(ticks);
}
@Override @Override
public Sound getCelebrationSound() { public Sound getCelebrationSound() {
return CraftSound.getBukkit(getHandle().getCelebrateSound()); return CraftSound.getBukkit(getHandle().getCelebrateSound());