#Item Entity Name Highlight

6 messages · Page 1 of 1 (latest)

still rivet
#
ServerEvents.tick((event) => {
  const { server } = event;

  if (server.tickCount % 2) return;

  server.entities.filterSelector("@e[type=item]").forEach(
    /** @param {Internal.ItemEntity_} itemEntity */
    (itemEntity) => {
      /** @type {{Item: { Count: Internal.ByteTag_, id: string }, Age: Internal.ShortTag_}} nbt */
      const { Item: item, Age } = itemEntity.nbt;

      const { descriptionId, rarity } = Item.of(item.id);

      itemEntity.customName = [
        Text.gold(`${item.Count}x`),
        " ",
        Text.translate(descriptionId).color(rarity.color),
        " ",
        Text.gray(`(${Age == -32768 ? "∞" : ((6000 - Age) / 20).toFixed(1)}s left)`),
      ];
      itemEntity.customNameVisible = true;
    }
  );
});
solar cairn
#

maybe change the seconds left to just s :p

raw aurora
#

TIL about filterSelector pepepoggers

silver knot
#

How laggy would this get with lots of item entities? Just curious

slender tusk
#

very nice !!! i love this :)

rich copper