#DynamicPropertiesDefinition error

1 messages · Page 1 of 1 (latest)

zenith pewter
#
import { system, ItemTypes, world, ItemStack, DynamicPropertiesDefinition} from '@minecraft/server';```
#
system.runInterval(async(event)=>
 {
    try{world.getAllPlayers().forEach((P) =>
{
    
    if (true) {
    if (P.selectedSlot == 8) 

{
    if (!P.hasTag("ssakAdd")){
    var ssakEntity = P.dimension.spawnEntity("ssak:inv",P.location);
    ssakEntity.nameTag="equip";
    tagItemAdd(P,ssakEntity.getComponent("inventory").container);
    P.setDynamicProperty("eid",ssakEntity.id)
    P.runCommand("tag @s add ssakAdd");
} else if (P.getDynamicProperty("eid")!=="None") {
    let bEntity = world.getEntity(P.getDynamicProperty("eid"));
    bEntity.runCommandAsync("tp @s "+P.name);
    let inv=bEntity.getComponent("inventory").container;
        
    let item=inv.getItem(0);
    if (item && !(item.hasTag("nb:head"))){
        P.dimension.spawnItem(item, {x:P.location.x,y:P.location.y,z:P.location.z});
        inv.setItem(0,null);};
         
    let item1=inv.getItem(1);
    if (item1 && !(item1.hasTag("nb:ear"))){
        P.dimension.spawnItem(item1, {x:P.location.x,y:P.location.y,z:P.location.z});
        inv.setItem(1,null);};
    let item2=inv.getItem(2);
    if (item2 && !(item2.hasTag("nb:necklace"))){
        P.dimension.spawnItem(item2, {x:P.location.x,y:P.location.y,z:P.location.z});
        inv.setItem(2,null);};
    let item3=inv.getItem(3);
    if (item3 && !(item3.hasTag("nb:body"))){
        P.dimension.spawnItem(item3, {x:P.location.x,y:P.location.y,z:P.location.z});
        inv.setItem(3,null);};
    let item4=inv.getItem(4);
    if (item4 && !(item4.hasTag("nb:ring"))){
        P.dimension.spawnItem(item4, {x:P.location.x,y:P.location.y,z:P.location.z});
        inv.setItem(4,null);};
    let item5=inv.getItem(5);
    if (item5 && !(item5.hasTag("nb:hands"))){
        P.dimension.spawnItem(item5, {x:P.location.x,y:P.location.y,z:P.location.z});
        inv.setItem(5,null);};
        
};```
frosty linden
zenith pewter
frosty linden
#

uh well then you used the methods wrong

#

the solution to the error you posted is to remove that import because:

  1. it doesn't exist
  2. you aren't using it
#

if the dynamic properties aren't working, then thats a different issue

quasi mica
#

I think you took this code from an old documentation I saw it earlier but it doesn't seem to exist (or at least it doesn't exist anymore)

quasi mica
#

I haven't tried it, I'm in the process of discovering it but it seems to me to have no defined structure from now on so maybe we can directly use the setDynamicProperty and getDynamicProperty methods

zenith pewter
#

Everything seems to stop working

quasi mica
#

put a try catch around your usage of methods

#

so you can debug without block the execution