下面列出了怎么用net.minecraft.world.BossInfoServer的API类实例代码及写法,或者点击链接到github查看源代码。
private static void removeDragonBossBarHack(EntityPlayerMP player, WorldProviderEnd provider)
{
// Somewhat ugly way to clear the Boss Info stuff when teleporting FROM The End
DragonFightManager manager = provider.getDragonFightManager();
if (manager != null)
{
try
{
BossInfoServer bossInfo = ObfuscationReflectionHelper.getPrivateValue(DragonFightManager.class, manager, "field_186109_c");
if (bossInfo != null)
{
bossInfo.removePlayer(player);
}
}
catch (Exception e)
{
EnderUtilities.logger.warn("TP: Failed to get DragonFightManager#bossInfo");
}
}
}
public CraftBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
this.flags = flags.length > 0 ? EnumSet.of(flags[0], flags) : EnumSet.noneOf(BarFlag.class);
this.color = color;
this.style = style;
handle = new BossInfoServer(
CraftChatMessage.fromString(title, true)[0],
convertColor(color),
convertStyle(style)
);
updateFlags();
}
public BossInfoServer getBossInfo() {
return bossInfo;
}