13
0
geforkt von Mirrors/Paper

#1216: Add missing Raider API and 'no action ticks'

By: Parker Hawke <hawkeboyz2@hotmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2023-06-23 09:58:59 +10:00
Ursprung 3edbef0526
Commit f0c9bae0f7
3 geänderte Dateien mit 59 neuen und 0 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -334,6 +334,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
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
public EntityLiving getHandle() {
return (EntityLiving) entity;

Datei anzeigen

@ -2,8 +2,10 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.world.entity.raid.EntityRaider;
import org.bukkit.Raid;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftRaid;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftSound;
import org.bukkit.craftbukkit.block.CraftBlock;
@ -25,6 +27,27 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
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
public Block 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);
}
@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
public Sound getCelebrationSound() {
return CraftSound.getBukkit(getHandle().getCelebrateSound());