SPIGOT-1934: Expand EnderDragon API - implement dragon phases

This commit is contained in:
Matthew authored and md_5 committed 2016-03-23 07:30:12 +11:00
1 parent 616a9687a1
commit 5fe510da59
4 files changed
+142

No files matched your search

@@ -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
}
}