diff --git a/mcproto/_types.py b/mcproto/_types.py index 12c7836..d183317 100644 --- a/mcproto/_types.py +++ b/mcproto/_types.py @@ -23,3 +23,36 @@ "red", "black", ] + +EFFECTE: TypeAlias = Literal[ + "speed", + "slowness", + "haste", + "mining_fatigue", + "strength", + "instant_health", + "instant_damage", + "jump_boost", + "nausea", + "regeneration", + "resistance", + "fire_resistance", + "water_breathing", + "invisibility", + "blindness", + "night_vision", + "hunger", + "weakness", + "poison", + "wither", + "health_boost", + "absorption", + "saturation", + "glowing", + "levitation", + "slow_falling", + "conduit_power", + "bad_omen", + "hero_of_the_village", + "dolphins_grace" +] diff --git a/mcproto/entity.py b/mcproto/entity.py index 6d10407..994f1f5 100644 --- a/mcproto/entity.py +++ b/mcproto/entity.py @@ -4,7 +4,7 @@ from functools import partial from ._base import HasStub, _EntityProvider -from ._types import COLOR +from ._types import COLOR, EFFECT from ._util import ThreadSafeCachedKeyBasedFactory from .colors import color_codes from .exception import raise_on_error @@ -121,11 +121,14 @@ def getEntitiesAround( return [e for e in entities if e is not self] def giveEffect( - self, effect: str, seconds: int = 30, amplifier: int = 0, particles: bool = True + self, effect: EFFECT, seconds: int = 30, amplifier: int = 0, particles: bool = True ) -> None: pbool = str(not bool(particles)).lower() self.runCommand(f"effect give @s {effect} {int(seconds)} {amplifier} {pbool}") + def clear_effect(self, EFFECT: str = "") -> None: + self.runCommand(f'effect clear @s {effect}') + def replaceItem(self, where: str, item: str, amount: int = 1, nbt: NBT | None = None) -> None: if nbt is None: self.runCommand(f"item replace entity @s {where} with {item} {amount}")