Skip to content

Commit a3dbccf

Browse files
committed
Test
1 parent 5274d5b commit a3dbccf

6 files changed

Lines changed: 56 additions & 18 deletions

File tree

build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,18 @@ tasks.register("generateBuildConfig") {
180180
def template =
181181
file("src/main/templates/net/wurstclient/config/BuildConfig.java.in")
182182
def modVersionValue = project.mod_version
183+
def forkReleaseVersion =
184+
(project.findProperty("fork_release_version") ?: "0.0").toString()
185+
def ghRepoId = project.gh_repo_id.toString()
186+
def ghRepoUrl = "https://github.com/${ghRepoId}"
187+
def buildDate = java.time.Instant.now().toString()
183188

184189
inputs.file(template)
185190
inputs.property("niceWurstEnabled", niceWurstEnabled)
191+
inputs.property("forkReleaseVersion", forkReleaseVersion)
192+
inputs.property("ghRepoId", ghRepoId)
193+
inputs.property("ghRepoUrl", ghRepoUrl)
194+
inputs.property("buildDate", buildDate)
186195
outputs.dir(buildConfigOutput)
187196

188197
doLast {
@@ -194,6 +203,10 @@ tasks.register("generateBuildConfig") {
194203
def content = template.getText("UTF-8")
195204
.replace('${NICE_WURST}', String.valueOf(niceWurstEnabled))
196205
.replace('${MOD_VERSION}', modVersionValue)
206+
.replace('${FORK_RELEASE_VERSION}', forkReleaseVersion)
207+
.replace('${BUILD_DATE}', buildDate)
208+
.replace('${GH_REPO_ID}', ghRepoId)
209+
.replace('${GH_REPO_URL}', ghRepoUrl)
197210

198211
def targetFile = new File(targetDir, "BuildConfig.java")
199212
targetFile.setText(content, "UTF-8")

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fabric_api_version=0.140.2+1.21.11
1616

1717
# Mod Properties
1818
mod_version=v7.51.4-CevAPI-MC1.21.11
19+
fork_release_version=0.39
1920
maven_group=net.wurstclient
2021
archives_base_name=Wurst-Client
2122
mod_loader=Fabric

src/main/java/net/wurstclient/WurstClient.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import net.wurstclient.presets.PresetManager;
4141
import net.wurstclient.settings.SettingsFile;
4242
import net.wurstclient.update.ProblematicResourcePackDetector;
43+
import net.wurstclient.update.ForkUpdateChecker;
4344
import net.wurstclient.update.WurstUpdater;
4445
import net.wurstclient.util.PlayerRangeAlertManager;
4546
import net.wurstclient.util.SetbackDetector;
@@ -85,6 +86,7 @@ public enum WurstClient
8586
private boolean enabled = true;
8687
private static boolean guiInitialized;
8788
private WurstUpdater updater;
89+
private ForkUpdateChecker forkUpdateChecker;
8890
private ProblematicResourcePackDetector problematicPackDetector;
8991
private Path wurstFolder;
9092

@@ -167,6 +169,9 @@ public void initialize()
167169
updater = new WurstUpdater();
168170
eventManager.add(UpdateListener.class, updater);
169171

172+
forkUpdateChecker = new ForkUpdateChecker();
173+
eventManager.add(UpdateListener.class, forkUpdateChecker);
174+
170175
problematicPackDetector = new ProblematicResourcePackDetector();
171176
problematicPackDetector.start();
172177

@@ -392,6 +397,11 @@ public WurstUpdater getUpdater()
392397
return updater;
393398
}
394399

400+
public ForkUpdateChecker getForkUpdateChecker()
401+
{
402+
return forkUpdateChecker;
403+
}
404+
395405
public ProblematicResourcePackDetector getProblematicPackDetector()
396406
{
397407
return problematicPackDetector;

src/main/java/net/wurstclient/hacks/SpearAssistHack.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ public void update()
220220
private int spearKillFlushCooldown;
221221
private AssistMode lastAssistMode;
222222

223-
public SpearAssistHack()
224-
{
225-
super("SpearAssist");
226-
setCategory(Category.COMBAT);
223+
public SpearAssistHack()
224+
{
225+
super("SpearAssist");
226+
setCategory(Category.COMBAT);
227227
addSetting(assistMode);
228228
addSetting(boostMode);
229229
addSetting(boostSpeed);
@@ -257,17 +257,16 @@ public SpearAssistHack()
257257
addSetting(spearKillLungeDelayModifier);
258258
addSetting(spearKillChatFeedback);
259259

260-
spearKillTargetEntities.clear();
261-
updateModeVisibility();
262-
}
263-
264-
@Override
265-
public String getRenderName()
266-
{
267-
return assistMode.getSelected() == AssistMode.SPEARKILL
268-
? getName() + " [Kill]"
269-
: getName();
270-
}
260+
spearKillTargetEntities.clear();
261+
updateModeVisibility();
262+
}
263+
264+
@Override
265+
public String getRenderName()
266+
{
267+
return assistMode.getSelected() == AssistMode.SPEARKILL
268+
? getName() + " [Kill]" : getName();
269+
}
271270

272271
@Override
273272
protected void onEnable()

src/main/java/net/wurstclient/mixin/TitleScreenMixin.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public abstract class TitleScreenMixin extends Screen
3232
{
3333
private AbstractWidget realmsButton = null;
3434
private Button wurstOptionsButton;
35+
private int forkInfoX = 4;
36+
private int forkInfoY = 4;
3537

3638
private TitleScreenMixin(WurstClient wurst, Component title)
3739
{
@@ -80,6 +82,9 @@ private void onAddNormalWidgets(int y, int spacingY,
8082
@Inject(at = @At("RETURN"), method = "tick()V")
8183
private void onTick(CallbackInfo ci)
8284
{
85+
if(WurstClient.INSTANCE.getForkUpdateChecker() != null)
86+
WurstClient.INSTANCE.getForkUpdateChecker().startIfNeeded();
87+
8388
if(realmsButton == null || wurstOptionsButton == null)
8489
return;
8590

@@ -95,9 +100,15 @@ private void onRender(GuiGraphics graphics, int mouseX, int mouseY,
95100
{
96101
Font font = minecraft.font;
97102
String brand = NiceWurstModule.isActive() ? "NiceWurst" : "Wurst";
98-
String text = brand + " " + BuildConfig.MOD_VERSION;
99-
graphics.drawString(font, Component.literal(text).getVisualOrderText(),
100-
4, 4, 0xFFFFFFFF, true);
103+
String baseText = brand + " " + BuildConfig.MOD_VERSION + " v"
104+
+ BuildConfig.FORK_RELEASE_VERSION;
105+
String suffix = WurstClient.INSTANCE.getForkUpdateChecker() == null ? ""
106+
: WurstClient.INSTANCE.getForkUpdateChecker().getStatusSuffix();
107+
String text = baseText + suffix;
108+
109+
Component component = Component.literal(text);
110+
graphics.drawString(font, component.getVisualOrderText(), forkInfoX,
111+
forkInfoY, 0xFFFFFFFF, true);
101112
}
102113

103114
/**

src/main/templates/net/wurstclient/config/BuildConfig.java.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ public final class BuildConfig
66

77
public static final boolean NICE_WURST = ${NICE_WURST};
88
public static final String MOD_VERSION = "${MOD_VERSION}";
9+
public static final String FORK_RELEASE_VERSION = "${FORK_RELEASE_VERSION}";
10+
public static final String BUILD_DATE = "${BUILD_DATE}";
11+
public static final String GH_REPO_ID = "${GH_REPO_ID}";
12+
public static final String GH_REPO_URL = "${GH_REPO_URL}";
913
}

0 commit comments

Comments
 (0)