#ReferenceError: 'MinecraftEffectTypes' is not defined at onHitEntity

1 messages · Page 1 of 1 (latest)

young horizon
#
import { world } from "@minecraft/server"

world.beforeEvents.worldInitialize.subscribe(initEvent => {
 initEvent.itemComponentRegistry.registerCustomComponent('dwmc:flare_in', {
  onHitEntity: e => {
   e.hitEntity.addEffect(MinecraftEffectTypes.Blindness, 100);
  },
 });
});

Im new at Scripting okay?

agile hazel
#

include MinecraftEffectTypes in your imports

import { world, MinecraftEffectTypes } from "@minecraft/server"
young horizon
#

uh

#
[Scripting][error]-Plugin [Decaying winter BP - 1.0.0] - [main.js] ran with error: [SyntaxError: Could not find export 'MinecraftEffectTypes' in module '@minecraft/server']
rich bridge
young horizon
rich bridge
#

It seems like there is such a thing in the code examples in the documentation, but it is imported from a non-existent module..

young horizon
rich bridge
#

just use a string

young horizon
rich bridge
#

entity.addEffect("blindness")

young horizon
#

or it will apply for 5 seconds

young horizon
#

???

#

alright

young horizon
#

this?

#

thanks

#

i will check this rq