Skip to content

Commit 90d5155

Browse files
committed
Added SilkOnly, Upgraded DamageDetect
1 parent 5ffe939 commit 90d5155

7 files changed

Lines changed: 229 additions & 19 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ Credits to [Trouser-Streak](https://github.com/etianl/Trouser-Streak/blob/main/s
650650

651651
### DamageDetect
652652

653-
- Navigator only hack that simply tells you who or what caused you damage and where in chat
653+
- Simple hack simply tells you who or what caused you damage and where in chat
654654

655655
### Teleport
656656

@@ -729,6 +729,10 @@ This hack is still undergoing development and has only been tested in the end. A
729729
- Sign + title + append count
730730
- File + word-wrap
731731

732+
### SilkOnly
733+
- Allows you to setup a list of blocks that can only be broken by the player using a tool that has Silk Touch.
734+
- Perfect for avoiding accidental breakage of Ender Chests and Amethyst Clusters.
735+
732736
## What's changed or improved in this fork?
733737

734738
### ChestESP

src/main/java/net/wurstclient/hack/HackList.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public final class HackList implements UpdateListener
226226
new WorkstationEspHack();
227227
public final RedstoneEspHack redstoneEspHack = new RedstoneEspHack();
228228
public final SkinDerpHack skinDerpHack = new SkinDerpHack();
229+
public final SilkOnlyHack silkOnlyHack = new SilkOnlyHack();
229230
public final SneakHack sneakHack = new SneakHack();
230231
public final SnowShoeHack snowShoeHack = new SnowShoeHack();
231232
public final SpeedHackHack speedHackHack = new SpeedHackHack();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.minecraft.network.chat.Component;
1212
import net.minecraft.world.damagesource.DamageSource;
1313
import net.minecraft.world.entity.Entity;
14+
import net.wurstclient.Category;
1415
import net.wurstclient.SearchTags;
1516
import net.wurstclient.events.UpdateListener;
1617
import net.wurstclient.hack.Hack;
@@ -23,7 +24,7 @@ public final class DamageDetectHack extends Hack implements UpdateListener
2324
public DamageDetectHack()
2425
{
2526
super("DamageDetect");
26-
// No category -> Navigator-only
27+
setCategory(Category.OTHER);
2728
}
2829

2930
@Override
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/*
2+
* Copyright (c) 2014-2026 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.hacks;
9+
10+
import java.util.Optional;
11+
12+
import net.minecraft.core.Holder.Reference;
13+
import net.minecraft.core.Registry;
14+
import net.minecraft.core.RegistryAccess;
15+
import net.minecraft.core.registries.Registries;
16+
import net.minecraft.world.item.ItemStack;
17+
import net.minecraft.world.item.enchantment.Enchantment;
18+
import net.minecraft.world.item.enchantment.EnchantmentHelper;
19+
import net.minecraft.world.item.enchantment.Enchantments;
20+
import net.minecraft.world.level.block.Block;
21+
import net.minecraft.world.level.block.state.BlockState;
22+
import net.wurstclient.Category;
23+
import net.wurstclient.SearchTags;
24+
import net.wurstclient.hack.Hack;
25+
import net.wurstclient.settings.BlockListSetting;
26+
import net.wurstclient.settings.CheckboxSetting;
27+
import net.wurstclient.util.ChatUtils;
28+
29+
@SearchTags({"silkonly", "silk only", "silk touch only"})
30+
public final class SilkOnlyHack extends Hack
31+
{
32+
private final BlockListSetting blockList =
33+
new BlockListSetting("Block List",
34+
"Blocks that can only be broken with Silk Touch enabled.",
35+
"minecraft:ender_chest", "minecraft:bookshelf",
36+
"minecraft:amethyst_cluster");
37+
38+
private final CheckboxSetting chatMessage = new CheckboxSetting(
39+
"Chat message",
40+
"Print a chat message when refusing to break a listed block.", true);
41+
42+
private net.minecraft.core.BlockPos lastRefusePos;
43+
private long lastRefuseMs;
44+
45+
public SilkOnlyHack()
46+
{
47+
super("SilkOnly");
48+
setCategory(Category.BLOCKS);
49+
addSetting(blockList);
50+
addSetting(chatMessage);
51+
}
52+
53+
/**
54+
* Returns true if the hack should refuse to break the given block state
55+
* with the given tool.
56+
*/
57+
public boolean shouldRefuseBreak(net.minecraft.core.BlockPos pos,
58+
BlockState state, ItemStack tool)
59+
{
60+
if(!isEnabled() || pos == null || state == null)
61+
return false;
62+
if(MC.player == null || MC.level == null)
63+
return false;
64+
if(MC.player.getAbilities().instabuild)
65+
return false;
66+
67+
Block block = state.getBlock();
68+
if(block == null || !blockList.contains(block))
69+
return false;
70+
71+
if(hasSilkTouch(tool))
72+
return false;
73+
74+
maybeMessage(pos, block);
75+
return true;
76+
}
77+
78+
private void maybeMessage(net.minecraft.core.BlockPos pos, Block block)
79+
{
80+
if(!chatMessage.isChecked())
81+
return;
82+
83+
long now = System.currentTimeMillis();
84+
if(lastRefusePos != null && lastRefusePos.equals(pos)
85+
&& now - lastRefuseMs < 1000L)
86+
return;
87+
88+
lastRefusePos = pos;
89+
lastRefuseMs = now;
90+
91+
String name = getBlockDisplayName(block);
92+
ChatUtils.message("Refusing To Break " + name + ". Use Silk Touch");
93+
}
94+
95+
private static String getBlockDisplayName(Block block)
96+
{
97+
if(block == null)
98+
return "block";
99+
100+
try
101+
{
102+
ItemStack asItem = new ItemStack(block.asItem());
103+
if(!asItem.isEmpty())
104+
{
105+
String s = asItem.getHoverName().getString();
106+
if(s != null && !s.isBlank())
107+
return s;
108+
}
109+
}catch(Throwable ignored)
110+
{}
111+
112+
try
113+
{
114+
return net.minecraft.core.registries.BuiltInRegistries.BLOCK
115+
.getKey(block).toString();
116+
}catch(Throwable ignored)
117+
{
118+
return "block";
119+
}
120+
}
121+
122+
private static boolean hasSilkTouch(ItemStack stack)
123+
{
124+
if(stack == null || stack.isEmpty())
125+
return false;
126+
127+
if(MC.level == null)
128+
return false;
129+
130+
try
131+
{
132+
RegistryAccess access = MC.level.registryAccess();
133+
Registry<Enchantment> registry =
134+
access.lookupOrThrow(Registries.ENCHANTMENT);
135+
Optional<Reference<Enchantment>> silk =
136+
registry.get(Enchantments.SILK_TOUCH);
137+
138+
int lvl = silk.map(
139+
ref -> EnchantmentHelper.getItemEnchantmentLevel(ref, stack))
140+
.orElse(0);
141+
return lvl > 0;
142+
143+
}catch(Throwable t)
144+
{
145+
return false;
146+
}
147+
}
148+
}

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import net.wurstclient.events.PlayerAttacksEntityListener.PlayerAttacksEntityEvent;
4141
import net.wurstclient.events.StopUsingItemListener.StopUsingItemEvent;
4242
import net.wurstclient.hacks.AntiDropHack;
43+
import net.wurstclient.hacks.SilkOnlyHack;
4344
import net.wurstclient.mixinterface.IClientPlayerInteractionManager;
4445

