mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 14:38:50 +00:00
Add glowing override option
This commit is contained in:
1 parent
d6ee96ebd4
commit
f092cb9b47
4 files changed
+126
-67
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package com.moulberry.flashback.combo_options;
|
||||
|
||||
public enum GlowingOverride implements ComboOption {
|
||||
|
||||
DEFAULT("Default"),
|
||||
FORCE_GLOW("Force Glow"),
|
||||
FORCE_NO_GLOW("Force No Glow");
|
||||
|
||||
private final String text;
|
||||
|
||||
GlowingOverride(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String text() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.mojang.authlib.yggdrasil.ProfileResult;
|
||||
import com.moulberry.flashback.FilePlayerSkin;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.Utils;
|
||||
import com.moulberry.flashback.combo_options.GlowingOverride;
|
||||
import com.moulberry.flashback.editor.ui.ImGuiHelper;
|
||||
import com.moulberry.flashback.exporting.AsyncFileDialogs;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
@@ -82,89 +83,95 @@ public class SelectedEntityPopup {
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (!isHiddenDuringExport && entity instanceof Player player) {
|
||||
boolean hideNametag = editorState.hideNametags.contains(entity.getUUID());
|
||||
if (ImGui.checkbox("Render Nametag", !hideNametag)) {
|
||||
if (hideNametag) {
|
||||
editorState.hideNametags.remove(entity.getUUID());
|
||||
} else {
|
||||
editorState.hideNametags.add(entity.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
if (!hideNametag) {
|
||||
boolean changedName = ImGui.inputTextWithHint("Name##SetNameInput", player.getScoreboardName(), changeNameInput);
|
||||
|
||||
if (changedName) {
|
||||
String string = ImGuiHelper.getString(changeNameInput);
|
||||
if (string.isEmpty()) {
|
||||
editorState.nameOverride.remove(entity.getUUID());
|
||||
if (!isHiddenDuringExport) {
|
||||
if (entity instanceof Player player) {
|
||||
boolean hideNametag = editorState.hideNametags.contains(entity.getUUID());
|
||||
if (ImGui.checkbox("Render Nametag", !hideNametag)) {
|
||||
if (hideNametag) {
|
||||
editorState.hideNametags.remove(entity.getUUID());
|
||||
} else {
|
||||
editorState.nameOverride.put(entity.getUUID(), string);
|
||||
editorState.hideNametags.add(entity.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
if (editorState.hideTeamPrefix.contains(player.getUUID())) {
|
||||
if (ImGui.checkbox("Hide Team Prefix", true)) {
|
||||
editorState.hideTeamPrefix.remove(player.getUUID());
|
||||
if (!hideNametag) {
|
||||
boolean changedName = ImGui.inputTextWithHint("Name##SetNameInput", player.getScoreboardName(), changeNameInput);
|
||||
|
||||
if (changedName) {
|
||||
String string = ImGuiHelper.getString(changeNameInput);
|
||||
if (string.isEmpty()) {
|
||||
editorState.nameOverride.remove(entity.getUUID());
|
||||
} else {
|
||||
editorState.nameOverride.put(entity.getUUID(), string);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PlayerTeam team = player.getTeam();
|
||||
if (team != null && !Utils.isComponentEmpty(team.getPlayerPrefix())) {
|
||||
if (ImGui.checkbox("Hide Team Prefix", false)) {
|
||||
editorState.hideTeamPrefix.add(player.getUUID());
|
||||
|
||||
if (editorState.hideTeamPrefix.contains(player.getUUID())) {
|
||||
if (ImGui.checkbox("Hide Team Prefix", true)) {
|
||||
editorState.hideTeamPrefix.remove(player.getUUID());
|
||||
}
|
||||
} else {
|
||||
PlayerTeam team = player.getTeam();
|
||||
if (team != null && !Utils.isComponentEmpty(team.getPlayerPrefix())) {
|
||||
if (ImGui.checkbox("Hide Team Prefix", false)) {
|
||||
editorState.hideTeamPrefix.add(player.getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (editorState.hideTeamSuffix.contains(player.getUUID())) {
|
||||
if (ImGui.checkbox("Hide Team Suffix", true)) {
|
||||
editorState.hideTeamSuffix.remove(player.getUUID());
|
||||
}
|
||||
} else {
|
||||
PlayerTeam team = player.getTeam();
|
||||
if (team != null && !Utils.isComponentEmpty(team.getPlayerSuffix())) {
|
||||
if (ImGui.checkbox("Hide Team Suffix", false)) {
|
||||
editorState.hideTeamSuffix.add(player.getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (editorState.hideTeamSuffix.contains(player.getUUID())) {
|
||||
if (ImGui.checkbox("Hide Team Suffix", true)) {
|
||||
editorState.hideTeamSuffix.remove(player.getUUID());
|
||||
}
|
||||
} else {
|
||||
PlayerTeam team = player.getTeam();
|
||||
if (team != null && !Utils.isComponentEmpty(team.getPlayerSuffix())) {
|
||||
if (ImGui.checkbox("Hide Team Suffix", false)) {
|
||||
editorState.hideTeamSuffix.add(player.getUUID());
|
||||
showGlowingDropdown(entity, editorState);
|
||||
|
||||
ImGuiHelper.separatorWithText("Change Skin & Cape (UUID)");
|
||||
ImGui.setNextItemWidth(320);
|
||||
ImGui.inputTextWithHint("##SetSkinInput", "e.g. d0e05de7-6067-454d-beae-c6d19d886191", changeSkinInput);
|
||||
|
||||
if (!changeSkinInput.isEmpty()) {
|
||||
String string = ImGuiHelper.getString(changeSkinInput);
|
||||
try {
|
||||
UUID changeSkinUuid = UUID.fromString(string);
|
||||
if (ImGui.button("Apply Skin from UUID")) {
|
||||
ProfileResult profile = Minecraft.getInstance().getMinecraftSessionService().fetchProfile(changeSkinUuid, true);
|
||||
editorState.skinOverride.put(entity.getUUID(), profile.profile());
|
||||
editorState.skinOverrideFromFile.remove(entity.getUUID());
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiHelper.separatorWithText("Change Skin & Cape (UUID)");
|
||||
ImGui.setNextItemWidth(320);
|
||||
ImGui.inputTextWithHint("##SetSkinInput", "e.g. d0e05de7-6067-454d-beae-c6d19d886191", changeSkinInput);
|
||||
if (ImGui.button("Upload Skin from File")) {
|
||||
Path gameDir = FabricLoader.getInstance().getGameDir();
|
||||
CompletableFuture<String> future = AsyncFileDialogs.openFileDialog(gameDir.toString(),
|
||||
"Skin Texture", "png");
|
||||
future.thenAccept(pathStr -> {
|
||||
if (pathStr != null) {
|
||||
editorState.skinOverride.remove(entity.getUUID());
|
||||
editorState.skinOverrideFromFile.put(entity.getUUID(), new FilePlayerSkin(pathStr));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!changeSkinInput.isEmpty()) {
|
||||
String string = ImGuiHelper.getString(changeSkinInput);
|
||||
try {
|
||||
UUID changeSkinUuid = UUID.fromString(string);
|
||||
if (ImGui.button("Apply Skin from UUID")) {
|
||||
ProfileResult profile = Minecraft.getInstance().getMinecraftSessionService().fetchProfile(changeSkinUuid, true);
|
||||
editorState.skinOverride.put(entity.getUUID(), profile.profile());
|
||||
editorState.skinOverrideFromFile.remove(entity.getUUID());
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
if (ImGui.button("Upload Skin from File")) {
|
||||
Path gameDir = FabricLoader.getInstance().getGameDir();
|
||||
CompletableFuture<String> future = AsyncFileDialogs.openFileDialog(gameDir.toString(),
|
||||
"Skin Texture", "png");
|
||||
future.thenAccept(pathStr -> {
|
||||
if (pathStr != null) {
|
||||
if (editorState.skinOverride.containsKey(entity.getUUID()) || editorState.skinOverrideFromFile.containsKey(entity.getUUID())) {
|
||||
if (ImGui.button("Reset Skin")) {
|
||||
editorState.skinOverride.remove(entity.getUUID());
|
||||
editorState.skinOverrideFromFile.put(entity.getUUID(), new FilePlayerSkin(pathStr));
|
||||
editorState.skinOverrideFromFile.remove(entity.getUUID());
|
||||
changeSkinInput.set("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (editorState.skinOverride.containsKey(entity.getUUID()) || editorState.skinOverrideFromFile.containsKey(entity.getUUID())) {
|
||||
if (ImGui.button("Reset Skin")) {
|
||||
editorState.skinOverride.remove(entity.getUUID());
|
||||
editorState.skinOverrideFromFile.remove(entity.getUUID());
|
||||
changeSkinInput.set("");
|
||||
}
|
||||
} else {
|
||||
showGlowingDropdown(entity, editorState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,4 +193,19 @@ public class SelectedEntityPopup {
|
||||
// }
|
||||
}
|
||||
|
||||
private static void showGlowingDropdown(Entity entity, EditorState editorState) {
|
||||
GlowingOverride glowingOverride = GlowingOverride.DEFAULT;
|
||||
if (editorState.glowingOverride.containsKey(entity.getUUID())) {
|
||||
glowingOverride = editorState.glowingOverride.get(entity.getUUID());
|
||||
}
|
||||
GlowingOverride newGlowingOverride = ImGuiHelper.enumCombo("Glowing", glowingOverride);
|
||||
if (newGlowingOverride != glowingOverride) {
|
||||
if (newGlowingOverride == GlowingOverride.DEFAULT) {
|
||||
editorState.glowingOverride.remove(entity.getUUID());
|
||||
} else {
|
||||
editorState.glowingOverride.put(entity.getUUID(), newGlowingOverride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.FreezeSlowdownFormula;
|
||||
import com.moulberry.flashback.combo_options.GlowingOverride;
|
||||
import com.moulberry.flashback.configuration.FlashbackConfig;
|
||||
import com.moulberry.flashback.editor.ui.windows.ExportDoneWindow;
|
||||
import com.moulberry.flashback.editor.ui.windows.WindowType;
|
||||
@@ -172,6 +173,20 @@ public abstract class MixinMinecraft implements MinecraftExt {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "shouldEntityAppearGlowing", at = @At("HEAD"), cancellable = true)
|
||||
private void shouldEntityAppearGlowing(Entity entity, CallbackInfoReturnable<Boolean> cir) {
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
if (editorState != null) {
|
||||
GlowingOverride glowingOverride = editorState.glowingOverride.get(entity.getUUID());
|
||||
|
||||
if (glowingOverride == GlowingOverride.FORCE_GLOW) {
|
||||
cir.setReturnValue(true);
|
||||
} else if (glowingOverride == GlowingOverride.FORCE_NO_GLOW) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WrapOperation(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/sounds/SoundManager;updateSource(Lnet/minecraft/client/Camera;)V"))
|
||||
public void runTick_updateSource(SoundManager instance, Camera camera, Operation<Void> original) {
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.moulberry.flashback.FilePlayerSkin;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.FlashbackGson;
|
||||
import com.moulberry.flashback.combo_options.GlowingOverride;
|
||||
import com.moulberry.flashback.editor.ui.ReplayUI;
|
||||
import com.moulberry.flashback.keyframe.Keyframe;
|
||||
import com.moulberry.flashback.keyframe.KeyframeType;
|
||||
@@ -51,6 +52,7 @@ public class EditorState {
|
||||
public Map<UUID, GameProfile> skinOverride = new HashMap<>();
|
||||
public Map<UUID, FilePlayerSkin> skinOverrideFromFile = new HashMap<>();
|
||||
public Map<UUID, String> nameOverride = new HashMap<>();
|
||||
public Map<UUID, GlowingOverride> glowingOverride = new HashMap<>();
|
||||
public Set<UUID> hideTeamPrefix = new HashSet<>();
|
||||
public Set<UUID> hideTeamSuffix = new HashSet<>();
|
||||
public Set<String> filteredEntities = new HashSet<>();
|
||||
|
||||
Reference in new issue
Block a user