Skip to content

Commit

Permalink
Release v2.8+fabric
Browse files Browse the repository at this point in the history
- Resolved #52
- tt_ru.json translation #53
- Dependencies are now embedded in `betterstats` instead of `tcdcommons`
- `tcdcommons` rewrote its GUI event handling system
  • Loading branch information
TheCSDev committed May 31, 2023
1 parent 87ea538 commit c89e5c9
Show file tree
Hide file tree
Showing 43 changed files with 212 additions and 96 deletions.
6 changes: 4 additions & 2 deletions betterstats-2-fabric-1.18.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ org.gradle.jvmargs=-Xmx1G
mod_name = Better Statistics Screen
mod_description = Improves the statistics screen and makes it more useful.
mod_author = TheCSDev
mod_version = 2.7.2+1.18.2
mod_version = 2.8+1.18.2

mod_contact_homepage = https://github.com/TheCSDev
mod_contact_sources = https://github.com/TheCSDev/mc-better-stats
Expand All @@ -37,7 +37,9 @@ org.gradle.jvmargs=-Xmx1G
mod_depends_minecraft = 1.18.x
mod_depends_java = >=17

mod_jar_tcdcommons = META-INF/jarjar/tcdcommons-2.7+1.18.2.jar
mod_jar_fabricapi = META-INF/jarjar/fabric-api-0.76.0+1.18.2.jar
mod_jar_architectury = META-INF/jarjar/architectury-4.11.90-fabric.jar
mod_jar_tcdcommons = META-INF/jarjar/tcdcommons-2.8+1.18.2.jar

# Dependencies
# If you choose to use any of the following mods as dependencies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import java.awt.Color;
import java.util.Objects;
import java.util.function.Consumer;