4546
@Mixin(MultiPlayerGameMode.class)
@@ -52,6 +53,56 @@ public abstract class ClientPlayerInteractionManagerMixin
5253

5354
private boolean antiDropBypassingPlacement;
5455

56+
@Inject(at = @At("HEAD"),
57+
method = "startDestroyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;)Z",
58+
cancellable = true)
59+
private void wurst$silkOnly_startDestroyBlock(BlockPos pos,
60+
Direction direction, CallbackInfoReturnable<Boolean> cir)
61+
{
62+
if(pos == null || minecraft.player == null || minecraft.level == null)
63+
return;
64+
65+
if(!WurstClient.INSTANCE.isEnabled())
66+
return;
67+
68+
SilkOnlyHack silkOnly = WurstClient.INSTANCE.getHax().silkOnlyHack;
69+
if(silkOnly == null || !silkOnly.isEnabled())
70+
return;
71+
72+
var state = minecraft.level.getBlockState(pos);
73+
var tool = minecraft.player.getMainHandItem();
74+
if(silkOnly.shouldRefuseBreak(pos, state, tool))
75+
{
76+
cir.setReturnValue(false);
77+
cir.cancel();
78+
}
79+
}
80+
81+
@Inject(at = @At("HEAD"),
82+
method = "continueDestroyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;)Z",
83+
cancellable = true)
84+
private void wurst$silkOnly_continueDestroyBlock(BlockPos pos,
85+
Direction direction, CallbackInfoReturnable<Boolean> cir)
86+
{
87+
if(pos == null || minecraft.player == null || minecraft.level == null)
88+
return;
89+
90+
if(!WurstClient.INSTANCE.isEnabled())
91+
return;
92+
93+
SilkOnlyHack silkOnly = WurstClient.INSTANCE.getHax().silkOnlyHack;
94+
if(silkOnly == null || !silkOnly.isEnabled())
95+
return;
96+
97+
var state = minecraft.level.getBlockState(pos);
98+
var tool = minecraft.player.getMainHandItem();
99+
if(silkOnly.shouldRefuseBreak(pos, state, tool))
100+
{
101+
cir.setReturnValue(false);
102+
cir.cancel();
103+
}
104+
}
105+
55106
@Inject(
56107
at = @At(value = "INVOKE",
57108
target = "Lnet/minecraft/client/player/LocalPlayer;getId()I",

src/main/java/net/wurstclient/nicewurst/NiceWurstModule.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public final class NiceWurstModule
5757
private static final EnumMap<Category, Set<String>> ALLOWED_HACKS =
5858
new EnumMap<>(Category.class);
5959
private static final Set<String> ALLOWED_NAME_ONLY = Set.of("ClickGUI",
60-
"Navigator", "ChorusFruit", "MeasurementESP", "Towny", "DamageDetect");
60+
"Navigator", "ChorusFruit", "MeasurementESP", "Towny");
6161

6262
private static final Set<String> HIDDEN_OTHER_FEATURES =
6363
Set.of("Anti-Fingerprint");
@@ -82,10 +82,10 @@ public final class NiceWurstModule
8282

8383
static
8484
{
85-
ALLOWED_HACKS.put(Category.BLOCKS,
86-
Set.of("AutoBuild", "AutoSign", "AutoTool", "BuildRandom",
87-
"Excavator", "InstantBunker", "ScaffoldWalk", "TemplateTool",
88-
"TargetPlace"));
85+
ALLOWED_HACKS.put(Category.BLOCKS,
86+
Set.of("AutoBuild", "AutoSign", "AutoTool", "BuildRandom",
87+
"Excavator", "InstantBunker", "ScaffoldWalk", "TemplateTool",
88+
"TargetPlace", "SilkOnly"));
8989

9090
ALLOWED_HACKS.put(Category.MOVEMENT, Set.of("BunnyHop", "AutoSprint",
9191
"AutoWalk", "AutoSwim", "Dolphin", "SafeWalk", "Sneak", "InvWalk"));
@@ -107,7 +107,8 @@ public final class NiceWurstModule
107107
"AutoLibrarian", "AutoReconnect", "AutoTrader", "CheatDetector",
108108
"ClickGUI", "FeedAura", "Navigator", "LivestreamDetector",
109109
"PacketRate", "Panic", "PortalGUI", "SafeTP", "UI-Utils",
110-
"SeedMapperHelper", "TooManyHax", "HideModMenu"));
110+
"SeedMapperHelper", "TooManyHax", "HideModMenu",
111+
"DamageDetect"));
111112

