Skip to content

Commit 14956ca

Browse files
Merge branch 'v7.50'
2 parents 30f8766 + a28f45d commit 14956ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1668
-1001
lines changed

gradle.properties

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# Done to increase the memory available to gradle.
2-
org.gradle.jvmargs=-Xmx1G
3-
org.gradle.parallel=true
4-
5-
# Fabric Properties
6-
# check these at https://fabricmc.net/develop/ and
7-
# https://modrinth.com/mod/fabric-api/versions
8-
minecraft_version=1.21.8
9-
yarn_mappings=1.21.8+build.1
10-
loader_version=0.16.14
11-
loom_version=1.11-SNAPSHOT
12-
13-
# Fabric API
14-
fabric_version=0.130.0+1.21.8
15-
16-
# Mod Properties
17-
mod_version=v7.49-MC1.21.8
18-
maven_group=net.wurstclient
19-
archives_base_name=Wurst-Client
20-
mod_loader=Fabric
21-
22-
# GitHub
23-
gh_repo_id=Wurst-Imperium/Wurst7
24-
mcx_repo_id=Wurst-Imperium/Wurst-MCX2
25-
26-
# Dependencies
1+
# Done to increase the memory available to gradle.
2+
org.gradle.jvmargs=-Xmx1G
3+
org.gradle.parallel=true
4+
5+
# Fabric Properties
6+
# check these at https://fabricmc.net/develop/ and
7+
# https://modrinth.com/mod/fabric-api/versions
8+
minecraft_version=1.21.8
9+
yarn_mappings=1.21.8+build.1
10+
loader_version=0.17.2
11+
loom_version=1.11-SNAPSHOT
12+
13+
# Fabric API
14+
fabric_version=0.131.0+1.21.8
15+
16+
# Mod Properties
17+
mod_version=v7.50-MC1.21.8
18+
maven_group=net.wurstclient
19+
archives_base_name=Wurst-Client
20+
mod_loader=Fabric
21+
22+
# GitHub
23+
gh_repo_id=Wurst-Imperium/Wurst7
24+
mcx_repo_id=Wurst-Imperium/Wurst-MCX2
25+
26+
# Dependencies

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public enum WurstClient
5050
public static MinecraftClient MC;
5151
public static IMinecraftClient IMC;
5252

53-
public static final String VERSION = "7.49";
53+
public static final String VERSION = "7.50";
5454
public static final String MC_VERSION = "1.21.8";
5555

5656
private PlausibleAnalytics plausible;

