
    StartupEvents.registry('palladium:abilities', (event) => {
        event.create('heroes:dimensional_storage')
            .icon(palladium.createItemIcon('palladium:vibranium_circuit'))
            .addProperty("id_scoreboard", "string", "Score.Board", "Scoreboard used to identify storage id")
            .addProperty("timer_scoreboard", "string", "Score.Board", "Scoreboard used for timer")
            .addProperty("close_tag", "string", "Close.Tag", "Scoreboard used for timer")

			.firstTick((entity, entry, holder, enabled) => {
				if (enabled) {
					const score_id = entry.getPropertyByName('id_scoreboard');
					const score_timer = entry.getPropertyByName('timer_scoreboard');
                    let username_name = entity.getName().getString();
                    let username = entity.username;
                    let scoreboard = Utils.server.scoreboard;
					
                    let scoreboard_obj = scoreboard.getObjective(entry.getPropertyByName("id_scoreboard"));
                    let score = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj);
                    let value = score.getScore();

					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag] run scoreboard players set @s " + score_timer + " 0");
					}
					})
					
            .tick((entity, entry, holder, enabled) => {
                if (enabled) {
					const score_id = entry.getPropertyByName('id_scoreboard');
					const score_timer = entry.getPropertyByName('timer_scoreboard');
					const close_tag = entry.getPropertyByName('close_tag');
                    let username_name = entity.getName().getString();
                    let username = entity.username;
                    let scoreboard = Utils.server.scoreboard;
					let dimension_x = entity.persistentData.pocket_x;
					let dimension_y = entity.persistentData.pocket_y;
					let dimension_z = entity.persistentData.pocket_z;
					
                    let scoreboard_obj = scoreboard.getObjective(entry.getPropertyByName("id_scoreboard"));
                    let score = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj);
                    let value = score.getScore();
					
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag] run scoreboard players remove @s " + score_timer + " 1");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run give @e[name=" + username_name + ",distance=0.01..] dirt 1");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run data remove storage heroes:spatial_" + value + " Items");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run data modify storage heroes:spatial_" + value + " Items set from entity @e[type=minecraft:chest_minecart,limit=1,scores={" + score_id + "=" + value + "}] Items");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run data modify entity @e[type=minecraft:chest_minecart,limit=1,scores={" + score_id + "=" + value + "}] Items set value 0");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run tag @e[scores={" + score_id + "=" + value + "}] add " + close_tag + "");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run forceload remove " + dimension_x + " " + dimension_z + " " + dimension_x + " " + dimension_z + "");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=Spatial_Tag,scores={" + score_timer + "=..0}] run kill @e[tag=Spatial_Tag,scores={" + score_id + "=" + value + "}]");
					
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] anchored eyes positioned ~ ~-10 ~ run summon armor_stand ^ ^ ^2 {Marker:1,CustomName:\'{\"text\":\"" + username_name + "\"}\',NoGravity:1,Invulnerable:1b,Palladium:{Properties:{superpowers:[\"heroes:pocket_dimension\"]}},Invisible:1b,Tags:[\"pocket_" + username_name + "_" + value + "\",\"Spatial_Tag\"],Passengers:[{id:\"minecraft:chest_minecart\",Tags:[\"pocket_" + username_name + "_" + value + "\",\"Spatial_Tag\"],CustomName:\'{\"text\":\"Dimensional Storage\"}\',Invulnerable:1,NoGravity:1,Motion:[0.0d,0.01d,0.0d]}]}");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run forceload add " + dimension_x + " " + dimension_z + " " + dimension_x + " " + dimension_z + "");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scoreboard players set @e[tag=pocket_" + username_name + "_" + value + "] Heroes.Pocket.X " + dimension_x + "");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scoreboard players set @e[tag=pocket_" + username_name + "_" + value + "] Heroes.Pocket.Z " + dimension_z + "");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scoreboard players set @e[tag=pocket_" + username_name + "_" + value + "] " + score_id + " " + value + "");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run data modify entity @e[type=minecraft:chest_minecart,limit=1,scores={" + score_id + "=" + value + "}] Items set from storage heroes:spatial_" + value + " Items");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scale delay set pehkui:model_height 0 @e[tag=pocket_" + username_name + "_" + value + "]");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scale delay set pehkui:model_width 0 @e[tag=pocket_" + username_name + "_" + value + "]");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scale set pehkui:model_width 0 @e[tag=pocket_" + username_name + "_" + value + "]");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=1}] run scale set pehkui:model_height 0 @e[tag=pocket_" + username_name + "_" + value + "]");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag,scores={" + score_timer + "=..2}] run scoreboard players add @s " + score_timer + " 1");
					entity.server.runCommandSilent("execute as " + username + " at @s[tag=!Spatial_Tag] run scoreboard players set @e[tag=pocket_" + username_name + "_" + value + ",distance=..11] " + score_timer + " 2");
                }
          
			});
    });