Skip to content

Commit

Permalink
Merge pull request #48 from FTBTeam/1.20.1/dev
Browse files Browse the repository at this point in the history
1.20.1/dev
  • Loading branch information
desht authored Apr 16, 2024
2 parents 124be6a + fe05022 commit ff3bc24
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2001.3.0]

### Changed
* Significant GUI overhaul and cleanup in several places (backported improvements from 1.20.4)
* FTB Library 2001.2.0 is a requirement

## [2001.2.0]

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public String toString(Color4I value) {

@Override
public void config(ConfigGroup config, TeamPropertyValue<Color4I> value) {
config.addString(id.getPath(), value.value.toString(), s -> value.consumer.accept(Color4I.fromString(s)), getDefaultValue().toString());
config.addColor(id.getPath(), value.value, value.consumer, getDefaultValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,52 +65,51 @@ public void onClicked(MouseButton button) {
if (selfRank.isAtLeast(TeamRank.OWNER)) {
if (selfTeam.getMembers().size() == 1) {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.disband"), Icons.CLOSE,
() -> Operation.LEAVE.sendMessage(player))
b -> Operation.LEAVE.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.disband.confirm")));
}
} else {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.leave"), Icons.CLOSE,
() -> Operation.LEAVE.sendMessage(player))
b -> Operation.LEAVE.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.leave.confirm")));
}
} else {
if (selfRank.isAtLeast(TeamRank.OWNER)) {
if (playerRank == TeamRank.MEMBER) {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.promote", player.name()), Icons.SHIELD,
() -> Operation.PROMOTE.sendMessage(player))
b -> Operation.PROMOTE.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.promote.confirm", player.name())));
} else if (playerRank == TeamRank.OFFICER) {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.demote", player.name()), Icons.ACCEPT_GRAY,
() -> Operation.DEMOTE.sendMessage(player))
b -> Operation.DEMOTE.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.demote.confirm", player.name())));
}
if (playerRank.isMemberOrBetter()) {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.transfer_ownership", player.name()), Icons.DIAMOND,
() -> Operation.TRANSFER_OWNER.sendMessage(player))
b -> Operation.TRANSFER_OWNER.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.transfer_ownership.confirm", player.name())));
}
}
}
if (selfRank.getPower() > playerRank.getPower()) {
if (playerRank.isMemberOrBetter()) {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.kick", player.name()), Icons.CLOSE,
() -> Operation.KICK.sendMessage(player))
b -> Operation.KICK.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.kick.confirm", player.name())));
} else if (selfRank.isOfficerOrBetter() && playerRank.isAllyOrBetter()) {
items0.add(new ContextMenuItem(Component.translatable("ftbteams.gui.remove_ally", player.name()), Icons.CANCEL,
() -> Operation.REMOVE_ALLY.sendMessage(player))
b -> Operation.REMOVE_ALLY.sendMessage(player))
.setYesNoText(Component.translatable("ftbteams.gui.remove_ally.confirm", player.name())));
}
}

if (!items0.isEmpty()) {
List<ContextMenuItem> items = new ArrayList<>(List.of(
new ContextMenuItem(playerRank.getDisplayName(), FaceIcon.getFace(new GameProfile(player.id(), null)), () -> {}).setCloseMenu(false),
new ContextMenuItem(playerRank.getDisplayName(), FaceIcon.getFace(new GameProfile(player.id(), null)), null).setCloseMenu(false),
ContextMenuItem.SEPARATOR
));
items.addAll(items0);
getGui().openContextMenu(items);
// openContextMenu(new ContextMenu(parent, items));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.ftb.mods.ftbteams.client.gui;

import dev.ftb.mods.ftblibrary.config.ColorConfig;
import dev.ftb.mods.ftblibrary.config.ConfigGroup;
import dev.ftb.mods.ftblibrary.config.ui.EditConfigScreen;
import dev.ftb.mods.ftblibrary.icon.Color4I;
Expand Down Expand Up @@ -76,6 +77,11 @@ public boolean onInit() {
return true;
}

@Override
public Theme getTheme() {
return NordTheme.THEME;
}

@Override
public void addWidgets() {

Expand Down Expand Up @@ -106,12 +112,18 @@ public void playClickSound() {
}

add(colorButton = new SimpleButton(this, Component.translatable("gui.color"), properties.get(TeamProperties.COLOR).withBorder(POLAR_NIGHT_0, false), (simpleButton, mouseButton) -> {
Color4I c = FTBTUtils.randomColor();
properties.set(TeamProperties.COLOR, c);
simpleButton.setIcon(c.withBorder(POLAR_NIGHT_0, false));
TeamPropertyCollection properties = new TeamPropertyCollectionImpl();
properties.set(TeamProperties.COLOR, c);
new UpdatePropertiesRequestMessage(properties).sendToServer();
ColorConfig config = new ColorConfig();
config.setValue(properties.get(TeamProperties.COLOR));
ColorSelectorPanel.popupAtMouse(getGui(), config, accepted -> {
if (accepted) {
Color4I c = config.getValue();
properties.set(TeamProperties.COLOR, c);
simpleButton.setIcon(c.withBorder(POLAR_NIGHT_0, false));
TeamPropertyCollection properties = new TeamPropertyCollectionImpl();
properties.set(TeamProperties.COLOR, c);
new UpdatePropertiesRequestMessage(properties).sendToServer();
}
});
}) {
@Override
public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h) {
Expand Down Expand Up @@ -157,10 +169,9 @@ private void addTeamInfo(TooltipList list) {

@Override
public void drawBackground(GuiGraphics graphics, Theme theme, int x, int y, int w, int h) {
GuiHelper.drawHollowRect(graphics, x, y, w, h, POLAR_NIGHT_0, true);
POLAR_NIGHT_1.draw(graphics, x + 1, y + 1, w - 2, h - 2);
POLAR_NIGHT_0.draw(graphics, x + 1, y + 21, w - 2, 1);
POLAR_NIGHT_0.draw(graphics, x + memberPanel.width + 1, y + memberPanel.posY, 1, memberPanel.height);
super.drawBackground(graphics, theme, x, y, w, h);
POLAR_NIGHT_0.draw(graphics, x, y + 21, w, 1);
POLAR_NIGHT_0.draw(graphics, x + memberPanel.width + 1, y + memberPanel.posY, 1, memberPanel.height + 1);
}

@Override
Expand Down
3 changes: 0 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,5 @@
"minecraft": "~1.20",
"architectury": ">=${archversion}",
"ftblibrary": ">=${ftblibraryversion}"
},
"breaks": {
"ftblibrary": ">=2001.2.0"
}
}
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ side = "BOTH"
[[dependencies.ftbteams]]
modId = "ftblibrary"
mandatory = true
versionRange = "[${ftblibraryversion},2001.2.0)"
versionRange = "[${ftblibraryversion},)"
ordering = "AFTER"
side = "BOTH"
15 changes: 10 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_id=ftbteams
archives_base_name=ftb-teams
minecraft_version=1.20.1

mod_version=2001.3.0
maven_group=dev.ftb.mods
mod_version=2001.2.0
mod_author=FTB Team
minecraft_version=1.20.1
architectury_version=9.0.8

architectury_version=9.1.12
fabric_loader_version=0.14.21
fabric_api_version=0.83.1+1.20.1
ftb_library_version=2001.1.2
forge_version=47.0.1
forge_version=47.1.47

ftb_library_version=2001.2.0

curseforge_id_forge=404468
curseforge_id_fabric=438497

0 comments on commit ff3bc24

Please sign in to comment.