import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -33,9 +32,6 @@ public class BSPanel_Statistics extends BSPanel
protected BSStatPanel panel_stats;
protected BSScrollBarWidget scroll_left;
protected BSNetworkSearchPanel panel_networkSearch;
// --------------------------------------------------
//prevent the garbage collector from collecting these event handlers
protected Consumer<Integer> __handler0;
// ==================================================
public BSPanel_Statistics(BetterStatsScreen bss)
{
Expand Down Expand Up @@ -160,8 +156,7 @@ public void init_stats()
{
var scroll = sPanel.getVerticalScrollBar();
scroll.setValue(betterStats.filter_statsScroll);
__handler0 = sPanel.getEvents().SCROLL_V
.addWeakEventHandler(dY -> betterStats.filter_statsScroll = scroll.getValue());
sPanel.eScrollVertically.register((element, dY) -> betterStats.filter_statsScroll = scroll.getValue());
}
//assign stat current panel
this.panel_stats = sPanel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.util.function.Consumer;

import org.jetbrains.annotations.Nullable;

import io.github.thecsdev.betterstats.client.gui.screen.BetterStatsScreen;
Expand All @@ -24,10 +22,6 @@
public class BSPanel_StatisticsFilters extends BSPanel
{
// ==================================================
//prevent the garbage collector from collecting these event handlers
protected Runnable __handler0;
protected Consumer<String> __handler1;
// --------------------------------------------------
public @Nullable TSelectEnumWidget<CurrentTab> btn_tab;
public @Nullable TSelectEnumWidget<GroupStatsBy> btn_groupBy;
public @Nullable TSelectWidget btn_sortBy;
Expand Down Expand Up @@ -69,7 +63,7 @@ public void init(final BetterStatsScreen bss)
//search bar
var txt_search = new TTextFieldWidget(nextX(), nextY(), nextW(), 20);
txt_search.setText(bss.filter_searchTerm, false);
__handler1 = txt_search.getEvents().TEXT_CHANGED.addWeakEventHandler(txt ->
txt_search.eTextChanged.register((element, txt) ->
{
bss.filter_searchTerm = txt;
bss.getStatPanel().init_stats();
Expand All @@ -79,7 +73,7 @@ public void init(final BetterStatsScreen bss)
//show empty stats
var check_emptyStats = new TCheckboxWidget(nextX(), nextY(), nextW(), 20,
translatable("betterstats.gui.show_empty_stats"), filter_showEmpty);
__handler0 = check_emptyStats.getEvents().CLICKED.addWeakEventHandler(() ->
check_emptyStats.eClicked.register(element ->
{
filter_showEmpty = check_emptyStats.getChecked();
bss.getStatPanel().init_stats();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public BetterStatsConfigScreen(Screen parent)
//create and add the main panel
panel_contentPane = new TFillColorElement(0, 0, getTpeWidth(), getTpeHeight());
panel_contentPane.setColor(-1771805596);
panel_contentPane.setZOffset(1);
panel_contentPane.setZOffset(125);
//panel_contentPane.setScrollPadding(0);
//panel_contentPane.setScrollFlags(0);
addTChild(panel_contentPane, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import java.util.Objects;

import org.apache.logging.log4j.util.TriConsumer;

import io.github.thecsdev.tcdcommons.api.client.gui.TElement;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TEntityRendererElement;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement;
Expand All @@ -32,16 +30,15 @@ public abstract class BSHudStatWidget extends TElement
protected double anchorX, anchorY;
// --------------------------------------------------
protected final StatHandler statHandler;
protected final TriConsumer<TElement, Boolean, Boolean> ehChildAr_reposition;
// ==================================================
public BSHudStatWidget(int x, int y, StatHandler statHandler)
{
super(x, y, SIZE, SIZE);
this.statHandler = Objects.requireNonNull(statHandler, "statHandler must not be null.");
ehChildAr_reposition = getEvents().CHILD_AR.addWeakEventHandler((child, added, repositioned) ->
this.eChildAdded.register((element, child, repositioned) ->
{
//only when added
if(!added) return;
//if(!added) return;
//get last child
var lastChild = child.previous();
//reposition this new child based on the last child
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The jar files features in this directory are embedded dependencies.
Below is the list of those embedded dependencies and their licenses.
You may find more info on each of those jar files by opening them as .zip files.

| # | Mod name | Owner | License |
|-----|--------------|-----------|-------------------|
| 1 | tcdcommons | TheCSDev | MIT |
| 2 | architectury | Shedaniel | GNU LGPL v3 |
| 3 | fabric-api | modmuss50 | Apache License v2 |

Last updated: 2023/5/29
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"betterstats": "Better Statistics экраны",

"betterstats.hud": "Статистиканың HUD",
"betterstats.hud.entity.kills": "Үтерүләр саны",
"betterstats.hud.entity.deaths": "Үлемнәр саны",
"betterstats.hud.hint.add_widget": "Статистика монда өстәү өчен аңа уң төймәне ([Shift] + уң төймә) басыгыз.",
"betterstats.hud.hint.del_widget": "Китерелгән элементны бетерү өчен Backspace (<-) басыгыз.",
"betterstats.hud.hint.esc_close": "Бу экранны ябу өчен Escape (ESC) басыгыз.",

"betterstats.hud.accuracy_mode_warning.title": "«betterstats» аралашуын сервер белән кушыгыз",
"betterstats.hud.accuracy_mode_warning.message": "МӨҺИМ:\nБу көйләүне кабызып, сервер Сезнең «betterstats» утыртуыгызны ачыклаячак. Сезнең хосусыйлыгыгызны саклау өчен, шушы модны рөхсәт итмәс серверларда бу көйләүне кулланмагыз.\n\nБу көйләүне кушу HUD статистикасын төгәлрәк һәм реаль вакытта итә, «betterstats» сервер белән аралашуны рөхсәт итә. Игътибар итегез, бу функцияне эшләү өчен «betterstats» шулай ук серверга да утыртылырга тиеш.",
"betterstats.hud.accuracy_mode_warning.tooltip": "HUD-дагы төгәлрәк һәм реаль вакытта статистиканы куша.",

"betterstats.gui.filters": "Фильтрлар",
"betterstats.gui.filters.group_by.default": "Беренчел",
"betterstats.gui.filters.group_by.mod": "Мод буенча",
"betterstats.gui.filters.group_by.none": "Барлык",


"betterstats.gui.show_empty_stats": "Буш статистиканы күрсәтү",
"betterstats.gui.no_stats_yet": "Күрсәтү өчен статистика юк әле...",

"betterstats.gui.ctx_menu.pin_to_hud": "HUD",
"betterstats.gui.ctx_menu.close": "Ябу",

"betterstats.gui.menu_bar.view": "Карау",
"betterstats.gui.menu_bar.view.vanilla_stats": "Ванила статистикасын күрсәтү",
"betterstats.gui.menu_bar.about": "Мод турында",
"betterstats.gui.menu_bar.about.source": "Чыганак",
"betterstats.gui.menu_bar.mods_other": "Башка (модлар)",

"betterstats.gui.network.btn_radio.tooltip": "«betterstats» сервер тоташуын күчерү",
"betterstats.gui.network.btn_radio.warning": "МӨҺИМ:\nБу көйләүне кабызып, сервер Сезнең «betterstats» утыртылган белән үзгәртелгән клиентны куллануыгызны ачыклаячак. Сезнең хосусыйлыгыгызны саклау өчен, үзгәртелгән клиентларны яки шушы модны рөхсәт итмәс серверларда бу көйләүне кулланмагыз.\n\nБу көйләүне кушу модны серверга шулай ук утыртылган кулланышлы кайбер артык функцияләрне өсти.",
"betterstats.gui.network.btn_pstat.tooltip": "Башка уенчының статистикасын карау",
"betterstats.gui.network.stats_request.timed_out": "Таләп вакыты бетте...",
"betterstats.gui.network.stats_request.player_404": "Таләп ителгән уенчы табылмады...",

"betterstats.gui.config.debug_mode": "Төзәтү шарты"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
},
"mixins": ["betterstats.client.mixin.json"],

"jars": [ { "file":"${project.mod_jar_tcdcommons}" } ],
"jars": [ { "file":"${project.mod_jar_fabricapi}" }, { "file":"${project.mod_jar_architectury}" }, { "file":"${project.mod_jar_tcdcommons}" } ],
"depends":
{
"fabricloader": ">=${project.loader_version}",
"minecraft": "${project.mod_depends_minecraft}",
"java": "${project.mod_depends_java}"
},
"recommends": { "tcdcommons": "2.x", "modmenu": "*" },
"recommends": { "fabric-api": "*", "architectury": "*", "tcdcommons": "2.x" },

"custom":
{
Expand Down
6 changes: 4 additions & 2 deletions betterstats-2-fabric-1.19.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ org.gradle.jvmargs=-Xmx1G
mod_name = Better Statistics Screen
mod_description = Improves the statistics screen and makes it more useful.
mod_author = TheCSDev
mod_version = 2.7.2+1.19.2
mod_version = 2.8+1.19.2

mod_contact_homepage = https://github.com/TheCSDev
mod_contact_sources = https://github.com/TheCSDev/mc-better-stats
Expand All @@ -37,7 +37,9 @@ org.gradle.jvmargs=-Xmx1G
mod_depends_minecraft = >=1.19.2
mod_depends_java = >=17

mod_jar_tcdcommons = META-INF/jarjar/tcdcommons-2.7+1.19.2.jar
mod_jar_fabricapi = META-INF/jarjar/fabric-api-0.76.0+1.18.2.jar
mod_jar_architectury = META-INF/jarjar/architectury-4.11.90-fabric.jar
mod_jar_tcdcommons = META-INF/jarjar/tcdcommons-2.8+1.19.2.jar

# Dependencies
# If you choose to use any of the following mods as dependencies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import java.awt.Color;
import java.util.Objects;
import java.util.function.Consumer;

import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -33,9 +32,6 @@ public class BSPanel_Statistics extends BSPanel
protected BSStatPanel panel_stats;
protected BSScrollBarWidget scroll_left;
protected BSNetworkSearchPanel panel_networkSearch;
// --------------------------------------------------
//prevent the garbage collector from collecting these event handlers
protected Consumer<Integer> __handler0;
// ==================================================
public BSPanel_Statistics(BetterStatsScreen bss)
{
Expand Down Expand Up @@ -160,8 +156,7 @@ public void init_stats()
{
var scroll = sPanel.getVerticalScrollBar();
scroll.setValue(betterStats.filter_statsScroll);
__handler0 = sPanel.getEvents().SCROLL_V
.addWeakEventHandler(dY -> betterStats.filter_statsScroll = scroll.getValue());
sPanel.eScrollVertically.register((element, dY) -> betterStats.filter_statsScroll = scroll.getValue());
}
//assign stat current panel
this.panel_stats = sPanel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.util.function.Consumer;

import org.jetbrains.annotations.Nullable;

import io.github.thecsdev.betterstats.client.gui.screen.BetterStatsScreen;
Expand All @@ -24,10 +22,6 @@
public class BSPanel_StatisticsFilters extends BSPanel
{
// ==================================================
//prevent the garbage collector from collecting these event handlers
protected Runnable __handler0;
protected Consumer<String> __handler1;
// --------------------------------------------------
public @Nullable TSelectEnumWidget<CurrentTab> btn_tab;
public @Nullable TSelectEnumWidget<GroupStatsBy> btn_groupBy;
public @Nullable TSelectWidget btn_sortBy;
Expand Down Expand Up @@ -69,7 +63,7 @@ public void init(final BetterStatsScreen bss)
//search bar
var txt_search = new TTextFieldWidget(nextX(), nextY(), nextW(), 20);
txt_search.setText(bss.filter_searchTerm, false);
__handler1 = txt_search.getEvents().TEXT_CHANGED.addWeakEventHandler(txt ->
txt_search.eTextChanged.register((element, txt) ->
{
bss.filter_searchTerm = txt;
bss.getStatPanel().init_stats();
Expand All @@ -79,7 +73,7 @@ public void init(final BetterStatsScreen bss)
//show empty stats
var check_emptyStats = new TCheckboxWidget(nextX(), nextY(), nextW(), 20,
translatable("betterstats.gui.show_empty_stats"), filter_showEmpty);
__handler0 = check_emptyStats.getEvents().CLICKED.addWeakEventHandler(() ->
check_emptyStats.eClicked.register(element ->
{
filter_showEmpty = check_emptyStats.getChecked();
bss.getStatPanel().init_stats();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public BetterStatsConfigScreen(Screen parent)
//create and add the main panel
panel_contentPane = new TFillColorElement(0, 0, getTpeWidth(), getTpeHeight());
panel_contentPane.setColor(-1771805596);
panel_contentPane.setZOffset(1);
panel_contentPane.setZOffset(125);
//panel_contentPane.setScrollPadding(0);
//panel_contentPane.setScrollFlags(0);
addTChild(panel_contentPane, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import java.util.Objects;

import org.apache.logging.log4j.util.TriConsumer;

import io.github.thecsdev.tcdcommons.api.client.gui.TElement;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TEntityRendererElement;
import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement;
Expand All @@ -32,16 +30,15 @@ public abstract class BSHudStatWidget extends TElement
protected double anchorX, anchorY;
// --------------------------------------------------
protected final StatHandler statHandler;
protected final TriConsumer<TElement, Boolean, Boolean> ehChildAr_reposition;
// ==================================================
public BSHudStatWidget(int x, int y, StatHandler statHandler)
{
super(x, y, SIZE, SIZE);
this.statHandler = Objects.requireNonNull(statHandler, "statHandler must not be null.");
ehChildAr_reposition = getEvents().CHILD_AR.addWeakEventHandler((child, added, repositioned) ->
this.eChildAdded.register((element, child, repositioned) ->
{
//only when added
if(!added) return;
//if(!added) return;
//get last child
var lastChild = child.previous();
//reposition this new child based on the last child
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The jar files features in this directory are embedded dependencies.
Below is the list of those embedded dependencies and their licenses.
You may find more info on each of those jar files by opening them as .zip files.

| # | Mod name | Owner | License |
|-----|--------------|-----------|-------------------|
| 1 | tcdcommons | TheCSDev | MIT |
| 2 | architectury | Shedaniel | GNU LGPL v3 |
| 3 | fabric-api | modmuss50 | Apache License v2 |

Last updated: 2023/5/29
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"betterstats": "Better Statistics экраны",

"betterstats.hud": "Статистиканың HUD",
"betterstats.hud.entity.kills": "Үтерүләр саны",
"betterstats.hud.entity.deaths": "Үлемнәр саны",
"betterstats.hud.hint.add_widget": "Статистика монда өстәү өчен аңа уң төймәне ([Shift] + уң төймә) басыгыз.",
"betterstats.hud.hint.del_widget": "Китерелгән элементны бетерү өчен Backspace (<-) басыгыз.",
"betterstats.hud.hint.esc_close": "Бу экранны ябу өчен Escape (ESC) басыгыз.",

"betterstats.hud.accuracy_mode_warning.title": "«betterstats» аралашуын сервер белән кушыгыз",
"betterstats.hud.accuracy_mode_warning.message": "МӨҺИМ:\nБу көйләүне кабызып, сервер Сезнең «betterstats» утыртуыгызны ачыклаячак. Сезнең хосусыйлыгыгызны саклау өчен, шушы модны рөхсәт итмәс серверларда бу көйләүне кулланмагыз.\n\nБу көйләүне кушу HUD статистикасын төгәлрәк һәм реаль вакытта итә, «betterstats» сервер белән аралашуны рөхсәт итә. Игътибар итегез, бу функцияне эшләү өчен «betterstats» шулай ук серверга да утыртылырга тиеш.",
"betterstats.hud.accuracy_mode_warning.tooltip": "HUD-дагы төгәлрәк һәм реаль вакытта статистиканы куша.",

"betterstats.gui.filters": "Фильтрлар",
"betterstats.gui.filters.group_by.default": "Беренчел",
"betterstats.gui.filters.group_by.mod": "Мод буенча",
"betterstats.gui.filters.group_by.none": "Барлык",


"betterstats.gui.show_empty_stats": "Буш статистиканы күрсәтү",
"betterstats.gui.no_stats_yet": "Күрсәтү өчен статистика юк әле...",

"betterstats.gui.ctx_menu.pin_to_hud": "HUD",
"betterstats.gui.ctx_menu.close": "Ябу",

"betterstats.gui.menu_bar.view": "Карау",
"betterstats.gui.menu_bar.view.vanilla_stats": "Ванила статистикасын күрсәтү",
"betterstats.gui.menu_bar.about": "Мод турында",
"betterstats.gui.menu_bar.about.source": "Чыганак",
"betterstats.gui.menu_bar.mods_other": "Башка (модлар)",

"betterstats.gui.network.btn_radio.tooltip": "«betterstats» сервер тоташуын күчерү",
"betterstats.gui.network.btn_radio.warning": "МӨҺИМ:\nБу көйләүне кабызып, сервер Сезнең «betterstats» утыртылган белән үзгәртелгән клиентны куллануыгызны ачыклаячак. Сезнең хосусыйлыгыгызны саклау өчен, үзгәртелгән клиентларны яки шушы модны рөхсәт итмәс серверларда бу көйләүне кулланмагыз.\n\nБу көйләүне кушу модны серверга шулай ук утыртылган кулланышлы кайбер артык функцияләрне өсти.",
"betterstats.gui.network.btn_pstat.tooltip": "Башка уенчының статистикасын карау",
"betterstats.gui.network.stats_request.timed_out": "Таләп вакыты бетте...",
"betterstats.gui.network.stats_request.player_404": "Таләп ителгән уенчы табылмады...",

"betterstats.gui.config.debug_mode": "Төзәтү шарты"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
},
"mixins": ["betterstats.client.mixin.json"],

"jars": [ { "file":"${project.mod_jar_tcdcommons}" } ],
"jars": [ { "file":"${project.mod_jar_fabricapi}" }, { "file":"${project.mod_jar_architectury}" }, { "file":"${project.mod_jar_tcdcommons}" } ],
"depends":
{
"fabricloader": ">=${project.loader_version}",
"minecraft": "${project.mod_depends_minecraft}",
"java": "${project.mod_depends_java}"
},
"recommends": { "tcdcommons": "2.x", "modmenu": "*" },
"recommends": { "fabric-api": "*", "architectury": "*", "tcdcommons": "2.x" },

"custom":
{
Expand Down
Loading

0 comments on commit c89e5c9

Please sign in to comment.