Skip to content

Commit a40852a

Browse files
committed
refactor: Clean up codebase and remove Guava dependency
- Remove unused Guava dependency from build configuration - Simplify Javadoc comments to be more concise throughout - Remove verbose inline comments that don't add value - Preserve TODO comments for future implementation tasks
1 parent 4d3abfc commit a40852a

15 files changed

Lines changed: 33 additions & 356 deletions

build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ dependencies {
3737
modImplementation(libs.gson)
3838
include(libs.gson)
3939

40-
// Guava for caching
41-
modImplementation(libs.guava)
42-
include(libs.guava)
43-
4440
// Testing
4541
testImplementation(libs.junitApi)
4642
testRuntimeOnly(libs.junitEngine)

gradle/libs.versions.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ meteor = "1.21.10-SNAPSHOT"
1616
junit = "5.10.2"
1717
gson = "2.11.0"
1818
okhttp = "4.12.0"
19-
guava = "33.5.0-jre"
2019

2120
[libraries]
2221
# Fabric base
@@ -30,7 +29,6 @@ meteor-client = { module = "meteordevelopment:meteor-client", version.ref = "met
3029
# Dependencies for addon functionality
3130
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
3231
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
33-
guava = { module = "com.google.guava:guava", version.ref = "guava" }
3432

3533
# Testing
3634
junitApi = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }

src/main/java/com/cope/meteoraddons/MeteorAddonsAddon.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@
1111
import org.slf4j.LoggerFactory;
1212

1313
/**
14-
* Meteor Addons Addon - Entry Point
15-
*
16-
* Enables browsing, installing, and updating Meteor Client addons directly from within the client.
17-
* Fetches addon metadata from the meteor-addon-scanner repository.
18-
*
19-
* @author Cope
14+
* Entry point for Meteor Addons addon.
15+
* Enables browsing, installing, and updating Meteor Client addons from within the client.
2016
*/
2117
public class MeteorAddonsAddon extends MeteorAddon {
2218
public static final Logger LOG = LoggerFactory.getLogger("Meteor Addons");
@@ -25,20 +21,16 @@ public class MeteorAddonsAddon extends MeteorAddon {
2521
public void onInitialize() {
2622
LOG.info("Initializing Meteor Addons Addon");
2723

28-
// Initialize IconPreloadSystem (handles icon lifecycle)
2924
IconPreloadSystem iconPreloadSystem = new IconPreloadSystem();
3025
Systems.add(iconPreloadSystem);
3126
LOG.info("IconPreloadSystem registered");
3227

33-
// Initialize AddonManager system (manages addon state, downloads, updates)
3428
Systems.add(new AddonManager());
3529
LOG.info("AddonManager system initialized");
3630

37-
// Register Addons tab in Meteor GUI
3831
Tabs.add(new AddonsTab());
3932
LOG.info("Addons tab registered");
4033

41-
// Start fetching addon metadata on a background thread
4234
AddonManager.get().init();
4335
LOG.info("Started fetching addon metadata");
4436

@@ -47,7 +39,6 @@ public void onInitialize() {
4739

4840
@Override
4941
public void onRegisterCategories() {
50-
// No custom module categories needed for this addon
5142
}
5243

5344
@Override

src/main/java/com/cope/meteoraddons/addons/Addon.java

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,17 @@
66
import java.util.Optional;
77

88
/**
9-
* Unified interface for all addon types (online, installed, etc).
10-
* Provides common methods for displaying and managing addons.
9+
* Unified interface for addon types (online, installed).
1110
*/
1211
public interface Addon {
13-
/**
14-
* Get the display name of the addon.
15-
*/
1612
String getName();
17-
18-
/**
19-
* Get the unique identifier of the addon.
20-
*/
2113
String getId();
22-
23-
/**
24-
* Get the addon description.
25-
*/
2614
Optional<String> getDescription();
27-
28-
/**
29-
* Get the list of addon authors.
30-
*/
3115
List<String> getAuthors();
32-
33-
/**
34-
* Get the addon version.
35-
*/
3616
String getVersion();
37-
38-
/**
39-
* Get an input stream for the addon icon.
40-
* May download remotely or read from local file.
41-
*/
4217
Optional<InputStream> getIconStream() throws IOException;
43-
44-
/**
45-
* Get the GitHub repository URL.
46-
*/
4718
Optional<String> getGithubUrl();
48-
49-
/**
50-
* Get the Discord server URL.
51-
*/
5219
Optional<String> getDiscordUrl();
53-
54-
/**
55-
* Get the homepage URL.
56-
*/
5720
Optional<String> getHomepageUrl();
58-
59-
/**
60-
* Check if this addon is currently installed.
61-
*/
6221
boolean isInstalled();
6322
}

src/main/java/com/cope/meteoraddons/addons/InstalledAddon.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import java.util.stream.Collectors;
1212

1313
/**
14-
* Represents an installed Meteor addon loaded by Fabric.
15-
* Wraps Fabric's ModContainer to provide addon interface.
14+
* Installed Meteor addon wrapper for Fabric's ModContainer.
1615
*/
1716
public class InstalledAddon implements Addon {
1817
private final ModContainer modContainer;
@@ -52,7 +51,6 @@ public String getVersion() {
5251

5352
@Override
5453
public Optional<InputStream> getIconStream() throws IOException {
55-
// Try multiple icon paths in order
5654
String[] iconPaths = {
5755
metadata.getIconPath(128).orElse(null),
5856
metadata.getIconPath(64).orElse(null),
@@ -70,7 +68,6 @@ public Optional<InputStream> getIconStream() throws IOException {
7068
InputStream stream = java.nio.file.Files.newInputStream(pathOpt.get());
7169
return Optional.of(stream);
7270
} catch (IOException e) {
73-
// Try next path
7471
}
7572
}
7673
}
@@ -80,15 +77,13 @@ public Optional<InputStream> getIconStream() throws IOException {
8077

8178
@Override
8279
public Optional<String> getGithubUrl() {
83-
// Try to find GitHub URL in contact info
8480
return metadata.getContact().get("sources")
8581
.or(() -> metadata.getContact().get("homepage"))
8682
.filter(url -> url.contains("github.com"));
8783
}
8884

8985
@Override
9086
public Optional<String> getDiscordUrl() {
91-
// Try to find Discord URL in contact info
9287
return metadata.getContact().get("discord")
9388
.or(() -> metadata.getContact().get("issues"))
9489
.filter(url -> url.contains("discord"));
@@ -101,7 +96,7 @@ public Optional<String> getHomepageUrl() {
10196

10297
@Override
10398
public boolean isInstalled() {
104-
return true; // Always true for installed addons
99+
return true;
105100
}
106101

107102
public ModContainer getModContainer() {

src/main/java/com/cope/meteoraddons/addons/OnlineAddon.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import java.util.Optional;
1212

1313
/**
14-
* Wrapper for online addon metadata from the addon scanner.
15-
* Delegates to AddonMetadata and adds installed status checking.
14+
* Online addon wrapper for scanner metadata.
1615
*/
1716
public class OnlineAddon implements Addon {
1817
private final AddonMetadata metadata;
@@ -32,7 +31,6 @@ public String getName() {
3231

3332
@Override
3433
public String getId() {
35-
// Use name as ID for online addons (metadata doesn't have a separate ID field)
3634
return metadata.name.toLowerCase().replace(" ", "-");
3735
}
3836

@@ -49,7 +47,6 @@ public List<String> getAuthors() {
4947

5048
@Override
5149
public String getVersion() {
52-
// Try to extract version from download URL or use mc_version
5350
if (metadata.mc_version != null) {
5451
return metadata.mc_version;
5552
}

src/main/java/com/cope/meteoraddons/gui/screens/BrowseAddonsScreen.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
import static meteordevelopment.meteorclient.MeteorClient.mc;
2222
import static meteordevelopment.meteorclient.utils.Utils.getWindowWidth;
2323

24-
/**
25-
* Screen for browsing and downloading online addons.
26-
*/
2724
public class BrowseAddonsScreen extends WindowScreen {
2825
private static final int CARDS_PER_ROW = 4;
2926
private boolean isGridView = false;
@@ -36,14 +33,12 @@ public BrowseAddonsScreen(GuiTheme theme) {
3633
public void initWidgets() {
3734
AddonManager manager = AddonManager.get();
3835

39-
// Header
4036
WHorizontalList header = add(theme.horizontalList()).expandX().widget();
4137
header.add(theme.label("Available Addons")).expandX();
4238
header.add(theme.label("MC " + VersionUtil.getCurrentMinecraftVersion()).color(theme.textSecondaryColor()));
4339

4440
add(theme.horizontalSeparator()).expandX();
4541

46-
// Loading / Error
4742
if (manager.isLoading()) {
4843
add(theme.label("Loading addons...")).centerX();
4944
return;
@@ -65,25 +60,18 @@ public void initWidgets() {
6560
return;
6661
}
6762

68-
// Toolbar
6963
WHorizontalList toolbar = add(theme.horizontalList()).expandX().widget();
7064
toolbar.add(theme.label(addons.size() + " addons"));
71-
72-
// Spacer using empty expanding label or just layout properties
73-
// Meteor doesn't have a spacer widget usually, but expanding a label works or expanding the container.
74-
// We'll rely on the previous label expanding? No, WLabel auto-sizes.
75-
// We can add a dummy widget that expands.
7665
toolbar.add(theme.horizontalList()).expandX();
77-
66+
7867
WButton listBtn = toolbar.add(theme.button(isGridView ? "List" : "[List]")).widget();
7968
listBtn.action = () -> { isGridView = false; reload(); };
80-
69+
8170
WButton gridBtn = toolbar.add(theme.button(isGridView ? "[Grid]" : "Grid")).widget();
8271
gridBtn.action = () -> { isGridView = true; reload(); };
8372

8473
add(theme.horizontalSeparator()).expandX();
8574

86-
// Content
8775
if (isGridView) {
8876
initGridView(addons);
8977
} else {

src/main/java/com/cope/meteoraddons/gui/tabs/AddonsTab.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
import static meteordevelopment.meteorclient.MeteorClient.mc;
1414

1515
/**
16-
* GUI tab for browsing and managing Meteor addons.
17-
* Provides navigation between Installed and Browse screens.
16+
* Main GUI tab for browsing and managing addons.
1817
*/
1918
public class AddonsTab extends Tab {
2019
public AddonsTab() {

src/main/java/com/cope/meteoraddons/gui/widgets/WAddonCard.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
import meteordevelopment.meteorclient.renderer.Texture;
99

1010
/**
11-
* Widget for displaying an addon card in the grid.
12-
* Simplified design: Icon + Title + View Details button.
13-
* Shows installed indicator (green checkmark) overlaid on icon for installed addons.
11+
* Addon card widget for grid view.
1412
*/
1513
public class WAddonCard extends WVerticalList {
1614
private static final double FIXED_WIDTH = 220;
@@ -26,21 +24,17 @@ public WAddonCard(Addon addon, Runnable onOpenDetails) {
2624
@Override
2725
protected void onCalculateSize() {
2826
super.onCalculateSize();
29-
// Force fixed width
3027
width = theme.scale(FIXED_WIDTH);
3128
}
3229

3330
@Override
3431
public void init() {
35-
// Icon (128x128, scaled down to 64x64 by GPU)
3632
Texture iconTexture = IconCache.get(addon);
3733
add(theme.texture(64, 64, 0, iconTexture)).centerX();
3834

39-
// Title row with optional installed indicator
4035
WHorizontalList titleRow = add(theme.horizontalList()).centerX().widget();
4136
titleRow.add(theme.label(addon.getName()));
4237

43-
// Add installed indicator after title if installed
4438
if (addon.isInstalled()) {
4539
Texture installedIcon = IconCache.getInstalledIndicator();
4640
if (installedIcon != null) {
@@ -49,7 +43,6 @@ public void init() {
4943
}
5044
}
5145

52-
// View details button
5346
WButton viewButton = add(theme.button("View Details")).expandX().widget();
5447
viewButton.action = onOpenDetails;
5548
}

0 commit comments

Comments
 (0)