Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import net.minecraft.server.v1_8_R3.Entity;
- import net.minecraft.server.v1_8_R3.NBTTagCompound;
- import org.bukkit.Location;
- import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Wither;
- public class SpawnWither {
- private Wither wither;
- private Location location;
- private String nameWither;
- public SpawnWither(Location location, String nameWither){
- this.location = location;
- this.nameWither = nameWither;
- this.wither = (Wither) this.location.getWorld().spawnEntity(this.location, EntityType.WITHER);
- Entity nmsEntity = ((CraftEntity) this.wither).getHandle();
- nmsEntity.setCustomName(this.nameWither);
- nmsEntity.setCustomNameVisible(true);
- this.wither.setHealth(15);
- NBTTagCompound witherTag = nmsEntity.getNBTTag();
- if(witherTag == null){
- witherTag = new NBTTagCompound();
- }
- nmsEntity.c(witherTag);
- witherTag.setInt("NoAI", 1);
- nmsEntity.f(witherTag);
- }
- public double getHealth(){
- return wither.getHealth();
- }
- public void setHealth(double health){
- wither.setHealth(health);
- }
- public Location getLocation(){
- return location;
- }
- public String getName(){
- return nameWither;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement