SPIGOT-1934: Expand EnderDragon API - implement dragon phases

By: Matthew <stteg@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2016-03-15 23:32:37 -04:00
parent c0cd5222ed
commit 15f22a7986
4 changed files with 142 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableSet.Builder;
import java.util.Set;
import net.minecraft.server.DragonControllerPhase;
import net.minecraft.server.EntityComplexPart;
import net.minecraft.server.EntityEnderDragon;
@@ -41,4 +42,22 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
public EntityType getType() {
return EntityType.ENDER_DRAGON;
}
@Override
public Phase getPhase() {
return Phase.values()[getHandle().getDataWatcher().get(EntityEnderDragon.a)]; // PAIL: Rename PHASE
}
@Override
public void setPhase(Phase phase) {
getHandle().cT().a(getMinecraftPhase(phase)); // PAIL: Rename getDragonControllerManager setPhase
}
public static Phase getBukkitPhase(DragonControllerPhase phase) {
return Phase.values()[phase.b()];
}
public static DragonControllerPhase getMinecraftPhase(Phase phase) {
return DragonControllerPhase.a(phase.ordinal()); // PAIL: Rename getById
}
}