Skip to content

Commit

Permalink
update to latest devbuild
Browse files Browse the repository at this point in the history
fix #139
  • Loading branch information
C10udburst committed Jul 24, 2022
1 parent d50b0e7 commit 99474ab
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_version}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation("meteordevelopment:meteor-client:SNAPSHOT")
modImplementation("meteordevelopment:meteor-client:${project.meteor_version}-SNAPSHOT")

// seed .locate and ore sim
extraLibs('com.seedfinding:mc_math:0eb505174da8a92550f8ec6efe254e0fa936cc0d') { transitive = false }
Expand All @@ -50,11 +50,11 @@ dependencies {
processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version

filter { line -> line.replace("@mc_version@", project.minecraft_version) }
filter { line -> line.replace("@gh_hash@", System.getenv("GITHUB_SHA") ?: "") }
filesMatching("fabric.mod.json") {
expand "version": project.version,
"mc_version": project.minecraft_version,
"gh_hash": (System.getenv("GITHUB_SHA") ?: "")
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ loader_version=0.14.7
mod_version = 0.2
maven_group = anticope.rejects
archives_base_name = meteor-rejects-addon

meteor_version=0.5.0
17 changes: 6 additions & 11 deletions src/main/java/anticope/rejects/MeteorRejectsAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
import anticope.rejects.modules.*;
import anticope.rejects.modules.modifier.NoRenderModifier;
import anticope.rejects.utils.GiveUtils;
import anticope.rejects.utils.RejectsUtils;
import meteordevelopment.meteorclient.addons.GithubRepo;
import meteordevelopment.meteorclient.addons.MeteorAddon;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.gui.GuiThemes;
import meteordevelopment.meteorclient.systems.Systems;
import meteordevelopment.meteorclient.systems.commands.Commands;
Expand All @@ -20,11 +17,10 @@
import net.fabricmc.loader.api.FabricLoader;

import net.minecraft.item.Items;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.invoke.MethodHandles;

public class MeteorRejectsAddon extends MeteorAddon {
public static final Logger LOG = LoggerFactory.getLogger("Rejects");
public static final Category CATEGORY = new Category("Rejects", Items.BARRIER.getDefaultStack());
Expand All @@ -34,11 +30,6 @@ public class MeteorRejectsAddon extends MeteorAddon {
public void onInitialize() {
LOG.info("Initializing Meteor Rejects Addon");

MeteorClient.EVENT_BUS.registerLambdaFactory("anticope.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));

RejectsUtils.init();
GiveUtils.init();

// Modules
Modules modules = Modules.get();
modules.add(new AntiBot());
Expand Down Expand Up @@ -126,7 +117,11 @@ public String getCommit() {
.get().getMetadata()
.getCustomValue("github:sha")
.getAsString();
LOG.info(String.format("Rejects version: %s", commit.toString()));
return commit.isEmpty() ? null : commit.trim();

}

public String getPackage() {
return "anticope.rejects";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public class MeteorRoundedGuiTheme extends GuiTheme {
public final Setting<SettingColor> textHighlightColor = color(sgTextColors, "text-highlight", "Color of text highlighting.", new SettingColor(45, 125, 245, 100));
public final Setting<SettingColor> titleTextColor = color(sgTextColors, "title-text", "Color of title text.", new SettingColor(255, 255, 255));
public final Setting<SettingColor> loggedInColor = color(sgTextColors, "logged-in-text", "Color of logged in account name.", new SettingColor(45, 225, 45));
public final Setting<SettingColor> placeholderColor = color(sgTextColors, "placeholder", "Color of placeholder text.", new SettingColor(255, 255, 255, 20));

// Background

Expand Down Expand Up @@ -236,8 +237,8 @@ public WSlider slider(double value, double min, double max) {
}

@Override
public WTextBox textBox(String text, CharFilter filter, Class<? extends WTextBox.Renderer> renderer) {
return w(new WMeteorTextBox(text, filter, renderer));
public WTextBox textBox(String text, String placeholder, CharFilter filter, Class<? extends WTextBox.Renderer> renderer) {
return w(new WMeteorTextBox(text, placeholder, filter, renderer));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class WMeteorTextBox extends WTextBox implements MeteorWidget {

private double animProgress;

public WMeteorTextBox(String text, CharFilter filter, Class<? extends Renderer> renderer) {
super(text, filter, renderer);
public WMeteorTextBox(String text, String placeholder, CharFilter filter, Class<? extends Renderer> renderer) {
super(text, placeholder, filter, renderer);
}

@Override
Expand Down Expand Up @@ -54,6 +54,9 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub
if (!text.isEmpty()) {
renderer.text(text, x + pad - overflowWidth, y + pad, theme.textColor.get(), false);
}
else if (placeholder != null) {
this.renderer.render(renderer, x + pad - overflowWidth, y + pad, placeholder, theme.placeholderColor.get());
}

// Text highlighting
if (focused && (cursor != selectionStart || cursor != selectionEnd)) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/anticope/rejects/utils/GiveUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void giveItem(ItemStack item) throws CommandSyntaxException {
}
}

public static void init() {
static {
STRING_PRESETS.forEach((preset) -> {
PRESETS.put(preset.getLeft(), (preview) -> {
if (preview) preset.getMiddle().getDefaultStack();
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/anticope/rejects/utils/RejectsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import anticope.rejects.utils.seeds.Seeds;
import meteordevelopment.meteorclient.MeteorClient;

import meteordevelopment.meteorclient.utils.PostInit;
public class RejectsUtils {

@PostInit
public static void init() {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
System.out.println("saving seeds...");
RejectsConfig.get().save(MeteorClient.FOLDER);
Seeds.get().save(MeteorClient.FOLDER);
}));
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
],
"custom": {
"meteor-client:color": "227,0,0",
"github:sha": "@gh_hash@"
"github:sha": "${gh_hash}"
},
"depends": {
"java": ">=16",
"minecraft": ">=@mc_version@",
"minecraft": "~${mc_version}",
"meteor-client": "*"
}
}

0 comments on commit 99474ab

Please sign in to comment.