Skip to content

Commit

Permalink
1.2.0-beta.1
Browse files Browse the repository at this point in the history
Completely rewrite tags
Make sure cosmetics button doesn't show if essential is not there
Implement disabling / enabling config
  • Loading branch information
Wyvest committed Jul 25, 2024
1 parent 4b5876f commit 82aa3eb
Show file tree
Hide file tree
Showing 21 changed files with 310 additions and 151 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_id=skyclientcosmetics
mod_name=SkyClientCosmetics
mod_version=1.1.18
mod_version=1.2.0-beta.1
mod_archives_name=SkyClientCosmetics

# Gradle Configuration -- DO NOT TOUCH THESE VALUES.
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginManagement {
maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit
}
plugins {
val pgtVersion = "0.6.2" // Sets the default versions for Polyfrost Gradle Toolkit
val pgtVersion = "0.6.5" // Sets the default versions for Polyfrost Gradle Toolkit
id("org.polyfrost.multi-version.root") version pgtVersion
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/co/skyclient/scc/SkyclientCosmetics.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
import co.skyclient.scc.gui.greeting.IntroductionGreetingSlide;
import co.skyclient.scc.gui.greeting.OptimizationSlide;
import co.skyclient.scc.gui.greeting.components.GreetingSlide;
import co.skyclient.scc.listeners.ChatListeners;
import co.skyclient.scc.listeners.TagListeners;
import co.skyclient.scc.listeners.GuiListeners;
import co.skyclient.scc.listeners.PlayerListeners;
import co.skyclient.scc.mixins.ServerListAccessor;
import co.skyclient.scc.rpc.RPC;
import co.skyclient.scc.utils.Files;
import co.skyclient.scc.utils.ReplayModCompat;
import com.replaymod.core.ReplayMod;
import com.replaymod.recording.Setting;
import de.jcm.discordgamesdk.Core;
import me.partlysanestudios.partlysaneskies.config.OneConfigScreen;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -113,7 +111,7 @@ public void onInit(FMLInitializationEvent event) {
progress.step("Registering Listeners");

MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new ChatListeners());
MinecraftForge.EVENT_BUS.register(new TagListeners());
MinecraftForge.EVENT_BUS.register(new PlayerListeners());
MinecraftForge.EVENT_BUS.register(new GuiListeners());

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/co/skyclient/scc/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public static void reloadTags() {
@Switch(name = "First Time Message", description = "Get \"First time message\" when u join next time", category = "Misc", subcategory = "Chat")
public static boolean joinMessage = true;

@Switch(name = "Tags in Display Names", description = "Shows tags above player names\n\u00A7c(May crash)", category = "Misc", subcategory = "Tags")
public static boolean displayTags = false;

public static boolean hasWipedOutPSS = false;
public static boolean hasWipedOutReplayModAutoRecording = false;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/co/skyclient/scc/cosmetics/TagCosmetics.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void initialize() {
for (Tag tag : tagsToBeAdded) {
if (tag.getIdentifier().equals(perm.getIdentifier())) {
for (String user : perm.getUsers()) {
tags.put(user.toLowerCase(Locale.ENGLISH), tag);
tags.put(user, tag);
}
break;
}
Expand All @@ -98,7 +98,7 @@ public boolean isInitialized() {
@Nullable
public Tag getTag(@NotNull String username) {
if (!isInitialized()) return null;
return tags.getOrDefault(username.toLowerCase(Locale.ENGLISH), null);
return tags.getOrDefault(username, null);
}

public HashMap<String, Tag> getTags() {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/co/skyclient/scc/gui/SkyClientMainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SkyClientMainMenu extends GuiMainMenu {
private int panoramaTimer;
private ResourceLocation backgroundTexture;
private GuiButton selectedButton;
private static Class<?> cosmeticGui;
private static Class<?> cosmeticGui = null;

static {
try {
Expand Down Expand Up @@ -81,7 +81,9 @@ public void initGui() {
} else {
buttonList.add(new GuiButton(6, width / 20, (height / 2) + 100, 100, 20, "Quit Game"));
}
buttonList.add(new ImageButton(new ResourceLocation("scc", "cosmetics.png"), 7, width - 22, height - 35, 20, 20));
if (cosmeticGui != null) {
buttonList.add(new ImageButton(new ResourceLocation("scc", "cosmetics.png"), 7, width - 22, height - 35, 20, 20));
}
//buttonList.add(new ImageButton(new ResourceLocation("scc", "essential4.png"), 7, width - 22, height - 35, 20, 20));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package co.skyclient.scc.hooks;

import co.skyclient.scc.cosmetics.Tag;

public interface NetworkPlayerInfoHook {
Tag scc$getTag();
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void injectIntoClassLoader(LaunchClassLoader classLoader) {
MixinBootstrap.getPlatform().getClass().getDeclaredMethod("addContainer", containerClass).invoke(MixinBootstrap.getPlatform(), container);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("OneConfig's Mixin loading failed. Please contact https://polyfrost.cc/discord to resolve this issue!");
throw new RuntimeException("OneConfig's Mixin loading failed. Please contact https://polyfrost.org/discord to resolve this issue!");
}
}
} catch (Exception ignored) {
Expand Down
112 changes: 0 additions & 112 deletions src/main/java/co/skyclient/scc/listeners/ChatListeners.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/co/skyclient/scc/listeners/GuiListeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onGuiAction(GuiScreenEvent.ActionPerformedEvent.Post event) {

@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END && Settings.customMainMenu) {
if (event.phase == TickEvent.Phase.END && SkyclientCosmetics.config.enabled && Settings.customMainMenu) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu && !(Minecraft.getMinecraft().currentScreen instanceof SkyClientMainMenu)) {
Minecraft.getMinecraft().displayGuiScreen(new SkyClientMainMenu());
}
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/co/skyclient/scc/listeners/PlayerListeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import cc.polyfrost.oneconfig.utils.Notifications;
import co.skyclient.scc.SkyclientCosmetics;
import co.skyclient.scc.config.Settings;
import co.skyclient.scc.cosmetics.Tag;
import co.skyclient.scc.cosmetics.TagCosmetics;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent;

Expand All @@ -36,16 +33,4 @@ public void onPlayerLoggedIn(FMLNetworkEvent.ClientConnectedToServerEvent event)
SkyclientCosmetics.config.save();
}
}

@SubscribeEvent
public void onNameFormat(PlayerEvent.NameFormat event) {
if (event.entity == null || event.entityPlayer == null || event.entityPlayer.isDead || event.displayname == null) return;

if (Settings.displayTags) {
Tag tag = TagCosmetics.getInstance().getTag(event.displayname);
if (tag != null) {
event.displayname = tag.getTag() + " " + event.displayname;
}
}
}
}
Loading

0 comments on commit 82aa3eb

Please sign in to comment.