Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

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