Skip to content

Commit

Permalink
Fixed some flaws
Browse files Browse the repository at this point in the history
  • Loading branch information
qingshu-ui committed Jan 1, 2024
1 parent de0272e commit 2c65a67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
13 changes: 0 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ jar {
tasks.withType(Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
Expand All @@ -90,15 +89,3 @@ tasks.withType(JavaCompile).configureEach {
it.options.release = targetVersion
}
}

java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
13 changes: 9 additions & 4 deletions src/main/java/anticope/rejects/modules/AutoEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class AutoEnchant extends meteordevelopment.meteorclient.systems.modules.
);

public AutoEnchant() {
super(MeteorRejectsAddon.CATEGORY, "auto-enchant ", "Automatically enchanting items.");
super(MeteorRejectsAddon.CATEGORY, "auto-enchant", "Automatically enchanting items.");
}

@EventHandler
Expand All @@ -77,7 +77,7 @@ private void autoEnchant() {
info("Enchanting table is closed.");
break;
}
if (handler.getLapisCount() < 3 && !fillLapisItem()) {
if (handler.getLapisCount() < level.get() && !fillLapisItem()) {
info("Lapis lazuli is not found.");
break;
}
Expand All @@ -94,7 +94,12 @@ private void autoEnchant() {
mc.execute(() -> InvUtils.drop().slotId(0));
}

// Why sleep here? I don't know either.
/*
Although the description here indicates that the tick is the unit,
the actual delay is not the tick unit,
but it does not affect the normal operation in the game.
Perhaps we can ignore it
*/
try {
Thread.sleep(delay.get());
} catch (InterruptedException e) {
Expand All @@ -112,7 +117,7 @@ private boolean fillCanEnchantItem() {

private boolean fillLapisItem() {
FindItemResult res = InvUtils.find(Items.LAPIS_LAZULI);
if (res.slot() == -1) return false;
if (!res.found()) return false;
InvUtils.shiftClick().slot(res.slot());
return true;
}
Expand Down

0 comments on commit 2c65a67

Please sign in to comment.