Skip to content

Commit

Permalink
Added some new Stardust category icons to pick from, including 2b2t p…
Browse files Browse the repository at this point in the history
…layer heads.
  • Loading branch information
0xTas committed Oct 12, 2024
1 parent 17735ec commit 8f5eb04
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/main/java/dev/stardust/util/StardustUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.stardust.util;

import java.io.File;
import java.util.UUID;
import java.time.Instant;
import java.util.Optional;
import dev.stardust.Stardust;
import net.minecraft.util.Hand;
import net.minecraft.text.Text;
Expand All @@ -10,14 +12,17 @@
import net.minecraft.item.ItemStack;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.MutableText;
import com.mojang.authlib.GameProfile;
import net.minecraft.network.packet.Packet;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import com.mojang.authlib.properties.Property;
import net.minecraft.network.packet.c2s.play.*;
import io.netty.util.internal.ThreadLocalRandom;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.component.DataComponentTypes;
import dev.stardust.mixin.ClientConnectionAccessor;
import net.minecraft.component.type.ProfileComponent;
import static meteordevelopment.meteorclient.MeteorClient.mc;
import meteordevelopment.meteorclient.systems.modules.Modules;
import net.minecraft.network.encryption.NetworkEncryptionUtils;
Expand Down Expand Up @@ -145,8 +150,11 @@ public static ItemStack chooseMenuIcon() {
};
private static final ItemStack[] menuIcons = {
Items.CAKE.getDefaultStack(),
Items.SPAWNER.getDefaultStack(),
Items.BEDROCK.getDefaultStack(),
Items.GOAT_HORN.getDefaultStack(),
Items.HONEYCOMB.getDefaultStack(),
Items.LODESTONE.getDefaultStack(),
Items.DRAGON_EGG.getDefaultStack(),
Items.FILLED_MAP.getDefaultStack(),
Items.PINK_TULIP.getDefaultStack(),
Expand All @@ -156,27 +164,69 @@ public static ItemStack chooseMenuIcon() {
Items.PINK_PETALS.getDefaultStack(),
Items.WARPED_SIGN.getDefaultStack(),
Items.CHERRY_SIGN.getDefaultStack(),
Items.WIND_CHARGE.getDefaultStack(),
Items.WRITTEN_BOOK.getDefaultStack(),
Items.DAMAGED_ANVIL.getDefaultStack(),
Items.CHERRY_SAPLING.getDefaultStack(),
Items.JACK_O_LANTERN.getDefaultStack(),
Items.KNOWLEDGE_BOOK.getDefaultStack(),
Items.FIREWORK_ROCKET.getDefaultStack(),
Items.TOTEM_OF_UNDYING.getDefaultStack(),
Items.LIME_SHULKER_BOX.getDefaultStack(),
Items.AMETHYST_CLUSTER.getDefaultStack(),
Items.FLOWERING_AZALEA.getDefaultStack(),
Items.PINK_SHULKER_BOX.getDefaultStack(),
Items.GILDED_BLACKSTONE.getDefaultStack(),
Items.OMINOUS_TRIAL_KEY.getDefaultStack(),
Items.HEART_POTTERY_SHERD.getDefaultStack(),
Items.LIGHT_BLUE_SHULKER_BOX.getDefaultStack(),
Items.ENCHANTED_GOLDEN_APPLE.getDefaultStack(),
Items.HEARTBREAK_POTTERY_SHERD.getDefaultStack(),
Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE.getDefaultStack(),
discIcons[ThreadLocalRandom.current().nextInt(discIcons.length)],
doorIcons[ThreadLocalRandom.current().nextInt(doorIcons.length)],
getCustomIcons()[ThreadLocalRandom.current().nextInt(getCustomIcons().length)]
};

private static ItemStack[] getCustomIcons() {
// Encoded profile textures taken from illegal player head items on 2b2t.org (except for mine.)
final String tasHeadTexture = "ewogICJ0aW1lc3RhbXAiIDogMTcyODQwNzM3MDc3MiwKICAicHJvZmlsZUlkIiA6ICJjZTA5ODE3NzBkMjc0NmY1YTM3ODUxODg5NzcxYmEyNyIsCiAgInByb2ZpbGVOYW1lIiA6ICIweFRhcyIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8yZGNlNGNlNWVh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CIsImlzUHVibGljIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTlkMWU2YzRmNjFkZmNmZGE2NDE3MjJmNjU3NzJiMTI3YmI0NDFkMGViMjU4YTM2Y2MxOTEzYmU3NTkyNGIxIn19fQ==";

// Get textures for the current player's head item
Optional<Property> currentPlayerProfileProperties = mc.getGameProfile().getProperties().get("textures").stream().findFirst();

String currentPlayerHeadTexture;
if (currentPlayerProfileProperties.isPresent()) {
currentPlayerHeadTexture = currentPlayerProfileProperties.get().value();
} else {
currentPlayerHeadTexture = "ewogICJ0aW1lc3RhbXAiIDogMTcyODQ5NzQxNzUwNCwKICAicHJvZmlsZUlkIiA6ICJkMDUwMzNmYzM3N2Q0OGU1ODFiMGJhYTY0NDBmNTIyOCIsCiAgInByb2ZpbGVOYW1lIiA6ICJQYXVsc3RldmUwMDciLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTk1YmQzOWQ5M2ZiYjI4NGVhNGEzYmJiMTljNzRlNTUxOGQwODRiNmZiMGQ5YjE1ZWQ2YzU2NzdmMDhkY2FhYyIKICAgIH0KICB9Cn0=";
}

String[] playerHeadTextures = {
currentPlayerHeadTexture, tasHeadTexture, popbobHeadTexture, pyrobyteHeadTexture,
iTristanHeadTexture, hausemasterHeadTexture, jackTheRippaHeadTexture, cytoToxicTCellHeadTexture
};

ItemStack playerHead = new ItemStack(Items.PLAYER_HEAD);
GameProfile profile = new GameProfile(UUID.randomUUID(), "Stardust");
ProfileComponent profileComponent = new ProfileComponent(profile);

// Apply a player head texture to the ItemStack
profileComponent.properties().put(
"textures",
new Property(
"textures", // Select a random player head texture from the playerHeadTextures array.
playerHeadTextures[ThreadLocalRandom.current().nextInt(playerHeadTextures.length)],""
)
);
playerHead.set(DataComponentTypes.PROFILE, profileComponent);

ItemStack enchantedPick = new ItemStack(
ThreadLocalRandom.current().nextInt(2) == 0 ? Items.DIAMOND_PICKAXE : Items.NETHERITE_PICKAXE);
enchantedPick.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, true);
Expand Down Expand Up @@ -213,6 +263,7 @@ private static ItemStack[] getCustomIcons() {
ripTridentFly.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, true);

return new ItemStack[] {
playerHead,
enchantedPick, sword32k, illegalBow, bindingPumpkin, cgiElytra, ripTridentFly,
enchantedGlass[ThreadLocalRandom.current().nextInt(enchantedGlass.length)]
};
Expand Down

0 comments on commit 8f5eb04

Please sign in to comment.