Search in sources :

Example 1 with ServerBossEvent

use of net.minecraft.server.level.ServerBossEvent in project SpongeCommon by SpongePowered.

the class HackyBossBarPlatformBridgeMixin method bridge$asVanillaServerBar.

@Override
public ServerBossEvent bridge$asVanillaServerBar() {
    if (this.bridge$vanillaServerBar == null) {
        final BossBar $this = (BossBar) this;
        this.bridge$vanillaServerBar = new ServerBossEvent(SpongeAdventure.asVanilla($this.name()), SpongeAdventure.asVanilla($this.color()), SpongeAdventure.asVanilla($this.overlay()));
        final BossEventBridge bridge = (BossEventBridge) this.bridge$vanillaServerBar;
        bridge.bridge$copyAndAssign($this);
        $this.addListener(new VanillaBossBarListener(this.bridge$vanillaServerBar));
    }
    return this.bridge$vanillaServerBar;
}
Also used : ServerBossEvent(net.minecraft.server.level.ServerBossEvent) BossEventBridge(org.spongepowered.common.bridge.world.BossEventBridge) VanillaBossBarListener(org.spongepowered.common.adventure.VanillaBossBarListener) BossBar(net.kyori.adventure.bossbar.BossBar)

Example 2 with ServerBossEvent

use of net.minecraft.server.level.ServerBossEvent in project SpongeCommon by SpongePowered.

the class ServerPlayerMixin_API method hideBossBar.

@Override
public void hideBossBar(final BossBar bar) {
    if (this.impl$isFake) {
        return;
    }
    final ServerBossEvent vanilla = SpongeAdventure.asVanillaServer(Objects.requireNonNull(bar, "bar"));
    vanilla.removePlayer((net.minecraft.server.level.ServerPlayer) (Object) this);
}
Also used : ServerBossEvent(net.minecraft.server.level.ServerBossEvent)

Example 3 with ServerBossEvent

use of net.minecraft.server.level.ServerBossEvent in project SpongeCommon by SpongePowered.

the class ServerPlayerMixin_API method showBossBar.

@Override
public void showBossBar(final BossBar bar) {
    if (this.impl$isFake) {
        return;
    }
    final ServerBossEvent vanilla = SpongeAdventure.asVanillaServer(Objects.requireNonNull(bar, "bar"));
    vanilla.addPlayer((net.minecraft.server.level.ServerPlayer) (Object) this);
}
Also used : ServerBossEvent(net.minecraft.server.level.ServerBossEvent)

Aggregations

ServerBossEvent (net.minecraft.server.level.ServerBossEvent)3 BossBar (net.kyori.adventure.bossbar.BossBar)1 VanillaBossBarListener (org.spongepowered.common.adventure.VanillaBossBarListener)1 BossEventBridge (org.spongepowered.common.bridge.world.BossEventBridge)1