Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
}

//rusherhack api
rusherhackApi "org.rusherhack:rusherhack-api:1.20.1-SNAPSHOT"
rusherhackApi "org.rusherhack:rusherhack-api:1.21.4-SNAPSHOT"
}

loom {
Expand All @@ -60,16 +60,13 @@ loom {
}
}

def targetJavaVersion = 17
def targetJavaVersion = project.java_version
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
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
}

java {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ org.gradle.jvmargs=-Xmx1G
plugin_name = auto-anvil

# plugin version
plugin_version = 1.0.0
plugin_version = 1.1.0

maven_group = org.icetank

# use java 17 for minecraft versions 1.20.4 and older
# use java 21 for minecraft versions 1.20.5 and newer
java_version = 17
java_version = 21

# minecraft version to compile with
# other supported versions of the game can be added in rusherhack-plugin.json
minecraft_version = 1.20.1
minecraft_version = 1.21.4

# parchment mappings
minecraft_version_range = 1.20-1.21.1
minecraft_version_range = 1.21.1-1.21.4

# fabric loader version
fabric_loader_version = 0.16.10
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jun 15 01:20:21 CEST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
24 changes: 7 additions & 17 deletions src/main/java/org/icetank/AutoAnvilRenameModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.ShulkerBoxBlock;
import org.rusherhack.client.api.RusherHackAPI;
import org.rusherhack.client.api.events.client.EventUpdate;
import org.rusherhack.client.api.events.render.EventRender2D;
import org.rusherhack.client.api.feature.module.ModuleCategory;
import org.rusherhack.client.api.feature.module.ToggleableModule;
import org.rusherhack.client.api.render.IRenderer2D;
import org.rusherhack.client.api.render.font.IFontRenderer;
import org.rusherhack.client.api.utils.ChatUtils;
import org.rusherhack.client.api.utils.InventoryUtils;
import org.rusherhack.core.event.subscribe.Subscribe;
import org.rusherhack.core.setting.BooleanSetting;
import org.rusherhack.core.setting.NumberSetting;
import org.rusherhack.core.setting.StringSetting;

import java.awt.*;

public class AutoAnvilRenameModule extends ToggleableModule {
private final StringSetting renameText = new StringSetting("RenameText", "Sponsored by RusherHack Plugins");
private final BooleanSetting selectiveMode = new BooleanSetting("Selective", false);
Expand Down Expand Up @@ -62,14 +56,10 @@ private void onUpdate(EventUpdate event) {
}

@Override
public void onEnable() {

}
public void onEnable() {}

@Override
public void onDisable() {

}
public void onDisable() {}

void tick() {
if (mc.player == null || mc.level == null || mc.gameMode == null) return;
Expand All @@ -89,19 +79,19 @@ void tick() {
int cost = ((AnvilMenu) mc.player.containerMenu).getCost();

// Check if name matches the renameText option with an edge case for empty name values which remove the name.
if (outputItemName.equals(renameText.getValue()) || (renameText.getValue().equals("") && !itemStackOutput.hasCustomHoverName())) {
if (outputItemName.equals(renameText.getValue()) || (renameText.getValue().isEmpty() && !itemStackOutput.getHoverName().toString().isEmpty())) {

// Automatically use XP bottles until the rename can be afforded
if ((playerLevels < cost && !mc.player.isCreative()) && autoXP.getValue()) {
if (!mc.player.isHolding(Items.EXPERIENCE_BOTTLE)) {
int bottleSlot = InventoryUtils.findItemHotbar(Items.EXPERIENCE_BOTTLE);
if (bottleSlot != -1 && bottleSlot > 0 && bottleSlot < 9) {
if (bottleSlot > 0 && bottleSlot < 9) {
mc.player.getInventory().selected = bottleSlot;
}
}

if (mc.player.isHolding(Items.EXPERIENCE_BOTTLE)) {
mc.player.connection.send(new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, 1));
mc.player.connection.send(new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, 1, 0, 90));
}
}

Expand All @@ -127,9 +117,9 @@ void tick() {
String itemName = removeBrackets(itemStack.getDisplayName().getString());
String itemId = getItemId(itemStack.getItem());

if (itemId.equals("")) continue;
if (itemId.isEmpty()) continue;
if (selectiveMode.getValue() && !selectiveId.getValue().equals(itemId)) continue;
if (onlyRenamed.getValue() && !itemStack.hasCustomHoverName()) continue;
if (onlyRenamed.getValue() && !itemStackOutput.getHoverName().toString().isEmpty()) continue;
if (onlyShulkers.getValue() && !isShulker(itemStack) && !selectiveMode.getValue()) continue;
if (itemStack.isEmpty()) continue;
if (itemName.equals(renameText.getValue())) continue;
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/rusherhack-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
"Description": "",
"Authors": [
"icetank",
"_90_"
"_90_",
"musheck"
],
"Minecraft-Versions": [
"1.20.1",
"1.20.2",
"1.20.3",
"1.20.4",
"1.21.1"
"1.21.1",
"1.21.4"
]
}