mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 05:03:55 -07:00
Transition to Maven
This commit is contained in:
42
src/main/java/org/bukkit/craftbukkit/CraftLivingEntity.java
Normal file
42
src/main/java/org/bukkit/craftbukkit/CraftLivingEntity.java
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
import org.bukkit.LivingEntity;
|
||||
|
||||
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
private EntityLiving entity;
|
||||
|
||||
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
|
||||
super(server, entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public int getHealth() {
|
||||
return entity.ba;
|
||||
}
|
||||
|
||||
public void setHealth(int health) {
|
||||
if ((health < 0) || (health > 20)) {
|
||||
throw new IllegalArgumentException("Health must be between 0 and 20");
|
||||
}
|
||||
|
||||
entity.ba = health;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLiving getHandle() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setHandle(final EntityLiving entity) {
|
||||
super.setHandle((Entity)entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftLivingEntity{" + "id=" + getEntityID() + '}';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user