Skip to content

Commit

Permalink
feat: contributor cape
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Sep 7, 2024
1 parent 21cdf6f commit 02a8b57
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/uraneptus/sullysmod/core/SMConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class SMConfig {
public static final ForgeConfigSpec.ConfigValue<Boolean> DISABLE_SPIDER_IN_JUNGLE_SPAWNS;
public static final ForgeConfigSpec.ConfigValue<Boolean> ENABLE_POLISHABLE_TOOLTIP;
public static final ForgeConfigSpec.ConfigValue<Boolean> ENABLE_WOLF_CARNIVORE;
public static final ForgeConfigSpec.ConfigValue<Boolean> ENABLE_CONTRIBUTOR_CAPE;

public static final ForgeConfigSpec CLIENT;
public static final ForgeConfigSpec COMMON;
Expand All @@ -22,6 +23,7 @@ public class SMConfig {

//Client
ENABLE_POLISHABLE_TOOLTIP = CLIENT_BUILDER.comment("Enables the 'Polishable' tooltip on polishable items").define("Enable Polishable Tooltip", true);
ENABLE_CONTRIBUTOR_CAPE = CLIENT_BUILDER.comment("Enables the contributor or dev cape. If you're not a contributor or dev, you can ignore this").define("Enable Cape", true);

//COMMON
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.uraneptus.sullysmod.SullysMod;
import com.uraneptus.sullysmod.core.SMConfig;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
Expand All @@ -23,13 +24,21 @@ public class SMClientForgeEvents {
UUID.fromString("3fd1d511-62d6-4e18-a28d-3e3d4fd93620"), //Keke
UUID.fromString("1fb0ecbd-2000-4f00-aa65-002c1ccedef7") //Stelle
);
static final Set<UUID> CONTRIBUTORS = Set.of(
UUID.fromString("a69fc0f5-028a-4bee-9102-26ff3764017e"), //Sully alt
UUID.fromString("4d659277-fbcc-4fd8-9e80-c8e4c73d10b5"), //Sunken past artist
UUID.fromString("4378df24-8433-4b5c-b865-bf635b003ebb") //Farcr
);

@SubscribeEvent
public static void onEvent(RenderPlayerEvent.Post event) {
Player player = event.getEntity();
UUID uuid = player.getGameProfile().getId();
if (DEV_UUIDS.contains(uuid) || !FMLEnvironment.production) {
ResourceLocation cape = SullysMod.modPrefix("textures/entity/mosaic_modding_cape.png");

if ((CONTRIBUTORS.contains(uuid) || devPlayerOrIDE(uuid)) && SMConfig.ENABLE_CONTRIBUTOR_CAPE.get()) {
ResourceLocation cape = devPlayerOrIDE(uuid) ? SullysMod.modPrefix("textures/entity/mosaic_modding_cape.png") :
SullysMod.modPrefix("textures/entity/contributor_cape.png");

if (player instanceof AbstractClientPlayer clientPlayer && clientPlayer.playerInfo != null) {
if (clientPlayer.isCapeLoaded()) {
Map<MinecraftProfileTexture.Type, ResourceLocation> playerTextures = clientPlayer.playerInfo.textureLocations;
Expand All @@ -39,4 +48,8 @@ public static void onEvent(RenderPlayerEvent.Post event) {
}
}
}

private static boolean devPlayerOrIDE(UUID uuid) {
return DEV_UUIDS.contains(uuid) || !FMLEnvironment.production;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 02a8b57

Please sign in to comment.