Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 976 Bytes

File metadata and controls

31 lines (23 loc) · 976 Bytes

GetEffects

Return list of object contain EffectType class and Effecf class. This will allow us to get the effect identifier when Effect class doesn't have typeId property.

How to use?

import { system } from "@minecraft/server";
import getEffects from "./getEffects";

// Check if player has absorbtion effect
system.runInterval(() => {
  for (const player of world.getPlayers()) {
    const absorbtion = getEffects(player)
      .find((eff) => eff.effectType.getName() === "minecraft:absorbtion");
    if (!absorbtion) continue;
    
    console.warn(`${player.name} has absorbtion`)
  }
}, 20)

Properties

  • effectType: EffectType
    Get effect identifier
    return: EffectType

  • effect: Effect
    Get effect amplifier and duration
    return: Effect