112113
ALLOWED_HACKS.put(Category.ITEMS,
113114
Set.of("AntiDrop", "AutoDisenchant", "AutoDrop", "AutoEat",

src/main/resources/assets/wurst/translations/en_us.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@
8484
"description.wurst.hack.cameradistance": "Allows you to change the camera distance in 3rd person.",
8585
"description.wurst.hack.cameranoclip": "Allows the camera in 3rd person to go through walls.",
8686
"description.wurst.hack.cavefinder": "Helps you to find caves by highlighting them in the selected color.",
87-
"description.wurst.hack.chattranslator": "Translates chat messages using Google Translate.",
88-
"description.wurst.hack.cheatdetector": "Monitors nearby players and reports suspicious movement or combat patterns in chat.",
89-
"description.wurst.hack.chorusfruit": "Consumes a chorus fruit item when the selected trigger happens and your health is low.",
90-
"hack.wurst.livestreamdetector": "LivestreamDetector",
91-
"description.wurst.hack.livestreamdetector": "Scans the tab list for live streamers on YouTube, Twitch, TikTok, and Kick and announces streams in chat.",
87+
"description.wurst.hack.chattranslator": "Translates chat messages using Google Translate.",
88+
"description.wurst.hack.cheatdetector": "Monitors nearby players and reports suspicious movement or combat patterns in chat.",
89+
"hack.wurst.damagedetect": "DamageDetect",
90+
"description.wurst.hack.damagedetect": "Shows what damaged you (including attacker and location) when you take damage.",
91+
"description.wurst.hack.chorusfruit": "Consumes a chorus fruit item when the selected trigger happens and your health is low.",
92+
"hack.wurst.livestreamdetector": "LivestreamDetector",
93+
"description.wurst.hack.livestreamdetector": "Scans the tab list for live streamers on YouTube, Twitch, TikTok, and Kick and announces streams in chat.",
9294
"description.wurst.hack.chestesp": "Highlights nearby chests.",
9395
"description.wurst.hack.chestsearch": "Scans opened chests for items and highlights matching chests with waypoints and ESP.",
9496
"hack.wurst.kickforensics": "KickForensics",
@@ -246,12 +248,14 @@
246248
"description.wurst.hack.safewalk": "Prevents you from falling off edges.",
247249
"description.wurst.hack.scaffoldwalk": "Automatically places blocks below your feet.",
248250
"description.wurst.hack.search": "Helps you to find specific blocks by highlighting them in rainbow or fixed color. Use the Query input to search for partial keywords or create your own list of blocks to highlight.",
249-
"description.wurst.hack.seedmapperhelper": "Builds and runs SeedMapper sm:* commands from a button-based interface whenever the SeedMapper mod is installed, including highlight, locate, sample, and source helpers.",
250-
"description.wurst.hack.signesp": "Highlights nearby signs",
251-
"description.wurst.hack.signframept": "Right-clicking item frames (with items in them) or signs forwards the interaction to the block behind them. Use the hack settings to enable Frames, Signs, or both. Hold sneak to interact with the frame or sign normally.",
252-
"description.wurst.hack.skinderp": "Randomly toggles parts of your skin.",
253-
"description.wurst.hack.sneak": "Makes you sneak automatically.",
254-
"description.wurst.hack.snowshoe": "Allows you to walk on powder snow.",
251+
"description.wurst.hack.seedmapperhelper": "Builds and runs SeedMapper sm:* commands from a button-based interface whenever the SeedMapper mod is installed, including highlight, locate, sample, and source helpers.",
252+
"description.wurst.hack.signesp": "Highlights nearby signs",
253+
"description.wurst.hack.signframept": "Right-clicking item frames (with items in them) or signs forwards the interaction to the block behind them. Use the hack settings to enable Frames, Signs, or both. Hold sneak to interact with the frame or sign normally.",
254+
"hack.wurst.silkonly": "SilkOnly",
255+
"description.wurst.hack.silkonly": "Prevents you from breaking selected blocks unless your held tool has Silk Touch.",
256+
"description.wurst.hack.skinderp": "Randomly toggles parts of your skin.",
257+
"description.wurst.hack.sneak": "Makes you sneak automatically.",
258+
"description.wurst.hack.snowshoe": "Allows you to walk on powder snow.",
255259
"description.wurst.hack.speedhack": "Allows you to run ~2.5x faster than you would by sprinting and jumping.\n\n??6??lWARNING:??r Patched in NoCheat+ version 3.13.2. Will only bypass older versions of NoCheat+.\nType ??l/ncp version??r to check a server's NoCheat+ version.",
256260
"description.wurst.hack.speednuker": "Faster version of Nuker that cannot bypass NoCheat+.",
257261
"description.wurst.hack.spider": "Allows you to climb up walls like a spider.",

0 commit comments

Comments
 (0)