Respect to the unemployed people who built this...
β–² 2 r/bloxd

Respect to the unemployed people who built this...

This is the "obsidian" highway in the previous The Bloxd SMP, made out of Compressed Messy Stone. It stretches from spawn all the way to the world border, and in all 4 directions!

The highway is 3 blocks wide, and every 1000 blocks there is a checkpoint where people leave their names and there is a pixel art of how far away it is from spawn. To put that into perspective, this is around 4800000 Compressed Messy Stone, which would take almost 2 years of non-stop mining to mine it since Compressed Messy Stone takes 12 seconds to mine.

Unfortunately, this was all lost to the great reset. RIP to the people who worked so hard on building this🫑

u/PreviousInsurance742 β€” 2 days ago
β–² 2 r/bloxd

Welcome back to 2024! :D

I added old armour, Chest (not moonstone or iron because it looks better as is) and gun textures to my texture pack.

I also made Snow textures more textured (it has subtle chunks of ice in it). The the concrete textures were also improved, by making them more rough like concrete in real life. You might think that ruin's concrete builds and pixel art, but it actually makes it better since it looks like it is painted. It is very subtle and hard to notice from a distance.

Other than textures, I also added a sky with clouds (this one is a placeholder I'll make it more blocky later) and the official Minecraft font (Mojangles) so that it feels more immersive for a block game.

You can download the texture pack at: https://drive.google.com/file/d/1QAd6qPJCm0b7Z-ork0SoS4onPYBBEzc5/view?usp=sharing

Welcome back to 2024-ish!

u/PreviousInsurance742 β€” 2 days ago
β–² 1 r/bloxd

I added the staff before Bloxd.io.

In bloxd.cc you can find textures of upcoming weapons like catapults, shields and staffs. I'm not sure what ability they are actually giving to it, but I think riding on a cloud feels right.

Put in the world code, and use the Code Block code to get the staff, then click on it to ride on a cloud!

World Code:

heldItem = {}
customName = ""

function onPlayerClick(playerId, x, y, z, target, targetEId) {
    if ((customName && customName.includes("Staff"))) {
            api.setVelocity(playerId, 0, 20, 0)
        api.updateEntityNodeMeshAttachment(
    playerId,
    "TorsoNode",
    "ParticleEmitter",
    {
        texture: "square_particle",
        dir1: [-1, 2, -1],
        dir2: [1, 4, 1],
        gravity: [0, -100, 0],
        emitRate: 100,
        minLifeTime: 0.1,
        maxLifeTime: 0.1,
        minEmitPower: 1,
        maxEmitPower: 2.5,
        minSize: 1,
        maxSize: 2,
        width: 0.6,
        height: 0.1,
        depth: 0.6,
        blendMode: 1,
        colorGradients: [
            { timeFraction: 0.0, minColor: [255, 255, 255, 1], maxColor: [230, 230, 230, 0.5] },
        ],
        velocityGradients: [
            { timeFraction: 0, factor: 2, factor2: 3 },
            { timeFraction: 1, factor: 0.1, factor2: 0.3 }
        ]
    },
    [0, -0.6, 0],
    [0, 0, 0]
)
        api.setPlayerPhysicsState(playerId, {type: 3, tier: 1})
    }
}

function onBlockStand(playerId, x, y, z, blockName) {
    heldItem = api.getHeldItem(playerId);

    if (!heldItem) return;

    customName = heldItem.attributes?.customDisplayName;

    if ((customName && customName.includes("Staff"))) {
        api.updateEntityNodeMeshAttachment(
    playerId,
    "TorsoNode",
    "ParticleEmitter",
    {
        texture: "square_particle",
        dir1: [-1, 2, -1],
        dir2: [1, 4, 1],
        gravity: [0, -100, 0],
        emitRate: 100,
        minLifeTime: 0.1,
        maxLifeTime: 0.1,
        minEmitPower: 1,
        maxEmitPower: 2.5,
        minSize: 1,
        maxSize: 2,
        width: 0.6,
        height: 0.1,
        depth: 0.6,
        blendMode: 1,
        colorGradients: [
            { timeFraction: 0.0, minColor: [255, 255, 255, 1], maxColor: [230, 230, 230, 0.5] },
        ],
        velocityGradients: [
            { timeFraction: 0, factor: 2, factor2: 3 },
            { timeFraction: 1, factor: 0.1, factor2: 0.3 }
        ]
    },
    [0, -0.6, 0],
    [0, 0, 0]
)
} else {
        api.updateEntityNodeMeshAttachment(playerId, "TorsoNode", null);
}
}

Code Block:

api.giveItem(myId, "Moonstone Spear", 1, {"customDisplayName": "Moonstone Staff"})
u/PreviousInsurance742 β€” 2 days ago
β–² 10 r/bloxd

Somebody protected my base, so I built walls and a roof above it to block out the sunlight.

The last image shows how dark it is when the sun rose fully!

I was away from Sandbox Survival lobby 2222 for more than 30 days since I died with all my enchanted diamond armour and gave up a bit, I forgot about it and when I logged back in the base was protected. I decided to mine a few Super Compressed Messy Stone placed at spawn to get many stacks of Messy Stone and build walls and a roof around the protected base.

That was before day and night was added to Sandbox Survival. Yesterday, when it was added, I decided to quickly finish it. I protected the walls and the roof so that the "owner" cannot break it. In 2 in-game days and nights, I finished it up.

The sun set over my base, and it never rose again. The stolen base is now engulfed in darkness, and the "owner" would never see the sun again. At least I didn't overreact.

u/PreviousInsurance742 β€” 3 days ago
β–² 14 r/bloxd

Infection map lore!

Subway map:
Some normal humans drove to a mall carpark, but there were zombies there! They had to run to the subway that goes to the airport to escape.

Airport map:
The remaining humans from the Subway map came here. The start of the Airport map looks like the exit of a subway station. However, there were zombies lurking around in the airport too! They had to escape to the plane and take off!

Hospital map:
Some people drove to the shut-down hospital to get to the helicopter on the roof and fly away. There were zombies chasing them. Some humans managed to get onto the helicopter and fly a bit, but a zombie snuck onto the helicopter! The remaining humans were infected, causing the helicopter to fly out of control and hit the plane that just took off from the airport! It blasted a hole into it and the zombies entered.

Farm map:
The plane ended up crashing into a farm, and everybody was still alive, including the zombies! There is a truck at the other end of the farm, and some humans managed to get there. They then found a secret underground bunker and drove in!

Bunker map:
The humans went into the bunker, where they were joined by other humans living safely inside! However, zombies have secretly followed them there too! They had to fight their way to the top of the bunker into the forest.

They finally defeated the zombies and went over a hill. They found an abandoned laboratory that was emitting strange signals. They heard an alarm go: "WARNING, AN ANOMALY HAS BREACHED CONTAINMENT!"...

We never heard of them ever since. That is, until the next Infection update!

u/PreviousInsurance742 β€” 4 days ago
β–² 2 r/bloxd

I found a custom game thumbnail using my image! :D

I took it on Minecraft while testing some shaders XD

u/PreviousInsurance742 β€” 4 days ago
β–² 1 r/bloxd

Homing missile code!

Just punch a mob or player and shoot a Bouncy Bomb to activate the homing ability!

It will keep tracking the target and can even hit it mid-air or perform a smash!

I used the Bouncy Bomb as it is useless normally and can destroy blocks.

The code was much easier to make than I expected, u/Round-Ad6257 made one but didn't want to share as he put in a lot of effort into it. When I asked for the code he told me to just make it myself, so here it is! I had some problems getting the lifeform closest to the camera vector, so I'll make do with this!

World Code:

let missile = null;
let entity = null;

function onPlayerUsedThrowable(playerId, throwableName, thrownEntityId) {
    if (throwableName === "Bouncy Bomb") {
        missile = thrownEntityId;
    }
}

function onPlayerDamagingMob(playerId, mobId, damageDealt, damagerDbId) {
    entity = mobId;
}

function onPlayerDamagingOtherPlayer(playerId, targetPlayerId, damageDealt) {
    entity = targetPlayerId;
}

function tick(ms) {
    if (!missile || !entity) return;

    try {
        const mPos = api.getPosition(missile);
        const tPos = api.getPosition(entity);

        if (!mPos || !tPos) return;

        const [ma, mb, mc] = mPos;
        const [tx, ty, tz] = tPos;

        let dx = tx - ma;
        let dy = ty - mb;
        let dz = tz - mc;

        const distance = Math.hypot(dx, dy, dz);

        if (distance > 0.5) {
            const vx = (dx / distance) * 20;
            const vy = (dy / distance) * 20;
            const vz = (dz / distance) * 20;

            api.setVelocity(missile, vx, vy, vz);
        } else {
            missile = null;
        }
    } catch (e) {
        missile = null;
    }
}
u/PreviousInsurance742 β€” 4 days ago
β–² 3 r/bloxd

Where do Slimes spawn?

I played for so long but I haven't found a single Slime. I looked into caves and the surface, but I can't find any. Where do they spawn? From the update log it looks like it spawns in caves!

Also, the Slime seems like a weaker Wolf with a lot of health. It can create trails in protected chunks or spawn protected chunks, but the trails disappear after some time.

reddit.com
u/PreviousInsurance742 β€” 5 days ago
β–² 4 r/bloxd

This gun reloads so fast it glitches your game!

api.giveItem(myId, "Striker-12", 1, {
    customDisplayName: "idk gun",   
    customAttributes: {
        "gunStats": {                     
            "gunType": "semi_automatic",    
            "clipSize": 2,              
            "autoFireWithMouse": true,      
            "fireRate": 6000,               
            "damage":1,                
            "reloadTime": 0.000000000000000000001,           
            "inaccuracyStanding": 10,       
            "inaccuracyFromShot": 300,        
            "inaccuracyMovement": 10,        
            "inaccuracyFromJump": 10,        
            "yVelocityInaccuracy": 10,       
            "minKickback": 0,              
            "maxKickback": 0,               
            "altInaccuracyFromJump": 2,                 
        "altInaccuracyFromShot": 150,     
            "altInaccuracyMovement": 2,     
            "altYVelocityInaccuracy": 2,    
            "altInaccuracyStanding": 2     
        }
    }
});
u/PreviousInsurance742 β€” 6 days ago
β–² 8 r/bloxd

Why is nobody talking about the new items?

They are dropped from Containment Breach anomalies!

Use this code to get them! They are useful for custom weapons in your custom games!

api.giveItem(myId,"Molten Cog")
api.giveItem(myId,"Frost Shard")
api.giveItem(myId,"Choir Bell")
api.giveItem(myId,"Siege Core")
api.giveItem(myId,"Flywheel")
api.giveItem(myId,"Brood Sac")
api.giveItem(myId,"Radiant Spark")
api.giveItem(myId,"Teleport Heart")
api.giveItem(myId,"Bandolier")
u/PreviousInsurance742 β€” 7 days ago
β–² 2 r/bloxd

Please DO NOT add RTP to your modded survival worlds.

If you add RTP we can't find any players to PvP with. It also makes it too easy to get resources.

Especially if you are going to add custom weapons or stuff, DO NOT add it.

reddit.com
u/PreviousInsurance742 β€” 8 days ago
β–² 4 r/bloxd

I kind of figured out how .bloxdschem files work.

When you try to open it in a text editor, it how random binary data, but the block data (like Chest loot or Board text) and the world code is untouched. The random binary data is very annoying to deal with, so I had to figure out what encryption it uses.

Apparently it uses a custom unknown binary layout, so I decided to decrypt what I can.

I used a Python script to crack the thing (Gemini helped a bit). It uses the Little Endian format. I learnt that the first few lines just tell WorldBuilder the name of the schematic. I used an even more complex script to dump out everything decodable that looks like coordinates or whatever

It returned lots of data packets, so blocks aren't stored as simple X, Y, Z entries because that makes the file too massive. Instead, they pack the data into numbers. When I made yet another script to change one type of numbers into another number, the new schematic actually came out and I could load it into Bloxd.io no problem, but it jumbled up groups of blocks and made it look like the farlands.

I'll look into existing Bloxd.io tools that do stuff with schematics (I have one but I basically copied the schematic handling from somewhere), and try to figure out exactly what is going on with these annoying files.

u/PreviousInsurance742 β€” 9 days ago
β–² 4 r/bloxd

We need somebody to promote this subreddit.

This subreddit has lost almost 2K weekly users since last year. We need to promote this subreddit so that it gets more popular, but also not bring in a bunch of underaged kids! Try promoting it on Discord or Bloxdhub, perhaps?

reddit.com
u/PreviousInsurance742 β€” 10 days ago
β–² 1 r/Sub4Sub

PERMSUB4PERMSUB

I permanently subscribe to everyone, but some people just unsubscribe after subscribing to me :(

I will also like and comment (permanently of course) on your videos if you do so to me!

Please do not unsubscribe, or I will unsubscribe you!

I will return quick!

Link:Β https://youtu.be/Ky0SiZ_rS5w

u/PreviousInsurance742 β€” 10 days ago
β–² 9 r/bloxd

My first Bloxd.io animation!

Just a very simple 5 second animation showing the difference between mobile and PC PvP.

u/PreviousInsurance742 β€” 10 days ago
β–² 6 r/bloxd

Here are some things we got before Minecraft!

Autumn forests (Autumn Maple Forest -> Dappled Forest)
Sitting on stuff other than mounts (emotes -> cushion)
Balls (Ball -> Sulfur Cube)
Grey wood (Gray Planks -> Poplar Planks)
White wood (White Planks -> Pale Oak Planks)
Light red stone set (red chalk set -> cinnabar set)
Light yellow stone (yellow chalk set -> sulfur set)

u/PreviousInsurance742 β€” 10 days ago
β–² 5 r/bloxd

Did you know that Bloxd.io has attribute swapping?

You can throw a projectile and quickly switch to another weapon and its special ability would be added to the projectile!

You can do this to do knockback using Arrows without using Arrows of Knockback, or reel enemies in from even further than a Diamond Whip's range!

u/PreviousInsurance742 β€” 11 days ago
β–² 3 r/bloxd

Code for an entire Crystal PvP custom game!

Not clickbait and not stolen, I made this entire thing and my game kind of did go well at first, but it is quite dead now so I am just going to share it, feel free to copy as long as you give credit.

Unlike other End Crystal codes, this uses actual Super RPG explosions to add to the chaos. It tries to make it as close to Minecraft (and Bloxd.io) as possible, with some balancing and other changes.

Along with End Crystals, this code also includes Respawn Anchors, Fire, Turtle Master Potions and more!

Click a Code Block with the Code Block code provided to get the items!

World Code:

function onPlayerJoin(playerId) {
api.setWalkThroughType(playerId, "Magenta Portal", false)
}

function onPlayerChangeBlock(playerId, x, y, z, from, to, drop, frominfo, toinfo) {
id = playerId
if (from == "Magenta Portal") {
api.setBlock(x, y + 3, z, "Red Portal")
const throwableId = api.attemptCreateThrowable(
    playerId,
    "Super RPG",
    [x + 0.5, y + 4, z + 0.5],
    [-0.0009692441090010107,-0.9999995231628418,0.00024610062246210873],
    1,
    1,
)
api.setBlock(x, y + 2, z, "Air")
}
if (to == "Purple Ceramic" || to == "Purple Ceramic|meta|rot2" || to == "Purple Ceramic|meta|rot3" || to == "Purple Ceramic|meta|rot4") {
api.setBlockData(x, y, z, {charge: 0})
}
}

function onPlayerAttemptAltAction(playerId, x, y, z, block, a) {
if (api.getHeldItem(playerId).name == "Magenta Paintball Explosive Item" && block == "Obsidian" || api.getHeldItem(playerId).name == "Magenta Paintball Explosive Item" && block == "Bedrock") {
if (api.getBlock(x, y +1, z) == "Air") {
api.setBlock(x, y + 1, z, "Magenta Portal")
api.removeItemName(playerId, "Magenta Paintball Explosive Item", 1)
}
}
if (block == "Purple Ceramic" || block == "Purple Ceramic|meta|rot2" || block == "Purple Ceramic|meta|rot3" || block == "Purple Ceramic|meta|rot4") {
if (api.getHeldItem(playerId).name == "Golden Decoration") {
api.sendFlyingMiddleMessage(playerId, "Respawn Anchor charge at: " + String(api.getBlockData(x, y, z).charge), 10)
api.setBlockData(x, y, z, {charge: api.getBlockData(x, y, z).charge + 1})
if (api.getBlockData(x, y, z).charge == 4) {
const throwableId = api.attemptCreateThrowable(
    playerId,
    "Super RPG",
    [x + 0.5, y + 1, z + 0.5],
    [-0.0009692441090010107,-0.9999995231628418,0.00024610062246210873],
    1,
    1,
)
}
}
}
}

function onAttemptKillPlayer(killed, killer) {
if (api.getHeldItem(killed).name == "Yellow Paintball") {
api.giveItem(killer, "Gold Coin", 1)
api.sendFlyingMiddleMessage(killer, "Popped " + api.getEntityName(killed) + "'s totem! Received 1 Gold Coin! :D", 10)
slot = api.getSelectedInventorySlotI(killed)
api.applyEffect(killed, 'Health Regen', 5000, {inbuiltLevel: 2});
api.applyEffect(killed, "Heat Resistance", 10000, {inbuiltLevel: 1})
api.setHealth(killed, 30)
api.setShieldAmount(killed, 30);
api.setItemSlot(killed, slot, "Air")
x = api.getPosition(killed)[0]
y = api.getPosition(killed)[1]
z = api.getPosition(killed)[2]
api.playParticleEffect({
 dir1: [-1, -1, -1],
 dir2: [1, 1, 1],
  pos1: [x + 2, y + 1.5, z + 2],
    pos2: [x - 2, y - 1.5, z - 2],
    texture: "glint",
    minLifeTime: 0.5,
    maxLifeTime: 2,
    minEmitPower: 4,
    maxEmitPower: 6,
    minSize: 0.1,
   maxSize: 0.5,
    manualEmitCount: 85,
    gravity: [0, -10, 0],
    colorGradients: [
       {
           timeFraction: 0,
            minColor: [211, 214, 0, 0.5],
            maxColor: [0, 255, 0, 0.8],
        },
    ],
    velocityGradients: [
        {
            timeFraction: 1,
            factor: 0.2,
            factor2: 1,
        },
    ],
    blendMode: 1,
})
return "preventDeath"
} else {
api.giveItem(killer, "Gold Coin", 5)
api.sendFlyingMiddleMessage(killer, "Killed "+ api.getEntityName(killed) + "! Received 5 Gold Coins! :D", 10)
}
}

function onPlayerThrowableHitTerrain(playerId, name, tid) {
x = api.getPosition(tid)[0]
y = api.getPosition(tid)[1]
z = api.getPosition(tid)[2]
if (
  api.getBlock(x, y, z) == "Magenta Portal" ||

  // Faces
  api.getBlock(x + 1, y, z) == "Magenta Portal" ||
  api.getBlock(x - 1, y, z) == "Magenta Portal" ||
  api.getBlock(x, y + 1, z) == "Magenta Portal" ||
  api.getBlock(x, y - 1, z) == "Magenta Portal" ||
  api.getBlock(x, y, z + 1) == "Magenta Portal" ||
  api.getBlock(x, y, z - 1) == "Magenta Portal" ||

  // Edges (2-axis diagonals)
  api.getBlock(x + 1, y + 1, z) == "Magenta Portal" ||
  api.getBlock(x + 1, y - 1, z) == "Magenta Portal" ||
  api.getBlock(x - 1, y + 1, z) == "Magenta Portal" ||
  api.getBlock(x - 1, y - 1, z) == "Magenta Portal" ||

  api.getBlock(x + 1, y, z + 1) == "Magenta Portal" ||
  api.getBlock(x + 1, y, z - 1) == "Magenta Portal" ||
  api.getBlock(x - 1, y, z + 1) == "Magenta Portal" ||
  api.getBlock(x - 1, y, z - 1) == "Magenta Portal" ||

  api.getBlock(x, y + 1, z + 1) == "Magenta Portal" ||
  api.getBlock(x, y + 1, z - 1) == "Magenta Portal" ||
  api.getBlock(x, y - 1, z + 1) == "Magenta Portal" ||
  api.getBlock(x, y - 1, z - 1) == "Magenta Portal" ||

  // Corners (3-axis diagonals)
  api.getBlock(x + 1, y + 1, z + 1) == "Magenta Portal" ||
  api.getBlock(x + 1, y + 1, z - 1) == "Magenta Portal" ||
  api.getBlock(x + 1, y - 1, z + 1) == "Magenta Portal" ||
  api.getBlock(x + 1, y - 1, z - 1) == "Magenta Portal" ||
  api.getBlock(x - 1, y + 1, z + 1) == "Magenta Portal" ||
  api.getBlock(x - 1, y + 1, z - 1) == "Magenta Portal" ||
  api.getBlock(x - 1, y - 1, z + 1) == "Magenta Portal" ||
  api.getBlock(x - 1, y - 1, z - 1) == "Magenta Portal"
) {
  id = playerId;

api.setBlock(x, y + 3, z, "Red Portal")
const throwableId = api.attemptCreateThrowable(
    playerId,
    "Super RPG",
    [x + 0.5, y + 4, z + 0.5],
    [-0.0009692441090010107,-0.9999995231628418,0.00024610062246210873],
    1,
    1,
)
api.setBlock(x, y + 2, z, "Air")
}
}

function onPlayerDamagingOtherPlayer(attackingPlayer, damagedPlayer, damageDealt, withItem, bodyPartHit, damagerDbId) {
if (withItem == "Gold Spikes" && api.getEffects(damagedPlayer).includes("Heat Resistance")) {
return "preventDamage"
}
}

function onBlockStand(playerId, x, y, z, blockName) {
if (blockName == "Patterned Lime Glass") {
api.setPosition(playerId, 133, 108, 799)
}
}

let playerKills = {}
let playerDeaths = {}
let legacyKills = {}
let combinedKills = {}
let leaderboardPlayers = []
let leaderboardIndexState = {} // { playerId: [index, isLoading] }
let leaderboardOrder = []
let leaderboardPosition = {} // { dbid: position }
let leaderboardTickDelay = 0

function saveSlot(id, slot, data) {
  api.setMoonstoneChestItemSlot(id, slot, "Yellow Carpet", 1, {
    customDisplayName: JSON.stringify(data)
  })
}

function loadSlot(id, slot) {
  let item = api.getMoonstoneChestItemSlot(id, slot)
  if (!item?.attributes?.customDisplayName) return null
  try { return JSON.parse(item.attributes.customDisplayName) } catch { return null }
}

function addKills(playerId, amount) {
  const dbid = api.getPlayerDbId(playerId)
  const name = api.getEntityName(playerId)
  if (!playerKills[dbid]) playerKills[dbid] = [name, 0]
  playerKills[dbid][0] = name
  playerKills[dbid][1] += amount
  saveSlot(playerId, 0, playerKills[dbid][1])
  updatePlayerListStats(playerId)
}

function addDeaths(playerId, amount) {
  const dbid = api.getPlayerDbId(playerId)
  const name = api.getEntityName(playerId)
  if (!playerDeaths[dbid]) playerDeaths[dbid] = [name, 0]
  playerDeaths[dbid][0] = name
  playerDeaths[dbid][1] += amount
  saveSlot(playerId, 2, playerDeaths[dbid][1])
  updatePlayerListStats(playerId)
}

function onPlayerJoin(playerId) {
api.setWalkThroughType(playerId, "Magenta Portal", false)
  api.sendMessage(playerId, "Welcome to End Crystal PvP! Read the instructions at Lobby Spawn and get your gear there too!", { color: "lime" })
 api.sendMessage(playerId, "Owner: RealSlothuLT3 | Co Owner: starsdust", { color: "lime" })

  const dbid = api.getPlayerDbId(playerId)
  const name = api.getEntityName(playerId)

  const resetFlag = loadSlot(playerId, 5)

  if (resetFlag !== "done") {
    playerKills[dbid] = [name, 0]
    playerDeaths[dbid] = [name, 0]
    saveSlot(playerId, 0, 0)
    saveSlot(playerId, 2, 0)
    saveSlot(playerId, 5, "done")
  } else {
    const storedKills = loadSlot(playerId, 0)
    const storedDeaths = loadSlot(playerId, 2)
    playerKills[dbid] = [name, typeof storedKills === "number" ? storedKills : 0]
    playerDeaths[dbid] = [name, typeof storedDeaths === "number" ? storedDeaths : 0]
  }

  updateRank(playerId)

  api.setClientOption(playerId, "lobbyLeaderboardInfo", {
    pfp: {},
    name: { displayName: "Name" },
    a: { displayName: "Kills" },
    b: { displayName: "Deaths" }
  })
}
function onPlayerKilledOtherPlayer(killer, victim) {
  addKills(killer, 1)
  addDeaths(victim, 1)
updateRank(killer)
}
function onPlayerRespawn(playerId) {
  addDeaths(playerId, 1)
}
function tick() {
  combinedKills = { ...legacyKills, ...playerKills }
  leaderboardTickDelay--
  if (leaderboardTickDelay <= 0) {
    leaderboardTickDelay = 20
    leaderboardOrder = Object.keys(combinedKills)
    leaderboardOrder.sort((a, b) => (combinedKills[b]?.[1] || 0) - (combinedKills[a]?.[1] || 0))
    leaderboardOrder = leaderboardOrder.filter(id => combinedKills[id] && typeof combinedKills[id][1] === "number")
    leaderboardPosition = {}
    for (let i = 0; i < leaderboardOrder.length; i++) {
      leaderboardPosition[leaderboardOrder[i]] = i + 1
    }
  }
  if (leaderboardPlayers.length > 0) {
    let id = leaderboardPlayers[0]
    let index = leaderboardIndexState[id][0]
    if (index >= 30) index = 0

    let slotData = loadSlot(id, 6 + index)

    if (slotData != null && !leaderboardIndexState[id][1] && Array.isArray(slotData)) {
      for (let entry of slotData) {
        if (!Array.isArray(entry) || entry.length < 3) continue
        if (!(entry[0] in legacyKills)) {
          legacyKills[entry[0]] = [entry[1], entry[2]]
        } else if (entry[2] > legacyKills[entry[0]][1]) {
          legacyKills[entry[0]] = [entry[1], entry[2]]
        }
      }
    }

    if (index * 4 < leaderboardOrder.length && !leaderboardIndexState[id][1]) {
      let chunk = []
      for (let i = 0; i < 4; i++) {
        if (index * 4 + i >= leaderboardOrder.length) break
        chunk.push([leaderboardOrder[index * 4 + i], ...combinedKills[leaderboardOrder[index * 4 + i]]])
      }
      if (JSON.stringify(chunk) != JSON.stringify(slotData)) {
        saveSlot(id, 6 + index, chunk)
      }
    }

    index++
    leaderboardIndexState[id][0] = index
    leaderboardPlayers.push(leaderboardPlayers.shift())
  }
}
function updatePlayerListStats(playerId) {
  const dbid = api.getPlayerDbId(playerId)
  const kills = playerKills[dbid]?.[1] || 0
  const deaths = playerDeaths[dbid]?.[1] || 0
  api.setTargetedPlayerSettingForEveryone(playerId, "lobbyLeaderboardValues", {
    a: kills.toString(),
    b: deaths.toString()
  })
  saveSlot(playerId, 0, kills)
  saveSlot(playerId, 2, deaths)
}
let playerRanks = {}
const rankColors = {
  "Wood 1 πŸͺ΅": "orange",
  "Bronze 2 πŸ₯‰": "orange",
  "Bronze 3 πŸ₯‰": "orange",
  "Silver 1 πŸ₯ˆ": "lightgray",
  "Silver 2 πŸ₯ˆ": "lightgray",
  "Silver 3 πŸ₯ˆ": "lightgray",
  "Gold 1 πŸ₯‡": "gold",
  "Gold 2 πŸ₯‡": "gold",
  "Gold 3 πŸ₯‡": "gold",
  "Diamond 1 πŸ’Ž": "cyan",
  "Diamond 2 πŸ’Ž": "cyan",
  "Diamond 3 πŸ’Ž": "cyan",
  "Moonstone 1 πŸ”·": "blue",
  "Moonstone 2 πŸ”·": "blue",
  "Moonstone 3 πŸ”·": "blue",
  "Master 1 ♣️": "red",
  "Master 2 ♣️": "red",
  "Master 3 ♣️": "red",
  "Elite 1 πŸ‘‘": "purple",
  "Elite 2 πŸ‘‘": "purple",
  "Elite 3 πŸ‘‘": "purple",
  "Undying 1 πŸ†": "pink",
  "Undying 2 πŸ†": "pink",
  "Undying 3 πŸ†": "pink",
  "Mythic 1 🌌": "lightyellow",
  "Mythic 2 🌌": "lightyellow",
  "Mythic 3 🌌": "lightyellow",
  "⚜️Legend⚜️ πŸ’―": "Yellow"
}
function getRankStyle(rank) {
  const color = rankColors[rank] || "white"
  const style = { color }
  return style
}
function updateRank(playerId) {
  const dbid = api.getPlayerDbId(playerId)
  const kills = playerKills[dbid]?.[1] || 0
  const name = api.getEntityName(playerId)
  let rank = "new πŸ€–"
  if (kills >= 5000) rank = "⚜️Legend⚜️ πŸ’―"
  else if (kills >= 4000) rank = "Mythic 3 🌌"
  else if (kills >= 3750) rank = "Mythic 2 🌌"
  else if (kills >= 3500) rank = "Mythic 1 🌌"
  else if (kills >= 3250) rank = "Undying 3 πŸ†"
  else if (kills >= 2950) rank = "Undying 2 πŸ†"
  else if (kills >= 2650) rank = "Undying 1 πŸ†"
  else if (kills >= 2350) rank = "Elite 3 πŸ‘‘"
  else if (kills >= 2100) rank = "Elite 2 πŸ‘‘"
  else if (kills >= 1850) rank = "Elite 1 πŸ‘‘"
  else if (kills >= 1600) rank = "Master 3 ♣️"
  else if (kills >= 1400) rank = "Master 2 ♣️"
  else if (kills >= 1200) rank = "Master 1 ♣️"
  else if (kills >= 1000) rank = "Moonstone 3 πŸ”·"
  else if (kills >= 850) rank = "Moonstone 2 πŸ”·"
  else if (kills >= 700) rank = "Moonstone 1 πŸ”·"
  else if (kills >= 550) rank = "Diamond 3 πŸ’Ž"
  else if (kills >= 450) rank = "Diamond 2 πŸ’Ž"
  else if (kills >= 350) rank = "Diamond 1 πŸ’Ž"
  else if (kills >= 250) rank = "Gold 3 πŸ₯‡"
  else if (kills >= 200) rank = "Gold 2 πŸ₯‡"
  else if (kills >= 150) rank = "Gold 1 πŸ₯‡"
  else if (kills >= 100) rank = "Silver 3 πŸ₯ˆ"
  else if (kills >= 75) rank = "Silver 2 πŸ₯ˆ"
  else if (kills >= 50) rank = "Silver 1 πŸ₯ˆ"
  else if (kills >= 25) rank = "Bronze 3 πŸ₯‰"
  else if (kills >= 10) rank = "Bronze 2 πŸ₯‰"
  else if (kills >= 5) rank = "Wood 1 πŸͺ΅"
  const previous = playerRanks[dbid] || "Dirt 🟫"
  if (rank !== previous) {
    api.sendMessage(playerId, `You leveled up! Now you are: ${rank}  congrats`, { color: "cyan" })
    api.playSound(playerId, "cashRegister", 1, 1)
    api.broadcastMessage(`${name} ranked up to: ${rank} !!`, { color: "gold"})
  }

  playerRanks[dbid] = rank

  const style = getRankStyle(rank)
  api.setTargetedPlayerSettingForEveryone(playerId, "nameTagInfo", {
    content: [{ str: name, style: { color: "cyan" } }],
    subtitle: [{ str: `[${rank}]`, style }]
  }, true)
  updatePlayerListStats(playerId)
}

function playerCommand(id, message) {
  const [cmd, targetName, amountStr] = message.split(" ")
  const senderName = api.getEntityName(id)

  if (cmd === "leaderboard") {
    let top = Object.entries(combinedKills)
      .sort((a, b) => (b[1][1] || 0) - (a[1][1] || 0))
      .slice(0, 10)

    if (top.length === 0) {
      api.sendMessage(id, "Leaderboard is empty.", { color: "gray" })
      return
    }

    api.sendMessage(id, "Top Kills:", { color: "aqua" })
    for (let i = 0; i < top.length; i++) {
      const [dbid, [name, kills]] = top[i]
      api.sendMessage(id, `${i + 1}. ${name}: ${kills} kills`, { color: "white" })
    }
    return
  }
}
function onPlayerChat(player,message){const dbid=api.getPlayerDbId(player),rank=playerRanks[dbid]||"NEW",name=api.getEntityName(player),style=getRankStyle(rank)
api.broadcastMessage([{str:`[${rank}]`,style},{str:` ${name}`,style:{color:"lightred"}},{str:`: ${message}`}])
return false}

Code Block:

api.giveItem(myId, "Magenta Paintball Explosive Item", 999, {customDisplayName: "End Crystal", customDescription: "Place and break for BOOM"})

api.giveItem(myId, "Yellow Paintball", 1, {customDisplayName: "Totem of Undying", customDescription: "Pops and saves you when you die if you hold it!"})

api.giveItem(myId, "Diamond Sword", 1, {
  customAttributes: {
    enchantments: {
      "Vertical Knockback": 3
    },
"enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Spade", 1, {
  customAttributes: {
    enchantments: {
      "Break Speed": 3
    },
"enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Pickaxe", 1, {
  customAttributes: {
    enchantments: {
      "Break Speed": 3
    },
"enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Helmet", 1, {
  customAttributes: {
    enchantments: {
      "Protection": 5,
      "Health": 6,
      "Health Regen": 4
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Chestplate", 1, {
  customAttributes: {
    enchantments: {
      "Protection": 5,
      "Health": 6,
      "Health Regen": 4
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Gauntlets", 1, {
  customAttributes: {
    enchantments: {
      "Protection": 5,
      "Health": 6,
      "Health Regen": 4
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Leggings", 1, {
  customAttributes: {
    enchantments: {
      "Protection": 5,
      "Health": 6,
      "Health Regen": 4
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Boots", 1, {
  customAttributes: {
    enchantments: {
      "Protection": 5,
      "Health": 6,
      "Health Regen": 4
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Boots", 1, {
  customAttributes: {
    enchantments: {
      "Protection": 5,
      "Health": 6,
      "Health Regen": 4
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Arrow", 999, {
  customAttributes: {
    enchantments: {
      "Arrow Damage": 1
    },
 "enchantmentTier":"Tier 5",
  }
})
api.giveItem(myId, "Diamond Bow", 1, {
  customAttributes: {
    enchantments: {
      "Arrow Damage": 1
    },
 "enchantmentTier":"Tier 5",
  }
})

api.giveItem(myId, "Obsidian", 999)

api.giveItem(myId, "Steak", 999)

api.giveItem(myId, "Moonstone Orb", 999)

api.giveItem(myId, "Gold Spikes", 999, {
customDisplayName: "Fire",
})

api.giveItem(myId, "Purple Ceramic", 68, {customDisplayName: "Respawn Anchor", customDescription: "Charge up with Golden Decoration for BOOM"})
api.giveItem(myId, "Golden Decoration", 272, {customDescription: "Right click with me to charge up a Respawn Anchor!"})
u/PreviousInsurance742 β€” 11 days ago