src/main/java/net/wurstclient/analytics/AnalyticsConfigFile.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
public final class AnalyticsConfigFile
2121
{
2222
private final Path path;
23+
private boolean disableSaving;
2324

2425
public AnalyticsConfigFile(Path path)
2526
{
@@ -31,7 +32,7 @@ public void load(PlausibleAnalytics plausible)
3132
try
3233
{
3334
WsonObject wson = JsonUtils.parseFileToObject(path);
34-
plausible.setEnabled(wson.getBoolean("enabled"));
35+
loadJson(wson, plausible);
3536

3637
}catch(NoSuchFileException e)
3738
{
@@ -46,8 +47,30 @@ public void load(PlausibleAnalytics plausible)
4647
save(plausible);
4748
}
4849

50+
private void loadJson(WsonObject wson, PlausibleAnalytics plausible)
51+
throws JsonException
52+
{
53+
try
54+
{
55+
disableSaving = true;
56+
57+
// v1 was bugged, don't load it
58+
if(!wson.has("version"))
59+
return;
60+
61+
plausible.setEnabled(wson.getBoolean("enabled"));
62+
63+
}finally
64+
{
65+
disableSaving = false;
66+
}
67+
}
68+
4969
public void save(PlausibleAnalytics plausible)
5070
{
71+
if(disableSaving)
72+
return;
73+
5174
JsonObject json = createJson(plausible);
5275

5376
try
@@ -64,6 +87,7 @@ public void save(PlausibleAnalytics plausible)
6487
private JsonObject createJson(PlausibleAnalytics plausible)
6588
{
6689
JsonObject json = new JsonObject();
90+
json.addProperty("version", 2);
6791
json.addProperty("enabled", plausible.isEnabled());
6892
return json;
6993
}

src/main/java/net/wurstclient/analytics/PlausibleAnalytics.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public final class PlausibleAnalytics
5757
new LinkedBlockingQueue<>();
5858
private final JsonObject sessionProps = new JsonObject();
5959
private final AnalyticsConfigFile configFile;
60-
private boolean enabled = false;
60+
private boolean enabled = true;
6161

6262
/**
6363
* Creates a new PlausibleAnalytics instance and starts a background thread
@@ -134,6 +134,7 @@ public boolean isEnabled()
134134
public void setEnabled(boolean enabled)
135135
{
136136
this.enabled = enabled;
137+
configFile.save(this);
137138
}
138139

139140
private boolean isDebugMode()

src/main/java/net/wurstclient/commands/ModifyCmd.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
import net.minecraft.client.network.ClientPlayerEntity;
1919
import net.minecraft.component.ComponentMap;
2020
import net.minecraft.component.ComponentType;
21+
import net.minecraft.entity.player.PlayerInventory;
2122
import net.minecraft.item.ItemStack;
22-
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
2323
import net.minecraft.registry.Registries;
2424
import net.minecraft.util.Identifier;
2525
import net.wurstclient.command.CmdError;
2626
import net.wurstclient.command.CmdException;
2727
import net.wurstclient.command.CmdSyntaxError;
2828
import net.wurstclient.command.Command;
2929
import net.wurstclient.util.ChatUtils;
30+
import net.wurstclient.util.InventoryUtils;
3031

3132
public final class ModifyCmd extends Command
3233
{
@@ -48,7 +49,9 @@ public void call(String[] args) throws CmdException
4849
if(args.length < 2)
4950
throw new CmdSyntaxError();
5051

51-
ItemStack stack = player.getInventory().getSelectedStack();
52+
PlayerInventory inventory = player.getInventory();
53+
int slot = inventory.getSelectedSlot();
54+
ItemStack stack = inventory.getSelectedStack();
5255
if(stack == null)
5356
throw new CmdError("You must hold an item in your main hand.");
5457

@@ -66,10 +69,7 @@ public void call(String[] args) throws CmdException
6669
throw new CmdSyntaxError();
6770
}
6871

69-
MC.player.networkHandler
70-
.sendPacket(new CreativeInventoryActionC2SPacket(
71-
36 + player.getInventory().getSelectedSlot(), stack));
72-
72+
InventoryUtils.setCreativeStack(slot, stack);
7373
ChatUtils.message("Item modified.");
7474
}
7575

src/main/java/net/wurstclient/commands/RepairCmd.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
import net.minecraft.client.network.ClientPlayerEntity;
1111
import net.minecraft.item.ItemStack;
12-
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
1312
import net.wurstclient.command.CmdError;
1413
import net.wurstclient.command.CmdException;
1514
import net.wurstclient.command.CmdSyntaxError;
1615
import net.wurstclient.command.Command;
1716
import net.wurstclient.util.ChatUtils;
17+
import net.wurstclient.util.InventoryUtils;
1818

1919
public final class RepairCmd extends Command
2020
{
@@ -35,11 +35,10 @@ public void call(String[] args) throws CmdException
3535
if(!player.getAbilities().creativeMode)
3636
throw new CmdError("Creative mode only.");
3737

38+
int slot = player.getInventory().getSelectedSlot();
3839
ItemStack stack = getHeldStack(player);
3940
stack.setDamage(0);
40-
MC.player.networkHandler
41-
.sendPacket(new CreativeInventoryActionC2SPacket(
42-
36 + player.getInventory().getSelectedSlot(), stack));
41+
InventoryUtils.setCreativeStack(slot, stack);
4342

4443
ChatUtils.message("Item repaired.");
4544
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public final class HackList implements UpdateListener
109109
public final HealthTagsHack healthTagsHack = new HealthTagsHack();
110110
public final HighJumpHack highJumpHack = new HighJumpHack();
111111
public final InfiniChatHack infiniChatHack = new InfiniChatHack();
112+
public final InstaBuildHack instaBuildHack = new InstaBuildHack();
112113
public final InstantBunkerHack instantBunkerHack = new InstantBunkerHack();
113114
public final InvWalkHack invWalkHack = new InvWalkHack();
114115
public final ItemEspHack itemEspHack = new ItemEspHack();

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

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@
99

1010
import java.io.IOException;
1111
import java.nio.file.Path;
12-
import java.util.LinkedHashSet;
12+
import java.util.LinkedHashMap;
1313
import java.util.List;
14+
import java.util.Map;
1415

1516
import net.minecraft.client.util.math.MatrixStack;
17+
import net.minecraft.entity.player.PlayerInventory;
18+
import net.minecraft.item.Item;
19+
import net.minecraft.item.ItemStack;
20+
import net.minecraft.item.Items;
1621
import net.minecraft.util.hit.BlockHitResult;
1722
import net.minecraft.util.hit.HitResult;
1823
import net.minecraft.util.math.BlockPos;
@@ -28,7 +33,6 @@
2833
import net.wurstclient.settings.FileSetting;
2934
import net.wurstclient.settings.SliderSetting;
3035
import net.wurstclient.settings.SliderSetting.ValueDisplay;
31-
import net.wurstclient.settings.SwingHandSetting.SwingHand;
3236
import net.wurstclient.util.*;
3337
import net.wurstclient.util.BlockPlacer.BlockPlacingParams;
3438
import net.wurstclient.util.json.JsonException;
@@ -55,18 +59,27 @@ public final class AutoBuildHack extends Hack
5559
"Makes sure that you don't reach through walls when placing blocks. Can help with AntiCheat plugins but slows down building.",
5660
false);
5761

58-
private final CheckboxSetting instaBuild = new CheckboxSetting("InstaBuild",
59-
"Builds small templates (<= 64 blocks) instantly.\n"
60-
+ "For best results, stand close to the block you're placing.",
62+
private final CheckboxSetting useSavedBlocks = new CheckboxSetting(
63+
"Use saved blocks",
64+
"Tries to place the same blocks that were saved in the template.\n\n"
65+
+ "If the template does not specify block types, it will be built"
66+
+ " from whatever block you are holding.",
6167
true);
6268

6369
private final CheckboxSetting fastPlace =
6470
new CheckboxSetting("Always FastPlace",
6571
"Builds as if FastPlace was enabled, even if it's not.", true);
6672

73+
private final CheckboxSetting strictBuildOrder = new CheckboxSetting(
74+
"Strict build order",
75+
"Places blocks in exactly the same order that they appear in the"
76+
+ " template. This is slower, but provides more consistent results.",
77+
false);
78+
6779
private Status status = Status.NO_TEMPLATE;
6880
private AutoBuildTemplate template;
69-
private LinkedHashSet<BlockPos> remainingBlocks = new LinkedHashSet<>();
81+
private LinkedHashMap<BlockPos, Item> remainingBlocks =
82+
new LinkedHashMap<>();
7083

7184
public AutoBuildHack()
7285
{
@@ -75,8 +88,9 @@ public AutoBuildHack()
7588
addSetting(templateSetting);
7689
addSetting(range);
7790
addSetting(checkLOS);
78-
addSetting(instaBuild);
91+
addSetting(useSavedBlocks);
7992
addSetting(fastPlace);
93+
addSetting(strictBuildOrder);
8094
}
8195

8296
@Override
@@ -111,6 +125,7 @@ public String getRenderName()
111125
@Override
112126
protected void onEnable()
113127
{
128+
WURST.getHax().instaBuildHack.setEnabled(false);
114129
WURST.getHax().templateToolHack.setEnabled(false);
115130

116131
EVENTS.add(UpdateListener.class, this);
@@ -150,12 +165,9 @@ public void onRightClick(RightClickEvent event)
150165

151166
BlockPos startPos = hitResultPos.offset(blockHitResult.getSide());
152167
Direction direction = MC.player.getHorizontalFacing();
153-
remainingBlocks = template.getPositions(startPos, direction);
168+
remainingBlocks = template.getBlocksToPlace(startPos, direction);
154169

155-
if(instaBuild.isChecked() && template.size() <= 64)
156-
buildInstantly();
157-
else
158-
status = Status.BUILDING;
170+
status = Status.BUILDING;
159171
}
160172

161173
@Override
@@ -187,7 +199,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks)
187199
if(status != Status.BUILDING)
188200
return;
189201

190-
List<BlockPos> blocksToDraw = remainingBlocks.stream()
202+
List<BlockPos> blocksToDraw = remainingBlocks.keySet().stream()
191203
.filter(pos -> BlockUtils.getState(pos).isReplaceable()).limit(1024)
192204
.toList();
193205

@@ -207,7 +219,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks)
207219

208220
private void buildNormally()
209221
{
210-
remainingBlocks
222+
remainingBlocks.keySet()
211223
.removeIf(pos -> !BlockUtils.getState(pos).isReplaceable());
212224

213225
if(remainingBlocks.isEmpty())
@@ -220,40 +232,49 @@ private void buildNormally()
220232
return;
221233

222234
double rangeSq = range.getValueSq();
223-
for(BlockPos pos : remainingBlocks)
235+
for(Map.Entry<BlockPos, Item> entry : remainingBlocks.entrySet())
224236
{
237+
BlockPos pos = entry.getKey();
238+
Item item = entry.getValue();
239+
225240
BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(pos);
226-
if(params == null || params.distanceSq() > rangeSq)
227-
continue;
228-
if(checkLOS.isChecked() && !params.lineOfSight())
229-
continue;
241+
if(params == null || params.distanceSq() > rangeSq
242+
|| checkLOS.isChecked() && !params.lineOfSight())
243+
if(strictBuildOrder.isChecked())
244+
return;
245+
else
246+
continue;
247+
248+
if(useSavedBlocks.isChecked() && item != Items.AIR
249+
&& !MC.player.getMainHandStack().isOf(item))
250+
{
251+
giveOrSelectItem(item);
252+
return;
253+
}
230254

231255
MC.itemUseCooldown = 4;
232256
RotationUtils.getNeededRotations(params.hitVec())
233257
.sendPlayerLookPacket();
234258
InteractionSimulator.rightClickBlock(params.toHitResult());
235-
break;
259+
return;
236260
}
237261
}
238262

239-
private void buildInstantly()
263+
private void giveOrSelectItem(Item item)
240264
{
241-
double rangeSq = range.getValueSq();
265+
if(InventoryUtils.selectItem(item, 36, true))
266+
return;
242267

243-
for(BlockPos pos : remainingBlocks)
244-
{
245-
if(!BlockUtils.getState(pos).isReplaceable())
246-
continue;
247-
248-
BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(pos);
249-
if(params == null || params.distanceSq() > rangeSq)
250-
continue;
251-
252-
InteractionSimulator.rightClickBlock(params.toHitResult(),
253-
SwingHand.OFF);
254-
}
268+
if(!MC.player.isInCreativeMode())
269+
return;
255270

256-
remainingBlocks.clear();
271+
PlayerInventory inventory = MC.player.getInventory();
272+
int slot = inventory.getEmptySlot();
273+
if(slot < 0)
274+
slot = inventory.getSelectedSlot();
275+
276+
ItemStack stack = new ItemStack(item);
277+
InventoryUtils.setCreativeStack(slot, stack);
257278
}
258279

259280
private void loadSelectedTemplate()

0 commit comments

Comments
 (0)