Skip to content

Commit

Permalink
Feat: WarPartyScreen
Browse files Browse the repository at this point in the history
I swear to god I've worked on this thing for like 10 hours now, why does wynntils have the most complicated ass code like bro you're not trying to go to mars it's okay to not make everything so complicated it could kill a Victorian era child just by looking at it please I just want this feature to be over and done with, why is it so hard to make it look good and actually function like I am not a front end developer what the fuck am I supposed to do with all of this like please I just want to see my family but I am being forced to work in the coal mines
  • Loading branch information
Iriyadesu committed Feb 10, 2025
1 parent 6830233 commit a5657c7
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 50 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright © sequoia-mod 2025.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package dev.lotnest.sequoia.commands;

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import dev.lotnest.sequoia.core.consumers.command.Command;
import dev.lotnest.sequoia.mc.screens.WarPartyScreen;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component;

public class PartyCommand extends Command {
@Override
public String getCommandName() {
return "warparties";
}

@Override
public List<String> getAliases() {
return List.of("wp");
}

@Override
public LiteralArgumentBuilder<CommandSourceStack> getCommandBuilder(
LiteralArgumentBuilder<CommandSourceStack> base) {
return base.executes(this::tryOpenWarPartyGUI);
}

private int tryOpenWarPartyGUI(CommandContext<CommandSourceStack> context) {
try {
System.out.println("[WarParties] Attempting to open WarPartyScreen...");

Executors.newSingleThreadScheduledExecutor()
.schedule(
() -> Minecraft.getInstance().execute(() -> {
System.out.println("[WarParties] Opening WarPartyScreen now!");
Minecraft.getInstance().setScreen(new WarPartyScreen());
}),
1,
TimeUnit.MILLISECONDS);

} catch (Exception exception) {
System.err.println("[WarParties] Failed to open WarPartyScreen!");
exception.printStackTrace();
context.getSource().sendFailure(Component.literal("Error opening WarPartyScreen!"));
}

return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import dev.lotnest.sequoia.commands.DiscordCommand;
import dev.lotnest.sequoia.commands.LastSeenCommand;
import dev.lotnest.sequoia.commands.MeowCommand;
import dev.lotnest.sequoia.commands.MessageCommand;
import dev.lotnest.sequoia.commands.OnlineMembersCommand;
import dev.lotnest.sequoia.commands.OuterVoidCommand;
import dev.lotnest.sequoia.commands.PartyCommand;
import dev.lotnest.sequoia.commands.PlayerDungeonsCommand;
import dev.lotnest.sequoia.commands.PlayerGuildCommand;
import dev.lotnest.sequoia.commands.PlayerRaidsCommand;
Expand Down Expand Up @@ -196,7 +196,7 @@ private void registerAllCommands() {
registerCommand(new SearchCommand());
registerCommand(new TerritoryMenuCommand());
registerCommand(new AuthCommand());
registerCommand(new MessageCommand());
registerCommand(new PartyCommand());

registerCommandWithCommandSet(new SequoiaCommand());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright © sequoia-mod 2025.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package dev.lotnest.sequoia.mc.screens;

import dev.lotnest.sequoia.features.war.GuildWarParty;
import dev.lotnest.sequoia.models.war.WarPartyModel;
import io.wispforest.owo.ui.base.BaseOwoScreen;
import io.wispforest.owo.ui.component.Components;
import io.wispforest.owo.ui.container.Containers;
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.core.HorizontalAlignment;
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.OwoUIAdapter;
import io.wispforest.owo.ui.core.Surface;
import io.wispforest.owo.ui.core.VerticalAlignment;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;

public class WarPartyScreen extends BaseOwoScreen<FlowLayout> {
private final Map<Integer, GuildWarParty> warParties;

public WarPartyScreen() {
super(Component.literal("War Parties"));
this.warParties = generateMockData(); // Replace this with real data later
}

@Override
protected OwoUIAdapter<FlowLayout> createAdapter() {
return OwoUIAdapter.create(this, Containers::verticalFlow);
}

@Override
protected void build(FlowLayout rootComponent) {
rootComponent
.surface(Surface.DARK_PANEL)
.horizontalAlignment(HorizontalAlignment.CENTER)
.verticalAlignment(VerticalAlignment.CENTER)
.padding(Insets.of(5));

for (GuildWarParty party : warParties.values()) {
ItemStack paper = new ItemStack(Items.PAPER);
paper.set(DataComponents.CUSTOM_NAME, Component.literal("Leader: " + party.partyLeader()));

String tooltipText = "Leader: " + party.partyLeader() + "\nTerritory: " + party.territory() + "\nMembers: "
+ party.members().toString();

rootComponent.child(Components.item(paper).tooltip(Component.literal(tooltipText)));
}
}

private static Map<Integer, GuildWarParty> generateMockData() {
Map<Integer, GuildWarParty> parties = new HashMap<>();
parties.put(1, new GuildWarParty(123, "Steve", "Desert Outpost", Map.of("Alex", WarPartyModel.Role.DPS)));
parties.put(2, new GuildWarParty(456, "Alex", "Jungle Base", Map.of("Steve", WarPartyModel.Role.HEALER)));
parties.put(
3,
new GuildWarParty(
666,
"MaidKeeper",
"Your Mom",
Map.of("MaidKeeper", WarPartyModel.Role.SOLO, "The maid being kept", WarPartyModel.Role.SOLO)));
return parties;
}
}

0 comments on commit a5657c7

Please sign in to comment.