From 80138f2b62739658aa675ed3efee644821a45f3c Mon Sep 17 00:00:00 2001 From: syeyoung Date: Fri, 24 Feb 2023 14:30:56 +0900 Subject: - New Cosmetics Signed-off-by: syeyoung --- .../mod/cosmetics/CosmeticsManager.java | 35 ++++-- .../mod/features/FeatureRegistry.java | 2 + .../impl/cosmetics/FeaturePlayerModel.java | 51 ++++++++ .../impl/cosmetics/widget/WidgetButton2.java | 57 +++++++++ .../cosmetics/widget/WidgetNicknamePrefix.java | 12 +- .../impl/cosmetics/widget/WidgetPlayerModel.java | 130 +++++++++++++++++++++ .../mod/features/impl/etc/FeaturePenguins.java | 34 +++++- .../playerpreview/widget/PlayerModelRenderer.java | 27 +++-- .../dungeonsguide/gui/config/cosmetics/button3.gui | 26 +++++ .../gui/config/cosmetics/playerModel.gui | 60 ++++++++++ 10 files changed, 410 insertions(+), 24 deletions(-) create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeaturePlayerModel.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetButton2.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetPlayerModel.java create mode 100644 mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/button3.gui create mode 100644 mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/playerModel.gui (limited to 'mod') diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java index ea5dba43..505173f9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java @@ -24,6 +24,7 @@ import kr.syeyoung.dungeonsguide.mod.cosmetics.surgical.ReplacementContext; import kr.syeyoung.dungeonsguide.mod.cosmetics.surgical.SurgicalReplacer; import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerListItemPacketEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.stomp.StompHeader; import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; @@ -293,7 +294,8 @@ public class CosmeticsManager { String prefix = null; if (rawPrefix != null) { prefix = rawPrefix.substring(1); - if (!rawPrefix.startsWith("T")) { + char control = rawPrefix.charAt(0); + if (control != 'T' && control != 'Y') { if (rawPrefixColor != null) prefix = rawPrefixColor+"["+prefix+"§r"+rawPrefixColor+"]"; } @@ -389,22 +391,33 @@ public class CosmeticsManager { public void nameFormat(PlayerEvent.NameFormat nameFormat) { List activeCosmetics = activeCosmeticByPlayer.get(nameFormat.entityPlayer.getGameProfile().getId()); if (activeCosmetics == null) return; - CosmeticData color=null; - CosmeticData prefix=null; - for (ActiveCosmetic activeCosmetic : activeCosmetics) { - CosmeticData cosmeticData = cosmeticDataMap.get(activeCosmetic.getCosmeticData()); - if (cosmeticData !=null && cosmeticData.getCosmeticType().equals("color")) { - color = cosmeticData; - } else if (cosmeticData != null && cosmeticData.getCosmeticType().equals("prefix")) { - prefix = cosmeticData; + String color=null, rawPrefix=null, rawPrefixColor=null; + for (ActiveCosmetic activeCosmetic : activeCosmetics) { + CosmeticData cosmeticData = getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); + if (cosmeticData != null && cosmeticData.getCosmeticType().equals("ncolor")) { + color = cosmeticData.getData().replace("&", "§"); + } else if (cosmeticData != null && cosmeticData.getCosmeticType().equals("nprefix")) { + rawPrefix = cosmeticData.getData().replace("&", "§"); + } else if (cosmeticData != null && cosmeticData.getCosmeticType().equals("bracket_color")) { + rawPrefixColor = cosmeticData.getData().replace("&", "§"); + } + } + + String prefix = null; + if (rawPrefix != null) { + prefix = rawPrefix.substring(1); + char control = rawPrefix.charAt(0); + if (control != 'T' && control != 'Y') { + if (rawPrefixColor != null) + prefix = rawPrefixColor+"["+prefix+"§r"+rawPrefixColor+"]"; } } if (color != null) - nameFormat.displayname = color.getData().replace("&","§")+nameFormat.username; + nameFormat.displayname = color+nameFormat.username; if (prefix != null) - nameFormat.displayname = prefix.getData().replace("&","§")+" "+nameFormat.displayname; + nameFormat.displayname = prefix+" "+nameFormat.displayname; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index c48b8691..ddc5ce24 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -29,6 +29,7 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal.FeatureSimonSay import kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal.FeatureTerminalSolvers; import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.FeatureNicknameColor; import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.FeatureNicknamePrefix; +import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.FeaturePlayerModel; import kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer.PartyInviteViewer; import kr.syeyoung.dungeonsguide.mod.features.impl.discord.onlinealarm.PlayingDGAlarm; import kr.syeyoung.dungeonsguide.mod.features.impl.dungeon.*; @@ -201,6 +202,7 @@ public class FeatureRegistry { public static final FeatureCollectScore ETC_COLLECT_SCORE = register(new FeatureCollectScore()); public static final FeatureNicknameColor COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); public static final FeatureNicknamePrefix COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); + public static final FeaturePlayerModel COSMETIC_PLAYER_MODEL = register(new FeaturePlayerModel()); public static final SimpleFeature DISCORD_RICHPRESENCE = register(new SimpleFeature("Discord", "Discord RPC", "Enable Discord rich presence", "advanced.discordrichpresence", true) { { addParameter("disablenotskyblock", new FeatureParameter("disablenotskyblock", "Disable When not on Skyblock", "Disable When not on skyblock", false, TCBoolean.INSTANCE)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeaturePlayerModel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeaturePlayerModel.java new file mode 100644 index 00000000..6a8458e2 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeaturePlayerModel.java @@ -0,0 +1,51 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics; + +import kr.syeyoung.dungeonsguide.mod.config.types.TCString; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.widget.WidgetNicknamePrefix; +import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.widget.WidgetPlayerModel; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; + +public class FeaturePlayerModel extends SimpleFeature { + public FeaturePlayerModel() { + super("Cosmetics", "Player Model", "Click on Edit to choose player model cosmetic", "cosmetic.model"); + addParameter("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", TCString.INSTANCE)); + } + + @Override + public Widget getConfigureWidget() { +// return new CompatLayer(new PrefixSelectorGUI("prefix", new String[] { +// "§9Party §8> §r%prefix% §a[RANK§6+§a] %name%§f: TEST", +// "§2Guild > §r%prefix% §a[RANK§6+§a] %name% §3[Vet]§f: TEST", +// "§dTo §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r", +// "§dFrom §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r", +// "§r%prefix% §b[RANK§c+§b] %name%§f: TEST", +// "§r§bCo-op > §r%prefix% §a[RANK§6+§a] %name%§f: §rTEST§r" +// }, a->a.replace("&", "§"))); + return new WidgetPlayerModel(); + } + + @Override + public boolean isDisableable() { + return false; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetButton2.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetButton2.java new file mode 100644 index 00000000..0702f5e9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetButton2.java @@ -0,0 +1,57 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.widget; + +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import net.minecraft.util.ResourceLocation; + +public class WidgetButton2 extends AnnotatedImportOnlyWidget { + @Bind(variableName = "text") + public final BindableAttribute text = new BindableAttribute<>(String.class); + @Bind(variableName = "normal") + public final BindableAttribute normal = new BindableAttribute<>(Integer.class); + @Bind(variableName = "hover") + public final BindableAttribute hover = new BindableAttribute<>(Integer.class); + @Bind(variableName = "press") + public final BindableAttribute press = new BindableAttribute<>(Integer.class); + + @Bind(variableName = "disabled") + public final BindableAttribute _ = new BindableAttribute<>(Boolean.class, false); + + @Bind(variableName = "click") + public final BindableAttribute onClick = new BindableAttribute<>(Runnable.class); + + public WidgetButton2(boolean enabled, String prefix, Runnable onClick) { + super(new ResourceLocation("dungeonsguide:gui/config/cosmetics/button3.gui")); + text.setValue(prefix); + this.onClick.setValue(onClick); + if (enabled) { + normal.setValue(0xFF1E387A); + hover.setValue(0xFF356091); + press.setValue(0xFF50799E); + } else { + normal.setValue(0xFF2E2D2C); + hover.setValue(RenderUtils.blendAlpha(0xFF2E2D2C, 0.2f)); + press.setValue(RenderUtils.blendAlpha(0xFF2E2D2C, 0.4f)); + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetNicknamePrefix.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetNicknamePrefix.java index f69c4efb..bdaf5b65 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetNicknamePrefix.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetNicknamePrefix.java @@ -73,6 +73,9 @@ public class WidgetNicknamePrefix extends AnnotatedImportOnlyWidget { update(); })); } else if (value.getCosmeticType().equals("nprefix")) { + char control = value.getData().charAt(0); + + if ((control == 'Y' || control == 'N') && !cosmeticsManager.getPerms().contains(value.getReqPerm())) continue; list2.add(new WidgetButton(cosmeticsManager.getPerms().contains(value.getReqPerm()), value.getData().substring(1), () -> { Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); currentSelectedPrefix = value; @@ -109,9 +112,12 @@ public class WidgetNicknamePrefix extends AnnotatedImportOnlyWidget { private void update() { CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); String prefix = currentSelectedPrefix == null ? "" : currentSelectedPrefix.getData().substring(1); - if (currentSelectedColor != null && currentSelectedPrefix != null && currentSelectedPrefix.getData().startsWith("F")) - prefix = currentSelectedColor.getData()+"["+prefix+"§r"+currentSelectedColor.getData()+"]"; - + if (currentSelectedColor != null && currentSelectedPrefix != null) { + char control = currentSelectedColor.getData().charAt(0); + if (!(control == 'Y' || control == 'T')) { + prefix = currentSelectedColor.getData() + "[" + prefix + "§r" + currentSelectedColor.getData() + "]"; + } + } if (!prefix.isEmpty()) prefix += " "; preview.setValue(String.join("\n",new String[] { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetPlayerModel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetPlayerModel.java new file mode 100644 index 00000000..f87aac16 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/widget/WidgetPlayerModel.java @@ -0,0 +1,130 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.widget; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; + +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; + +public class WidgetPlayerModel extends AnnotatedImportOnlyWidget { + @Bind(variableName = "models") + public final BindableAttribute models = new BindableAttribute<>(WidgetList.class); + + @Bind(variableName = "disabled") + public final BindableAttribute disabled = new BindableAttribute<>(Boolean.class, false); + + private CosmeticData previouslySelected; + private CosmeticData currentSelected; + + public WidgetPlayerModel() { + super(new ResourceLocation("dungeonsguide:gui/config/cosmetics/playerModel.gui")); + + + ArrayList list = new ArrayList<>(); + + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + for (CosmeticData value : cosmeticsManager.getCosmeticDataMap().values()) { + if (value.getCosmeticType().equals("model")) { + list.add(new WidgetButton2(cosmeticsManager.getPerms().contains(value.getReqPerm()), value.getData(), () -> { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + currentSelected = value; + update(); + })); + } + } + List activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()); + for (ActiveCosmetic activeCosmetic : activeCosmeticList) { + CosmeticData cosmeticData = cosmeticsManager.getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); + if (cosmeticData != null && cosmeticData.getCosmeticType().equals("model")) { + currentSelected = cosmeticData; + previouslySelected = cosmeticData; + } + } + update(); + + models.setValue(list); + } + + private void update() { + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + + boolean disable = currentSelected == previouslySelected + || (currentSelected != null && !cosmeticsManager.getPerms().contains(currentSelected.getReqPerm())); + disabled.setValue(disable); + } + + @On(functionName = "apply") + public void onApply() { + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + boolean disable = currentSelected == previouslySelected + || (currentSelected != null && !cosmeticsManager.getPerms().contains(currentSelected.getReqPerm())); + if (disable) return; + + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + + if (previouslySelected != null) { + List activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()); + for (ActiveCosmetic activeCosmetic : activeCosmeticList) { + if (activeCosmetic.getCosmeticData().equals(previouslySelected.getId())) { + cosmeticsManager.removeCosmetic(activeCosmetic); + } + } + } + if (currentSelected != null) + cosmeticsManager.setCosmetic(currentSelected); + + previouslySelected = currentSelected; + + update(); + } + + @On(functionName = "clear") + public void onClear() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + currentSelected = null; + update(); + } + + @On(functionName = "shop") + public void openShop() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + try { + Desktop.getDesktop().browse(new URI("https://store.dungeons.guide/")); + } catch (IOException | URISyntaxException e) { + e.printStackTrace(); + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java index 4f2fcfb0..c66c1118 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java @@ -21,8 +21,13 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import com.google.common.collect.ImmutableMap; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import lombok.Getter; +import lombok.Setter; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; @@ -45,6 +50,10 @@ import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.client.model.obj.OBJModel; import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; public class FeaturePenguins extends SimpleFeature { @@ -82,11 +91,30 @@ public class FeaturePenguins extends SimpleFeature { private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private IBakedModel model; - @DGEventHandler + @DGEventHandler(ignoreDisabled = true, triggerOutOfSkyblock = true) public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { - - if (renderPlayerEvent.entityPlayer.isInvisible()) return; + + boolean isCanceled = !isEnabled(); + + if (isCanceled && renderPlayerEvent.entityPlayer.getGameProfile() != null) { + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + List activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().get(renderPlayerEvent.entityPlayer.getGameProfile().getId()); + if (activeCosmeticList != null) { + for (ActiveCosmetic activeCosmetic : activeCosmeticList) { + CosmeticData cosmeticData = cosmeticsManager.getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); + if (cosmeticData.getCosmeticType().equals("model")) { + isCanceled = false; + break; + } + } + } + } + + if (isCanceled) return; + + + renderPlayerEvent.setCanceled(true); GlStateManager.pushMatrix(); GlStateManager.color(1,1,1,1); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java index 0389fb32..73add4a3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java @@ -83,19 +83,32 @@ public class PlayerModelRenderer extends AnnotatedExportOnlyWidget implements La String toDraw = fakePlayer.getName(); List activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayer().get( fakePlayer.getGameProfile().getId()); - CosmeticData prefix = null; - CosmeticData color = null; + String color=null, rawPrefix=null, rawPrefixColor=null; if (activeCosmetics != null) { for (ActiveCosmetic activeCosmetic : activeCosmetics) { CosmeticData cosmeticData = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); - if (cosmeticData != null) { - if (cosmeticData.getCosmeticType().equals("prefix")) prefix = cosmeticData; - if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData; + if (cosmeticData != null && cosmeticData.getCosmeticType().equals("ncolor")) { + color = cosmeticData.getData().replace("&", "§"); + } else if (cosmeticData != null && cosmeticData.getCosmeticType().equals("nprefix")) { + rawPrefix = cosmeticData.getData().replace("&", "§"); + } else if (cosmeticData != null && cosmeticData.getCosmeticType().equals("bracket_color")) { + rawPrefixColor = cosmeticData.getData().replace("&", "§"); } } } - toDraw = (color == null ? "§e" : color.getData().replace("&", "§")) + toDraw; - if (prefix != null) toDraw = prefix.getData().replace("&", "§") + " " + toDraw; + + String prefix = null; + if (rawPrefix != null) { + prefix = rawPrefix.substring(1); + char control = rawPrefix.charAt(0); + if (control != 'T' && control != 'Y') { + if (rawPrefixColor != null) + prefix = rawPrefixColor+"["+prefix+"§r"+rawPrefixColor+"]"; + } + } + + toDraw = (color == null ? "§e" : color) + toDraw; + if (prefix != null) toDraw = prefix + " " + toDraw; GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/button3.gui b/mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/button3.gui new file mode 100644 index 00000000..efa81920 --- /dev/null +++ b/mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/button3.gui @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/playerModel.gui b/mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/playerModel.gui new file mode 100644 index 00000000..56245afb --- /dev/null +++ b/mod/src/main/resources/assets/dungeonsguide/gui/config/cosmetics/playerModel.gui @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit