geforkt von Mirrors/Paper
Ursprung
1169e7473c
Commit
08fef325cc
@ -1,10 +1,14 @@
|
|||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import net.minecraft.core.BlockPosition;
|
||||||
import net.minecraft.world.entity.monster.warden.Warden;
|
import net.minecraft.world.entity.monster.warden.Warden;
|
||||||
|
import net.minecraft.world.entity.monster.warden.WardenAi;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warden {
|
public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warden {
|
||||||
|
|
||||||
@ -27,6 +31,11 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
|
|||||||
return EntityType.WARDEN;
|
return EntityType.WARDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAnger() {
|
||||||
|
return getHandle().getAngerManagement().getActiveAnger(getHandle().getTarget());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAnger(Entity entity) {
|
public int getAnger(Entity entity) {
|
||||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||||
@ -48,4 +57,32 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
|
|||||||
getHandle().clearAnger(((CraftEntity) entity).getHandle());
|
getHandle().clearAnger(((CraftEntity) entity).getHandle());
|
||||||
getHandle().getAngerManagement().increaseAnger(((CraftEntity) entity).getHandle(), anger);
|
getHandle().getAngerManagement().increaseAnger(((CraftEntity) entity).getHandle(), anger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearAnger(Entity entity) {
|
||||||
|
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||||
|
|
||||||
|
getHandle().clearAnger(((CraftEntity) entity).getHandle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LivingEntity getEntityAngryAt() {
|
||||||
|
return (LivingEntity) getHandle().getEntityAngryAt().map(net.minecraft.world.entity.Entity::getBukkitEntity).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDisturbanceLocation(Location location) {
|
||||||
|
Preconditions.checkArgument(location != null, "Location cannot be null");
|
||||||
|
|
||||||
|
WardenAi.setDisturbanceLocation(getHandle(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AngerLevel getAngerLevel() {
|
||||||
|
return switch (getHandle().getAngerLevel()) {
|
||||||
|
case CALM -> AngerLevel.CALM;
|
||||||
|
case AGITATED -> AngerLevel.AGITATED;
|
||||||
|
case ANGRY -> AngerLevel.ANGRY;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren