0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-19 17:02:13 +02:00

Merge tag 'v7.42' into 24w20a

This commit is contained in:
Alexander01998 2024-05-17 16:53:28 +02:00
commit 65b0032a5c
74 changed files with 967 additions and 635 deletions

View File

@ -125,6 +125,7 @@ task github(dependsOn: moveDevLibs) {
def ghRelease = repository.getReleaseByTagName(ghVersion as String)
if(ghRelease == null) {
def releaseBuilder = new GHReleaseBuilder(repository, ghVersion as String)
releaseBuilder.prerelease(ghVersion.contains("pre"))
ghRelease = releaseBuilder.create()
}

View File

@ -4,16 +4,16 @@ org.gradle.parallel=true
# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://www.curseforge.com/minecraft/mc-mods/fabric-api
# https://modrinth.com/mod/fabric-api/versions
minecraft_version=24w20a
yarn_mappings=24w20a+build.3
loader_version=0.15.11
#Fabric api
# Fabric API
fabric_version=0.98.2+1.21
# Mod Properties
mod_version = v7.41.2-MC24w20a
mod_version = v7.42-MC24w20a
maven_group = net.wurstclient
archives_base_name = Wurst-Client

View File

@ -58,7 +58,7 @@ public enum WurstClient
public static MinecraftClient MC;
public static IMinecraftClient IMC;
public static final String VERSION = "7.41.2";
public static final String VERSION = "7.42";
public static final String MC_VERSION = "24w20a";
private WurstAnalytics analytics;

View File

@ -77,6 +77,6 @@ public abstract class PathProcessor
{
// reset keys
for(KeyBinding key : CONTROLS)
((IKeyBinding)key).resetPressedState();
IKeyBinding.get(key).resetPressedState();
}
}

View File

@ -48,6 +48,11 @@ public final class AimAssistHack extends Hack
private final CheckboxSetting checkLOS = new CheckboxSetting(
"Check line of sight", "Won't aim at entities behind blocks.", true);
private final CheckboxSetting aimWhileBlocking = new CheckboxSetting(
"Aim while blocking", "Keeps aiming at entities while you're blocking"
+ " with a shield or using items.",
false);
private final EntityFilterList entityFilters =
new EntityFilterList(FilterPlayersSetting.genericCombat(false),
FilterSleepingSetting.genericCombat(false),
@ -90,6 +95,7 @@ public final class AimAssistHack extends Hack
addSetting(rotationSpeed);
addSetting(fov);
addSetting(checkLOS);
addSetting(aimWhileBlocking);
entityFilters.forEach(this::addSetting);
}
@ -123,10 +129,15 @@ public final class AimAssistHack extends Hack
@Override
public void onUpdate()
{
target = null;
// don't aim when a container/inventory screen is open
if(MC.currentScreen instanceof HandledScreen)
return;
if(!aimWhileBlocking.isChecked() && MC.player.isUsingItem())
return;
Stream<Entity> stream = EntityUtils.getAttackableEntities();
double rangeSq = Math.pow(range.getValue(), 2);
stream = stream.filter(e -> MC.player.squaredDistanceTo(e) <= rangeSq);

View File

@ -35,6 +35,8 @@ import net.wurstclient.settings.FacingSetting;
import net.wurstclient.settings.FacingSetting.Facing;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.AnchorAuraFilterList;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.BlockUtils;
@ -69,6 +71,11 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
+ "Slower but can help with anti-cheat plugins.",
false);
private final SwingHandSetting swingHand = new SwingHandSetting(
"How AnchorAura should swing your hand when placing, charging and"
+ " detonating respawn anchors.",
SwingHand.CLIENT);
private final EnumSetting<TakeItemsFrom> takeItemsFrom = new EnumSetting<>(
"Take items from", "Where to look for respawn anchors and glowstone.",
TakeItemsFrom.values(), TakeItemsFrom.INVENTORY);
@ -85,6 +92,7 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
addSetting(autoPlace);
addSetting(faceBlocks);
addSetting(checkLOS);
addSetting(swingHand);
addSetting(takeItemsFrom);
entityFilters.forEach(this::addSetting);
@ -174,7 +182,7 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
}
if(shouldSwing)
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
return newAnchors;
}
@ -196,7 +204,7 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
shouldSwing = true;
if(shouldSwing)
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
}
private void charge(ArrayList<BlockPos> unchargedAnchors)
@ -216,7 +224,7 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
shouldSwing = true;
if(shouldSwing)
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
}
private boolean rightClickBlock(BlockPos pos)

View File

@ -28,13 +28,39 @@ import net.wurstclient.hack.DontSaveState;
import net.wurstclient.hack.Hack;
import net.wurstclient.mixinterface.IKeyBinding;
import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
@SearchTags({"anti afk", "AFKBot", "afk bot"})
@DontSaveState
public final class AntiAfkHack extends Hack
implements UpdateListener, RenderListener
{
private final CheckboxSetting useAi = new CheckboxSetting("Use AI", true);
private final CheckboxSetting useAi = new CheckboxSetting("Use AI",
"Uses a pathfinding AI to move around naturally and avoid hazards.\n"
+ "Can sometimes get stuck.",
true);
private final SliderSetting aiRange = new SliderSetting("AI range",
"The area in which AntiAFK can move when Use AI is turned on.", 16, 1,
64, 1, ValueDisplay.AREA_FROM_RADIUS);
private final SliderSetting nonAiRange = new SliderSetting("Non-AI range",
"The area in which AntiAFK can move when Use AI is turned off.\n\n"
+ "\u00a7c\u00a7lWARNING:\u00a7r This area must be completely"
+ " unobstructed and free of hazards.",
1, 1, 64, 1, ValueDisplay.AREA_FROM_RADIUS);
private final SliderSetting waitTime =
new SliderSetting("Wait time", "Time between movements in seconds.",
2.5, 0, 60, 0.05, ValueDisplay.DECIMAL.withSuffix("s"));
private final SliderSetting waitTimeRand =
new SliderSetting("Wait time randomization",
"How much time can be randomly added or subtracted from the wait"
+ " time, in seconds.",
0.5, 0, 60, 0.05,
ValueDisplay.DECIMAL.withPrefix("\u00b1").withSuffix("s"));
private int timer;
private Random random = new Random();
@ -51,6 +77,10 @@ public final class AntiAfkHack extends Hack
setCategory(Category.OTHER);
addSetting(useAi);
addSetting(aiRange);
addSetting(nonAiRange);
addSetting(waitTime);
addSetting(waitTimeRand);
}
@Override
@ -58,7 +88,8 @@ public final class AntiAfkHack extends Hack
{
start = BlockPos.ofFloored(MC.player.getPos());
nextBlock = null;
pathFinder = new RandomPathFinder(start);
pathFinder =
new RandomPathFinder(randomize(start, aiRange.getValueI(), true));
creativeFlying = MC.player.getAbilities().flying;
WURST.getHax().autoFishHack.setEnabled(false);
@ -73,14 +104,23 @@ public final class AntiAfkHack extends Hack
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(RenderListener.class, this);
((IKeyBinding)MC.options.forwardKey).resetPressedState();
((IKeyBinding)MC.options.jumpKey).resetPressedState();
IKeyBinding.get(MC.options.forwardKey).resetPressedState();
IKeyBinding.get(MC.options.jumpKey).resetPressedState();
pathFinder = null;
processor = null;
PathProcessor.releaseControls();
}
private void setTimer()
{
int baseTime = (int)(waitTime.getValue() * 20);
int randTime = (int)(waitTimeRand.getValue() * 20);
int randOffset = random.nextInt(randTime * 2 + 1) - randTime;
randOffset = Math.max(randOffset, -baseTime);
timer = baseTime + randOffset;
}
@Override
public void onUpdate()
{
@ -132,22 +172,22 @@ public final class AntiAfkHack extends Hack
if(!processor.isDone())
processor.process();
else
pathFinder = new RandomPathFinder(start);
pathFinder = new RandomPathFinder(
randomize(start, aiRange.getValueI(), true));
// wait 2 - 3 seconds (40 - 60 ticks)
if(processor.isDone())
{
PathProcessor.releaseControls();
timer = 40 + random.nextInt(21);
setTimer();
}
}else
{
// set next block
if(timer <= 0 || nextBlock == null)
{
nextBlock =
start.add(random.nextInt(3) - 1, 0, random.nextInt(3) - 1);
timer = 40 + random.nextInt(21);
nextBlock = randomize(start, nonAiRange.getValueI(), false);
setTimer();
}
// face block
@ -181,12 +221,19 @@ public final class AntiAfkHack extends Hack
pathCmd.isDepthTest());
}
private BlockPos randomize(BlockPos pos, int range, boolean includeY)
{
int x = random.nextInt(2 * range + 1) - range;
int y = includeY ? random.nextInt(2 * range + 1) - range : 0;
int z = random.nextInt(2 * range + 1) - range;
return pos.add(x, y, z);
}
private class RandomPathFinder extends PathFinder
{
public RandomPathFinder(BlockPos goal)
{
super(goal.add(random.nextInt(33) - 16, random.nextInt(33) - 16,
random.nextInt(33) - 16));
super(goal);
setThinkTime(10);
setFallingAllowed(false);
setDivingAllowed(false);

View File

@ -17,10 +17,8 @@ import net.wurstclient.SearchTags;
import net.wurstclient.events.ChatOutputListener;
import net.wurstclient.events.UpdateListener;
import net.wurstclient.hack.Hack;
import net.wurstclient.hacks.autocomplete.ApiProviderSetting;
import net.wurstclient.hacks.autocomplete.MessageCompleter;
import net.wurstclient.hacks.autocomplete.ModelSettings;
import net.wurstclient.hacks.autocomplete.OobaboogaMessageCompleter;
import net.wurstclient.hacks.autocomplete.OpenAiMessageCompleter;
import net.wurstclient.hacks.autocomplete.SuggestionHandler;
import net.wurstclient.util.ChatUtils;
@ -32,7 +30,6 @@ public final class AutoCompleteHack extends Hack
{
private final ModelSettings modelSettings = new ModelSettings();
private final SuggestionHandler suggestionHandler = new SuggestionHandler();
private final ApiProviderSetting apiProvider = new ApiProviderSetting();
private MessageCompleter completer;
private String draftMessage;
@ -47,7 +44,6 @@ public final class AutoCompleteHack extends Hack
super("AutoComplete");
setCategory(Category.CHAT);
addSetting(apiProvider);
modelSettings.forEach(this::addSetting);
suggestionHandler.getSettings().forEach(this::addSetting);
}
@ -55,11 +51,7 @@ public final class AutoCompleteHack extends Hack
@Override
protected void onEnable()
{
completer = switch(apiProvider.getSelected())
{
case OPENAI -> new OpenAiMessageCompleter(modelSettings);
case OOBABOOGA -> new OobaboogaMessageCompleter(modelSettings);
};
completer = new OpenAiMessageCompleter(modelSettings);
if(completer instanceof OpenAiMessageCompleter
&& System.getenv("WURST_OPENAI_KEY") == null)
@ -117,7 +109,9 @@ public final class AutoCompleteHack extends Hack
return;
// check if we already have a suggestion for the current draft message
if(suggestionHandler.hasEnoughSuggestionFor(draftMessage))
int maxSuggestions =
suggestionHandler.getMaxSuggestionsFor(draftMessage);
if(maxSuggestions < 1)
return;
// copy fields to local variables, in case they change
@ -129,14 +123,21 @@ public final class AutoCompleteHack extends Hack
// build thread
apiCallThread = new Thread(() -> {
// get suggestion
String suggestion = completer.completeChatMessage(draftMessage2);
if(suggestion.isEmpty())
// get suggestions
String[] suggestions =
completer.completeChatMessage(draftMessage2, maxSuggestions);
if(suggestions.length < 1)
return;
// apply suggestion
suggestionHandler.addSuggestion(suggestion, draftMessage2,
suggestionsUpdater2);
for(String suggestion : suggestions)
{
if(suggestion.isEmpty())
continue;
// apply suggestion
suggestionHandler.addSuggestion(suggestion, draftMessage2,
suggestionsUpdater2);
}
});
apiCallThread.setName("AutoComplete API Call");
apiCallThread.setPriority(Thread.MIN_PRIORITY);

View File

@ -110,6 +110,7 @@ public final class AutoEatHack extends Hack implements UpdateListener
@Override
protected void onEnable()
{
WURST.getHax().autoSoupHack.setEnabled(false);
EVENTS.add(UpdateListener.class, this);
}

View File

@ -338,7 +338,8 @@ public final class AutoLibrarianHack extends Hack
? Hand.MAIN_HAND : Hand.OFF_HAND;
// sneak-place to avoid activating trapdoors/chests/etc.
MC.options.sneakKey.setPressed(true);
IKeyBinding sneakKey = IKeyBinding.get(MC.options.sneakKey);
sneakKey.setPressed(true);
if(!MC.player.isSneaking())
return;
@ -346,7 +347,7 @@ public final class AutoLibrarianHack extends Hack
BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(jobSite);
if(params == null)
{
((IKeyBinding)MC.options.sneakKey).resetPressedState();
sneakKey.resetPressedState();
return;
}
@ -362,7 +363,7 @@ public final class AutoLibrarianHack extends Hack
swingHand.swing(hand);
// reset sneak
((IKeyBinding)MC.options.sneakKey).resetPressedState();
sneakKey.resetPressedState();
}
private void openTradeScreen()

View File

@ -49,6 +49,7 @@ public final class AutoSoupHack extends Hack implements UpdateListener
@Override
protected void onEnable()
{
WURST.getHax().autoEatHack.setEnabled(false);
EVENTS.add(UpdateListener.class, this);
}

View File

@ -32,7 +32,7 @@ public final class AutoWalkHack extends Hack implements UpdateListener
protected void onDisable()
{
EVENTS.remove(UpdateListener.class, this);
((IKeyBinding)MC.options.forwardKey).resetPressedState();
IKeyBinding.get(MC.options.forwardKey).resetPressedState();
}
@Override

View File

@ -9,31 +9,33 @@ package net.wurstclient.hacks;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import net.minecraft.block.*;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.UpdateListener;
import net.wurstclient.events.PostMotionListener;
import net.wurstclient.hack.Hack;
import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.EnumSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.util.BlockBreaker;
import net.wurstclient.util.BlockBreaker.BlockBreakingParams;
import net.wurstclient.util.BlockUtils;
import net.wurstclient.util.InteractionSimulator;
import net.wurstclient.util.InventoryUtils;
import net.wurstclient.util.RotationUtils;
@SearchTags({"bonemeal aura", "bone meal aura", "AutoBone", "auto bone"})
public final class BonemealAuraHack extends Hack implements UpdateListener
@SearchTags({"bonemeal aura", "bone meal aura", "AutoBonemeal", "auto bonemeal",
"auto bone meal", "fertilizer"})
public final class BonemealAuraHack extends Hack implements PostMotionListener
{
private final SliderSetting range =
new SliderSetting("Range", 4.25, 1, 6, 0.05, ValueDisplay.DECIMAL);
@ -53,22 +55,24 @@ public final class BonemealAuraHack extends Hack implements UpdateListener
private final CheckboxSetting saplings =
new CheckboxSetting("Saplings", true);
private final CheckboxSetting crops = new CheckboxSetting("Crops",
"Wheat, carrots, potatoes and beetroots.", true);
private final CheckboxSetting stems =
new CheckboxSetting("Stems", "Pumpkins and melons.", true);
private final CheckboxSetting cocoa = new CheckboxSetting("Cocoa", true);
private final CheckboxSetting other = new CheckboxSetting("Other", false);
public BonemealAuraHack()
{
super("BonemealAura");
setCategory(Category.BLOCKS);
addSetting(range);
addSetting(mode);
addSetting(automationLevel);
addSetting(saplings);
addSetting(crops);
addSetting(stems);
@ -79,25 +83,24 @@ public final class BonemealAuraHack extends Hack implements UpdateListener
@Override
protected void onEnable()
{
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PostMotionListener.class, this);
}
@Override
protected void onDisable()
{
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(PostMotionListener.class, this);
}
@Override
public void onUpdate()
public void onPostMotion()
{
// wait for right click timer
if(MC.itemUseCooldown > 0)
return;
// get valid blocks
ArrayList<BlockPos> validBlocks =
getValidBlocks(range.getValue(), this::isCorrectBlock);
ArrayList<BlockPos> validBlocks = getValidBlocks();
if(validBlocks.isEmpty())
return;
@ -107,10 +110,10 @@ public final class BonemealAuraHack extends Hack implements UpdateListener
return;
// check held item
ItemStack stack = MC.player.getInventory().getMainHandStack();
if(stack.isEmpty() || stack.getItem() != Items.BONE_MEAL)
if(!MC.player.isHolding(Items.BONE_MEAL))
{
selectBonemeal();
InventoryUtils.selectItem(Items.BONE_MEAL,
automationLevel.getSelected().maxInvSlot);
return;
}
@ -140,59 +143,23 @@ public final class BonemealAuraHack extends Hack implements UpdateListener
}
}
private void selectBonemeal()
private ArrayList<BlockPos> getValidBlocks()
{
ClientPlayerEntity player = MC.player;
int maxInvSlot = automationLevel.getSelected().maxInvSlot;
Vec3d eyesVec = RotationUtils.getEyesPos();
BlockPos eyesBlock = BlockPos.ofFloored(eyesVec);
double rangeSq = range.getValueSq();
int blockRange = range.getValueCeil();
for(int slot = 0; slot < maxInvSlot; slot++)
{
if(slot == player.getInventory().selectedSlot)
continue;
ItemStack stack = player.getInventory().getStack(slot);
if(stack.isEmpty() || stack.getItem() != Items.BONE_MEAL)
continue;
if(slot < 9)
player.getInventory().selectedSlot = slot;
else if(player.getInventory().getEmptySlot() < 9)
IMC.getInteractionManager().windowClick_QUICK_MOVE(slot);
else if(player.getInventory().getEmptySlot() != -1)
{
IMC.getInteractionManager().windowClick_QUICK_MOVE(
player.getInventory().selectedSlot + 36);
IMC.getInteractionManager().windowClick_QUICK_MOVE(slot);
}else
{
IMC.getInteractionManager().windowClick_PICKUP(
player.getInventory().selectedSlot + 36);
IMC.getInteractionManager().windowClick_PICKUP(slot);
IMC.getInteractionManager().windowClick_PICKUP(
player.getInventory().selectedSlot + 36);
}
return;
}
}
private ArrayList<BlockPos> getValidBlocks(double range,
Predicate<BlockPos> validator)
{
Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5);
double rangeSq = Math.pow(range + 0.5, 2);
int rangeI = (int)Math.ceil(range);
// As plants are bone-mealed, they will grow larger and prevent line of
// sight to other plants behind them. That's why we need to bone-meal
// the farthest plants first.
Comparator<BlockPos> farthestFirst = Comparator
.comparingDouble((BlockPos pos) -> pos.getSquaredDistance(eyesVec))
.reversed();
BlockPos center = BlockPos.ofFloored(RotationUtils.getEyesPos());
BlockPos min = center.add(-rangeI, -rangeI, -rangeI);
BlockPos max = center.add(rangeI, rangeI, rangeI);
Comparator<BlockPos> c = Comparator.<BlockPos> comparingDouble(
pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos))).reversed();
return BlockUtils.getAllInBox(min, max).stream()
.filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq)
.filter(validator).sorted(c)
return BlockUtils.getAllInBoxStream(eyesBlock, blockRange)
.filter(pos -> pos.getSquaredDistance(eyesVec) <= rangeSq)
.filter(this::isCorrectBlock).sorted(farthestFirst)
.collect(Collectors.toCollection(ArrayList::new));
}
@ -202,95 +169,67 @@ public final class BonemealAuraHack extends Hack implements UpdateListener
BlockState state = BlockUtils.getState(pos);
ClientWorld world = MC.world;
if(!(block instanceof Fertilizable) || block instanceof GrassBlock
|| !((Fertilizable)block).canGrow(world, MC.world.random, pos,
state))
if(!(block instanceof Fertilizable fBlock)
|| !fBlock.canGrow(world, world.random, pos, state))
return false;
if(block instanceof SaplingBlock
&& ((SaplingBlock)block).isFertilizable(world, pos, state))
if(block instanceof GrassBlock)
return false;
if(block instanceof SaplingBlock sapling
&& sapling.isFertilizable(world, pos, state))
return saplings.isChecked();
if(block instanceof CropBlock
&& ((CropBlock)block).isFertilizable(world, pos, state))
if(block instanceof CropBlock crop
&& crop.isFertilizable(world, pos, state))
return crops.isChecked();
if(block instanceof StemBlock
&& ((StemBlock)block).isFertilizable(world, pos, state))
if(block instanceof StemBlock stem
&& stem.isFertilizable(world, pos, state))
return stems.isChecked();
if(block instanceof CocoaBlock
&& ((CocoaBlock)block).isFertilizable(world, pos, state))
if(block instanceof CocoaBlock cocoaBlock
&& cocoaBlock.isFertilizable(world, pos, state))
return cocoa.isChecked();
return other.isChecked();
}
private boolean rightClickBlockLegit(BlockPos pos)
{
Vec3d eyesPos = RotationUtils.getEyesPos();
Vec3d posVec = Vec3d.ofCenter(pos);
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
for(Direction side : Direction.values())
{
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
// check if hitVec is within range (4.25 blocks)
if(distanceSqHitVec > 18.0625)
continue;
// check if side is facing towards player
if(distanceSqHitVec >= distanceSqPosVec)
continue;
// check line of sight
if(!BlockUtils.hasLineOfSight(eyesPos, hitVec))
continue;
// face block
WURST.getRotationFaker().faceVectorPacket(hitVec);
// place block
IMC.getInteractionManager().rightClickBlock(pos, side, hitVec);
MC.player.swingHand(Hand.MAIN_HAND);
MC.itemUseCooldown = 4;
// if breaking or riding, stop and don't try other blocks
if(MC.interactionManager.isBreakingBlock() || MC.player.isRiding())
return true;
}
return false;
// if this block is unreachable, try the next one
BlockBreakingParams params = BlockBreaker.getBlockBreakingParams(pos);
if(params == null || params.distanceSq() > range.getValueSq()
|| !params.lineOfSight())
return false;
// face and right click the block
MC.itemUseCooldown = 4;
WURST.getRotationFaker().faceVectorPacket(params.hitVec());
InteractionSimulator.rightClickBlock(params.toHitResult());
return true;
}
private boolean rightClickBlockSimple(BlockPos pos)
{
Vec3d eyesPos = RotationUtils.getEyesPos();
Vec3d posVec = Vec3d.ofCenter(pos);
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
// if this block is unreachable, try the next one
BlockBreakingParams params = BlockBreaker.getBlockBreakingParams(pos);
if(params == null)
return false;
for(Direction side : Direction.values())
{
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
// check if hitVec is within range (6 blocks)
if(distanceSqHitVec > 36)
continue;
// check if side is facing towards player
if(distanceSqHitVec >= distanceSqPosVec)
continue;
// place block
IMC.getInteractionManager().rightClickBlock(pos, side, hitVec);
return true;
}
return false;
// right click the block
InteractionSimulator.rightClickBlock(params.toHitResult(),
SwingHand.OFF);
return true;
}
private enum Mode
{
FAST("Fast"),
LEGIT("Legit");
private final String name;
@ -310,9 +249,7 @@ public final class BonemealAuraHack extends Hack implements UpdateListener
private enum AutomationLevel
{
RIGHT_CLICK("Right Click", 0),
HOTBAR("Hotbar", 9),
INVENTORY("Inventory", 36);
private final String name;

View File

@ -124,9 +124,9 @@ public final class CreativeFlightHack extends Hack implements UpdateListener
private void restoreKeyPresses()
{
KeyBinding[] bindings = {MC.options.jumpKey, MC.options.sneakKey};
KeyBinding[] keys = {MC.options.jumpKey, MC.options.sneakKey};
for(KeyBinding binding : bindings)
((IKeyBinding)binding).resetPressedState();
for(KeyBinding key : keys)
IKeyBinding.get(key).resetPressedState();
}
}

View File

@ -35,6 +35,8 @@ import net.wurstclient.settings.FacingSetting;
import net.wurstclient.settings.FacingSetting.Facing;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.CrystalAuraFilterList;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.BlockUtils;
@ -68,6 +70,11 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
+ "Slower but can help with anti-cheat plugins.",
false);
private final SwingHandSetting swingHand = new SwingHandSetting(
"How CrystalAura should swing your hand when placing and detonating"
+ " end crystals.",
SwingHand.CLIENT);
private final EnumSetting<TakeItemsFrom> takeItemsFrom =
new EnumSetting<>("Take items from", "Where to look for end crystals.",
TakeItemsFrom.values(), TakeItemsFrom.INVENTORY);
@ -84,6 +91,7 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
addSetting(autoPlace);
addSetting(faceBlocks);
addSetting(checkLOS);
addSetting(swingHand);
addSetting(takeItemsFrom);
entityFilters.forEach(this::addSetting);
@ -155,7 +163,7 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
}
if(shouldSwing)
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
return newCrystals;
}
@ -169,7 +177,7 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
}
if(!crystals.isEmpty())
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
}
private boolean placeCrystal(BlockPos pos)

View File

@ -100,6 +100,10 @@ public final class FastBreakHack extends Hack
fastBreakBlock = random.nextDouble() <= activationChance.getValue();
}
// Ignore unbreakable blocks to avoid slowdown issue
if(MC.world.getBlockState(blockPos).getBlock().getHardness() < 0)
return;
if(!fastBreakBlock)
return;

View File

@ -67,8 +67,9 @@ public final class FeedAuraHack extends Hack
private final CheckboxSetting filterHorses = new CheckboxSetting(
"Filter horse-like animals",
"Won't feed horses, llamas, donkeys, etc.\n"
+ "Recommended due to Minecraft bug MC-233276, which causes these animals to consume items indefinitely.",
true);
+ "Recommended in Minecraft versions before 1.20.3 due to MC-233276,"
+ "which causes these animals to consume items indefinitely.",
false);
private final Random random = new Random();
private AnimalEntity target;

View File

@ -34,6 +34,8 @@ import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.PauseAttackOnContainersSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.EntityUtils;
@ -48,6 +50,10 @@ public final class FightBotHack extends Hack
private final AttackSpeedSliderSetting speed =
new AttackSpeedSliderSetting();
private final SwingHandSetting swingHand = new SwingHandSetting(
"How FightBot should swing your hand when attacking.",
SwingHand.CLIENT);
private final SliderSetting distance = new SliderSetting("Distance",
"How closely to follow the target.\n"
+ "This should be set to a lower value than Range.",
@ -73,6 +79,7 @@ public final class FightBotHack extends Hack
setCategory(Category.COMBAT);
addSetting(range);
addSetting(speed);
addSetting(swingHand);
addSetting(distance);
addSetting(useAi);
addSetting(pauseOnContainers);
@ -211,7 +218,7 @@ public final class FightBotHack extends Hack
// attack entity
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(MC.player, entity);
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
speed.resetTimer();
}

View File

@ -83,12 +83,12 @@ public final class FreecamHack extends Hack implements UpdateListener,
fakePlayer = new FakePlayerEntity();
GameOptions gs = MC.options;
KeyBinding[] bindings = {gs.forwardKey, gs.backKey, gs.leftKey,
gs.rightKey, gs.jumpKey, gs.sneakKey};
GameOptions opt = MC.options;
KeyBinding[] bindings = {opt.forwardKey, opt.backKey, opt.leftKey,
opt.rightKey, opt.jumpKey, opt.sneakKey};
for(KeyBinding binding : bindings)
((IKeyBinding)binding).resetPressedState();
IKeyBinding.get(binding).resetPressedState();
}
@Override

View File

@ -93,7 +93,7 @@ public final class InvWalkHack extends Hack implements UpdateListener
keys.add(MC.options.jumpKey);
for(KeyBinding key : keys)
((IKeyBinding)key).resetPressedState();
IKeyBinding.get(key).resetPressedState();
}
private boolean isAllowedScreen(Screen screen)

View File

@ -15,7 +15,6 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
@ -36,6 +35,8 @@ import net.wurstclient.settings.EnumSetting;
import net.wurstclient.settings.PauseAttackOnContainersSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.BlockUtils;
import net.wurstclient.util.EntityUtils;
@ -66,6 +67,10 @@ public final class KillauraHack extends Hack
private final SliderSetting fov =
new SliderSetting("FOV", 360, 30, 360, 10, ValueDisplay.DEGREES);
private final SwingHandSetting swingHand = new SwingHandSetting(
"How Killaura should swing your hand when attacking.",
SwingHand.CLIENT);
private final CheckboxSetting damageIndicator = new CheckboxSetting(
"Damage indicator",
"Renders a colored box within the target, inversely proportional to its remaining health.",
@ -95,6 +100,7 @@ public final class KillauraHack extends Hack
addSetting(speed);
addSetting(priority);
addSetting(fov);
addSetting(swingHand);
addSetting(damageIndicator);
addSetting(pauseOnContainers);
addSetting(checkLOS);
@ -177,9 +183,8 @@ public final class KillauraHack extends Hack
return;
WURST.getHax().criticalsHack.doCritical();
ClientPlayerEntity player = MC.player;
MC.interactionManager.attackEntity(player, target);
player.swingHand(Hand.MAIN_HAND);
MC.interactionManager.attackEntity(MC.player, target);
swingHand.swing(Hand.MAIN_HAND);
target = null;
speed.resetTimer();

View File

@ -16,7 +16,6 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
@ -35,6 +34,8 @@ import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.EnumSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.settings.filters.*;
import net.wurstclient.util.BlockUtils;
@ -69,6 +70,11 @@ public final class KillauraLegitHack extends Hack
+ "360\u00b0 = entities can be attacked all around you.",
360, 30, 360, 10, ValueDisplay.DEGREES);
private final SwingHandSetting swingHand =
SwingHandSetting.withoutOffOption(
"How KillauraLegit should swing your hand when attacking.",
SwingHand.CLIENT);
private final CheckboxSetting damageIndicator = new CheckboxSetting(
"Damage indicator",
"Renders a colored box within the target, inversely proportional to its remaining health.",
@ -119,6 +125,7 @@ public final class KillauraLegitHack extends Hack
addSetting(rotationSpeed);
addSetting(priority);
addSetting(fov);
addSetting(swingHand);
addSetting(damageIndicator);
entityFilters.forEach(this::addSetting);
@ -162,8 +169,6 @@ public final class KillauraLegitHack extends Hack
if(MC.currentScreen instanceof HandledScreen)
return;
ClientPlayerEntity player = MC.player;
Stream<Entity> stream = EntityUtils.getAttackableEntities();
double rangeSq = Math.pow(range.getValue(), 2);
stream = stream.filter(e -> MC.player.squaredDistanceTo(e) <= rangeSq);
@ -193,8 +198,8 @@ public final class KillauraLegitHack extends Hack
// attack entity
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(player, target);
player.swingHand(Hand.MAIN_HAND);
MC.interactionManager.attackEntity(MC.player, target);
swingHand.swing(Hand.MAIN_HAND);
speed.resetTimer();
}

View File

@ -35,7 +35,7 @@ public final class LsdHack extends Hack
MC.gameRenderer.disablePostProcessor();
MC.gameRenderer
.loadPostProcessor(new Identifier("shaders/post/wobble.json"));
.loadPostProcessor(new Identifier("shaders/post/lsd.json"));
}
@Override

View File

@ -43,7 +43,7 @@ public final class MileyCyrusHack extends Hack implements UpdateListener
protected void onDisable()
{
EVENTS.remove(UpdateListener.class, this);
((IKeyBinding)MC.options.sneakKey).resetPressedState();
IKeyBinding.get(MC.options.sneakKey).resetPressedState();
}
@Override

View File

@ -11,7 +11,6 @@ import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.util.Hand;
import net.wurstclient.Category;
@ -22,6 +21,8 @@ import net.wurstclient.settings.AttackSpeedSliderSetting;
import net.wurstclient.settings.PauseAttackOnContainersSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.EntityUtils;
import net.wurstclient.util.RotationUtils;
@ -38,6 +39,10 @@ public final class MultiAuraHack extends Hack implements UpdateListener
private final SliderSetting fov =
new SliderSetting("FOV", 360, 30, 360, 10, ValueDisplay.DEGREES);
private final SwingHandSetting swingHand = new SwingHandSetting(
"How MultiAura should swing your hand when attacking.",
SwingHand.CLIENT);
private final PauseAttackOnContainersSetting pauseOnContainers =
new PauseAttackOnContainersSetting(false);
@ -52,6 +57,7 @@ public final class MultiAuraHack extends Hack implements UpdateListener
addSetting(range);
addSetting(speed);
addSetting(fov);
addSetting(swingHand);
addSetting(pauseOnContainers);
entityFilters.forEach(this::addSetting);
@ -91,8 +97,6 @@ public final class MultiAuraHack extends Hack implements UpdateListener
if(pauseOnContainers.shouldPause())
return;
ClientPlayerEntity player = MC.player;
// get entities
Stream<Entity> stream = EntityUtils.getAttackableEntities();
double rangeSq = Math.pow(range.getValue(), 2);
@ -119,10 +123,10 @@ public final class MultiAuraHack extends Hack implements UpdateListener
.sendPlayerLookPacket();
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(player, entity);
MC.interactionManager.attackEntity(MC.player, entity);
}
player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
speed.resetTimer();
}
}

View File

@ -30,6 +30,8 @@ import net.wurstclient.hack.Hack;
import net.wurstclient.settings.AttackSpeedSliderSetting;
import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.PauseAttackOnContainersSetting;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.settings.filters.*;
import net.wurstclient.util.EntityUtils;
@ -42,6 +44,9 @@ public final class ProtectHack extends Hack
private final AttackSpeedSliderSetting speed =
new AttackSpeedSliderSetting();
private final SwingHandSetting swingHand = new SwingHandSetting(
"How Protect should swing your hand when attacking.", SwingHand.CLIENT);
private final CheckboxSetting useAi =
new CheckboxSetting("Use AI (experimental)", false);
@ -94,6 +99,7 @@ public final class ProtectHack extends Hack
setCategory(Category.COMBAT);
addSetting(speed);
addSetting(swingHand);
addSetting(useAi);
addSetting(pauseOnContainers);
@ -281,7 +287,7 @@ public final class ProtectHack extends Hack
// attack enemy
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(MC.player, enemy);
MC.player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
speed.resetTimer();
}
}

View File

@ -8,7 +8,6 @@
package net.wurstclient.hacks;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.math.Box;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
@ -18,7 +17,8 @@ import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
@SearchTags({"safe walk"})
@SearchTags({"safe walk", "SneakSafety", "sneak safety", "SpeedBridgeHelper",
"speed bridge helper"})
public final class SafeWalkHack extends Hack
{
private final CheckboxSetting sneak =
@ -78,12 +78,12 @@ public final class SafeWalkHack extends Hack
private void setSneaking(boolean sneaking)
{
KeyBinding sneakKey = MC.options.sneakKey;
IKeyBinding sneakKey = IKeyBinding.get(MC.options.sneakKey);
if(sneaking)
sneakKey.setPressed(true);
else
((IKeyBinding)sneakKey).resetPressedState();
sneakKey.resetPressedState();
this.sneaking = sneaking;
}

View File

@ -8,7 +8,6 @@
package net.wurstclient.hacks;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket.Mode;
import net.wurstclient.Category;
@ -67,8 +66,7 @@ public final class SneakHack extends Hack
switch(mode.getSelected())
{
case LEGIT:
IKeyBinding sneakKey = (IKeyBinding)MC.options.sneakKey;
sneakKey.resetPressedState();
IKeyBinding.get(MC.options.sneakKey).resetPressedState();
break;
case PACKET:
@ -80,19 +78,19 @@ public final class SneakHack extends Hack
@Override
public void onPreMotion()
{
KeyBinding sneakKey = MC.options.sneakKey;
IKeyBinding sneakKey = IKeyBinding.get(MC.options.sneakKey);
switch(mode.getSelected())
{
case LEGIT:
if(offWhileFlying.isChecked() && isFlying())
((IKeyBinding)sneakKey).resetPressedState();
sneakKey.resetPressedState();
else
sneakKey.setPressed(true);
break;
case PACKET:
((IKeyBinding)sneakKey).resetPressedState();
sneakKey.resetPressedState();
sendSneakPacket(Mode.PRESS_SHIFT_KEY);
sendSneakPacket(Mode.RELEASE_SHIFT_KEY);
break;

View File

@ -8,34 +8,34 @@
package net.wurstclient.hacks;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.UpdateListener;
import net.wurstclient.events.PostMotionListener;
import net.wurstclient.hack.Hack;
import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.util.BlockBreaker;
import net.wurstclient.util.BlockBreaker.BlockBreakingParams;
import net.wurstclient.util.BlockUtils;
import net.wurstclient.util.InteractionSimulator;
import net.wurstclient.util.RotationUtils;
@SearchTags({"till aura", "HoeAura", "hoe aura", "FarmlandAura",
"farmland aura", "farm land aura", "AutoTill", "auto till", "AutoHoe",
"auto hoe"})
public final class TillauraHack extends Hack implements UpdateListener
public final class TillauraHack extends Hack implements PostMotionListener
{
private final SliderSetting range = new SliderSetting("Range",
"How far Tillaura will reach to till blocks.", 5, 1, 6, 0.05,
@ -51,7 +51,7 @@ public final class TillauraHack extends Hack implements UpdateListener
+ "Good for NoCheat+ servers, but unnecessary in vanilla.",
true);
private final List<Block> tillableBlocks = Arrays.asList(Blocks.GRASS_BLOCK,
private final List<Block> tillableBlocks = List.of(Blocks.GRASS_BLOCK,
Blocks.DIRT_PATH, Blocks.DIRT, Blocks.COARSE_DIRT);
public TillauraHack()
@ -67,30 +67,32 @@ public final class TillauraHack extends Hack implements UpdateListener
@Override
protected void onEnable()
{
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PostMotionListener.class, this);
}
@Override
protected void onDisable()
{
EVENTS.remove(UpdateListener.class, this);
EVENTS.remove(PostMotionListener.class, this);
}
@Override
public void onUpdate()
public void onPostMotion()
{
// wait for right click timer
if(MC.itemUseCooldown > 0)
return;
// don't till while breaking or riding
if(MC.interactionManager.isBreakingBlock() || MC.player.isRiding())
return;
// check held item
ItemStack stack = MC.player.getInventory().getMainHandStack();
if(stack.isEmpty() || !(stack.getItem() instanceof HoeItem))
if(!MC.player.isHolding(stack -> stack.getItem() instanceof HoeItem))
return;
// get valid blocks
ArrayList<BlockPos> validBlocks =
getValidBlocks(range.getValue(), this::isCorrectBlock);
ArrayList<BlockPos> validBlocks = getValidBlocks();
if(multiTill.isChecked())
{
@ -111,22 +113,18 @@ public final class TillauraHack extends Hack implements UpdateListener
break;
}
private ArrayList<BlockPos> getValidBlocks(double range,
Predicate<BlockPos> validator)
private ArrayList<BlockPos> getValidBlocks()
{
Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5);
double rangeSq = Math.pow(range + 0.5, 2);
int rangeI = (int)Math.ceil(range);
Vec3d eyesVec = RotationUtils.getEyesPos();
BlockPos eyesBlock = BlockPos.ofFloored(eyesVec);
double rangeSq = range.getValueSq();
int blockRange = range.getValueCeil();
BlockPos center = BlockPos.ofFloored(RotationUtils.getEyesPos());
BlockPos min = center.add(-rangeI, -rangeI, -rangeI);
BlockPos max = center.add(rangeI, rangeI, rangeI);
return BlockUtils.getAllInBox(min, max).stream()
.filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq)
.filter(validator)
.sorted(Comparator.comparingDouble(
pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos))))
return BlockUtils.getAllInBoxStream(eyesBlock, blockRange)
.filter(pos -> pos.getSquaredDistance(eyesVec) <= rangeSq)
.filter(this::isCorrectBlock)
.sorted(Comparator
.comparingDouble(pos -> pos.getSquaredDistance(eyesVec)))
.collect(Collectors.toCollection(ArrayList::new));
}
@ -143,69 +141,32 @@ public final class TillauraHack extends Hack implements UpdateListener
private boolean rightClickBlockLegit(BlockPos pos)
{
Vec3d eyesPos = RotationUtils.getEyesPos();
Vec3d posVec = Vec3d.ofCenter(pos);
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
double rangeSq = Math.pow(range.getValue(), 2);
// if this block is unreachable, try the next one
BlockBreakingParams params = BlockBreaker.getBlockBreakingParams(pos);
if(params == null || params.distanceSq() > range.getValueSq())
return false;
if(checkLOS.isChecked() && !params.lineOfSight())
return false;
for(Direction side : Direction.values())
{
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
// check if hitVec is within range
if(distanceSqHitVec > rangeSq)
continue;
// check if side is facing towards player
if(distanceSqHitVec >= distanceSqPosVec)
continue;
if(checkLOS.isChecked()
&& !BlockUtils.hasLineOfSight(eyesPos, hitVec))
continue;
// face block
WURST.getRotationFaker().faceVectorPacket(hitVec);
// right click block
IMC.getInteractionManager().rightClickBlock(pos, side, hitVec);
MC.player.swingHand(Hand.MAIN_HAND);
MC.itemUseCooldown = 4;
return true;
}
return false;
// face and right click the block
MC.itemUseCooldown = 4;
WURST.getRotationFaker().faceVectorPacket(params.hitVec());
InteractionSimulator.rightClickBlock(params.toHitResult());
return true;
}
private boolean rightClickBlockSimple(BlockPos pos)
{
Vec3d eyesPos = RotationUtils.getEyesPos();
Vec3d posVec = Vec3d.ofCenter(pos);
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
double rangeSq = Math.pow(range.getValue(), 2);
// if this block is unreachable, try the next one
BlockBreakingParams params = BlockBreaker.getBlockBreakingParams(pos);
if(params == null || params.distanceSq() > range.getValueSq())
return false;
if(checkLOS.isChecked() && !params.lineOfSight())
return false;
for(Direction side : Direction.values())
{
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
// check if hitVec is within range
if(distanceSqHitVec > rangeSq)
continue;
// check if side is facing towards player
if(distanceSqHitVec >= distanceSqPosVec)
continue;
if(checkLOS.isChecked()
&& !BlockUtils.hasLineOfSight(eyesPos, hitVec))
continue;
IMC.getInteractionManager().rightClickBlock(pos, side, hitVec);
return true;
}
return false;
// right click the block
InteractionSimulator.rightClickBlock(params.toHitResult(),
SwingHand.OFF);
return true;
}
}

View File

@ -25,6 +25,8 @@ import net.wurstclient.settings.EnumSetting;
import net.wurstclient.settings.PauseAttackOnContainersSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.EntityUtils;
import net.wurstclient.util.RotationUtils;
@ -47,6 +49,9 @@ public final class TpAuraHack extends Hack implements UpdateListener
+ "\u00a7lHealth\u00a7r - Attacks the weakest entity.",
Priority.values(), Priority.ANGLE);
private final SwingHandSetting swingHand = new SwingHandSetting(
"How TP-Aura should swing your hand when attacking.", SwingHand.CLIENT);
private final PauseAttackOnContainersSetting pauseOnContainers =
new PauseAttackOnContainersSetting(true);
@ -61,6 +66,7 @@ public final class TpAuraHack extends Hack implements UpdateListener
addSetting(range);
addSetting(speed);
addSetting(priority);
addSetting(swingHand);
addSetting(pauseOnContainers);
entityFilters.forEach(this::addSetting);
@ -130,7 +136,7 @@ public final class TpAuraHack extends Hack implements UpdateListener
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(player, entity);
player.swingHand(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);
speed.resetTimer();
}

View File

@ -14,17 +14,23 @@ import net.minecraft.util.Hand;
import net.minecraft.util.hit.EntityHitResult;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.UpdateListener;
import net.wurstclient.events.PostMotionListener;
import net.wurstclient.events.PreMotionListener;
import net.wurstclient.hack.Hack;
import net.wurstclient.mixinterface.IKeyBinding;
import net.wurstclient.settings.AttackSpeedSliderSetting;
import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
import net.wurstclient.settings.SwingHandSetting;
import net.wurstclient.settings.SwingHandSetting.SwingHand;
import net.wurstclient.settings.filterlists.EntityFilterList;
import net.wurstclient.util.EntityUtils;
@SearchTags({"trigger bot"})
public final class TriggerBotHack extends Hack implements UpdateListener
@SearchTags({"trigger bot", "AutoAttack", "auto attack", "AutoClicker",
"auto clicker"})
public final class TriggerBotHack extends Hack
implements PreMotionListener, PostMotionListener
{
private final SliderSetting range =
new SliderSetting("Range", 4.25, 1, 6, 0.05, ValueDisplay.DECIMAL);
@ -32,14 +38,36 @@ public final class TriggerBotHack extends Hack implements UpdateListener
private final AttackSpeedSliderSetting speed =
new AttackSpeedSliderSetting();
private final CheckboxSetting attackWhileBlocking = new CheckboxSetting(
"Attack while blocking",
"Whether or not to attack while blocking with a shield / using items.",
private final SwingHandSetting swingHand = new SwingHandSetting(
"How TriggerBot should swing your hand when attacking.\n\n"
+ "This setting will be ignored if \"Simulate mouse click\" is"
+ " enabled.",
SwingHand.CLIENT);
private final CheckboxSetting attackWhileBlocking =
new CheckboxSetting("Attack while blocking",
"Attacks even while you're blocking with a shield or using"
+ " items.\n\n"
+ "This would not be possible in vanilla and won't work if"
+ " \"Simulate mouse click\" is enabled.",
false);
private final CheckboxSetting simulateMouseClick = new CheckboxSetting(
"Simulate mouse click",
"Simulates an actual mouse click (or key press) when attacking. Can be"
+ " used to trick CPS measuring tools into thinking that you're"
+ " attacking manually.\n\n"
+ "\u00a7c\u00a7lWARNING:\u00a7r Simulating mouse clicks can lead"
+ " to unexpected behavior, like in-game menus clicking themselves."
+ " Also, the \"Swing hand\" and \"Attack while blocking\" settings"
+ " will not work while this option is enabled.",
false);
private final EntityFilterList entityFilters =
EntityFilterList.genericCombat();
private boolean simulatingMouseClick;
public TriggerBotHack()
{
super("TriggerBot");
@ -47,7 +75,9 @@ public final class TriggerBotHack extends Hack implements UpdateListener
addSetting(range);
addSetting(speed);
addSetting(swingHand);
addSetting(attackWhileBlocking);
addSetting(simulateMouseClick);
entityFilters.forEach(this::addSetting);
}
@ -66,17 +96,35 @@ public final class TriggerBotHack extends Hack implements UpdateListener
WURST.getHax().tpAuraHack.setEnabled(false);
speed.resetTimer();
EVENTS.add(UpdateListener.class, this);
EVENTS.add(PreMotionListener.class, this);
EVENTS.add(PostMotionListener.class, this);
}
@Override
protected void onDisable()
{
EVENTS.remove(UpdateListener.class, this);
if(simulatingMouseClick)
{
IKeyBinding.get(MC.options.attackKey).simulatePress(false);
simulatingMouseClick = false;
}
EVENTS.remove(PreMotionListener.class, this);
EVENTS.remove(PostMotionListener.class, this);
}
@Override
public void onUpdate()
public void onPreMotion()
{
if(!simulatingMouseClick)
return;
IKeyBinding.get(MC.options.attackKey).simulatePress(false);
simulatingMouseClick = false;
}
@Override
public void onPostMotion()
{
speed.updateTimer();
if(!speed.isTimeToAttack())
@ -87,22 +135,31 @@ public final class TriggerBotHack extends Hack implements UpdateListener
return;
ClientPlayerEntity player = MC.player;
if(player.isUsingItem() && !attackWhileBlocking.isChecked())
if(!attackWhileBlocking.isChecked() && player.isUsingItem())
return;
if(MC.crosshairTarget == null
|| !(MC.crosshairTarget instanceof EntityHitResult))
|| !(MC.crosshairTarget instanceof EntityHitResult eResult))
return;
Entity target = ((EntityHitResult)MC.crosshairTarget).getEntity();
Entity target = eResult.getEntity();
if(!isCorrectEntity(target))
return;
WURST.getHax().autoSwordHack.setSlot(target);
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(player, target);
player.swingHand(Hand.MAIN_HAND);
if(simulateMouseClick.isChecked())
{
IKeyBinding.get(MC.options.attackKey).simulatePress(true);
simulatingMouseClick = true;
}else
{
MC.interactionManager.attackEntity(player, target);
swingHand.swing(Hand.MAIN_HAND);
}
speed.resetTimer();
}

View File

@ -45,9 +45,10 @@ public final class XRayHack extends Hack implements UpdateListener,
"minecraft:amethyst_cluster", "minecraft:ancient_debris",
"minecraft:anvil", "minecraft:beacon", "minecraft:bone_block",
"minecraft:bookshelf", "minecraft:brewing_stand",
"minecraft:chain_command_block", "minecraft:chest", "minecraft:clay",
"minecraft:coal_block", "minecraft:coal_ore", "minecraft:command_block",
"minecraft:copper_ore", "minecraft:crafter", "minecraft:crafting_table",
"minecraft:budding_amethyst", "minecraft:chain_command_block",
"minecraft:chest", "minecraft:clay", "minecraft:coal_block",
"minecraft:coal_ore", "minecraft:command_block", "minecraft:copper_ore",
"minecraft:crafter", "minecraft:crafting_table",
"minecraft:decorated_pot", "minecraft:deepslate_coal_ore",
"minecraft:deepslate_copper_ore", "minecraft:deepslate_diamond_ore",
"minecraft:deepslate_emerald_ore", "minecraft:deepslate_gold_ore",
@ -66,10 +67,11 @@ public final class XRayHack extends Hack implements UpdateListener,
"minecraft:raw_copper_block", "minecraft:raw_gold_block",
"minecraft:raw_iron_block", "minecraft:redstone_block",
"minecraft:redstone_ore", "minecraft:repeating_command_block",
"minecraft:spawner", "minecraft:suspicious_gravel",
"minecraft:suspicious_sand", "minecraft:tnt", "minecraft:torch",
"minecraft:trapped_chest", "minecraft:trial_spawner", "minecraft:vault",
"minecraft:water");
"minecraft:sculk_catalyst", "minecraft:sculk_sensor",
"minecraft:sculk_shrieker", "minecraft:spawner",
"minecraft:suspicious_gravel", "minecraft:suspicious_sand",
"minecraft:tnt", "minecraft:torch", "minecraft:trapped_chest",
"minecraft:trial_spawner", "minecraft:vault", "minecraft:water");
private final CheckboxSetting onlyExposed = new CheckboxSetting(
"Only show exposed",

View File

@ -1,47 +0,0 @@
/*
* Copyright (c) 2014-2024 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.hacks.autocomplete;
import net.wurstclient.settings.EnumSetting;
public final class ApiProviderSetting
extends EnumSetting<ApiProviderSetting.ApiProvider>
{
public ApiProviderSetting()
{
super("API provider",
"\u00a7lOpenAI\u00a7r lets you use models like ChatGPT, but requires an"
+ " account with API access, costs money to use and sends your chat"
+ " history to their servers. The name is a lie - it's closed"
+ " source.\n\n"
+ "\u00a7loobabooga\u00a7r lets you use models like LLaMA and many"
+ " others. It's a true open source alternative to OpenAI that you"
+ " can run locally on your own computer. It's free to use and does"
+ " not send your chat history to any servers.",
ApiProvider.values(), ApiProvider.OOBABOOGA);
}
public enum ApiProvider
{
OPENAI("OpenAI"),
OOBABOOGA("oobabooga");
private final String name;
private ApiProvider(String name)
{
this.name = name;
}
@Override
public String toString()
{
return name;
}
}
}

View File

@ -30,26 +30,27 @@ public abstract class MessageCompleter
this.modelSettings = modelSettings;
}
public final String completeChatMessage(String draftMessage)
public final String[] completeChatMessage(String draftMessage,
int maxSuggestions)
{
// build prompt and parameters
String prompt = buildPrompt(draftMessage);
JsonObject params = buildParams(prompt);
JsonObject params = buildParams(prompt, maxSuggestions);
System.out.println(params);
try
{
// send request
WsonObject response = requestCompletion(params);
WsonObject response = requestCompletions(params);
System.out.println(response);
// read response
return extractCompletion(response);
return extractCompletions(response);
}catch(IOException | JsonException e)
{
e.printStackTrace();
return "";
return new String[0];
}
}
@ -98,11 +99,12 @@ public abstract class MessageCompleter
return prompt;
}
protected abstract JsonObject buildParams(String prompt);
protected abstract JsonObject buildParams(String prompt,
int maxSuggestions);
protected abstract WsonObject requestCompletion(JsonObject parameters)
protected abstract WsonObject requestCompletions(JsonObject parameters)
throws IOException, JsonException;
protected abstract String extractCompletion(WsonObject response)
protected abstract String[] extractCompletions(WsonObject response)
throws JsonException;
}

View File

@ -23,42 +23,33 @@ public final class ModelSettings
{
public final EnumSetting<OpenAiModel> openAiModel = new EnumSetting<>(
"OpenAI model",
"The model to use for OpenAI API calls.\n\n"
+ "\u00a7lText-Davinci-003\u00a7r (better known as GPT-3) is an"
+ " older model that's less censored than ChatGPT, but it's also"
+ " 10x more expensive to use.\n\n"
+ "\u00a7lGPT-3.5-Turbo\u00a7r (better known as ChatGPT) is"
+ " recommended for most use cases, as it's relatively cheap and"
+ " powerful.\n\n"
+ "\u00a7lGPT-4\u00a7r is more powerful, but only works if OpenAI"
+ " has chosen you to be a beta tester. It can be anywhere from"
+ " 15x to 60x more expensive than ChatGPT.",
OpenAiModel.values(), OpenAiModel.GPT_3_5_TURBO);
"The model to use for OpenAI API calls.\nRecommended models:\n\n"
+ "\u00a7lGPT-4o-2024-05-13\u00a7r is the world's smartest model at"
+ " the time of writing and will often produce the best completions."
+ " However, it's meant to be an assistant rather than an"
+ " auto-completion system, so you will see it produce some odd"
+ " completions at times.\n\n"
+ "\u00a7lGPT-3.5-Turbo-Instruct\u00a7r is an older, non-chat model"
+ " based on GPT-3.5 that works well for auto-completion tasks.",
OpenAiModel.values(), OpenAiModel.GPT_4O_2024_05_13);
public enum OpenAiModel
{
GPT_3_5_TURBO("gpt-3.5-turbo", true),
GPT_3_5_TURBO_1106("gpt-3.5-turbo-1106", true),
GPT_3_5_TURBO_0613("gpt-3.5-turbo-0613", true),
GPT_3_5_TURBO_0301("gpt-3.5-turbo-0301", true),
GPT_3_5_TURBO_16K("gpt-3.5-turbo-16k", true),
GPT_3_5_TURBO_16K_0613("gpt-3.5-turbo-16k-0613", true),
GPT_4("gpt-4", true),
GPT_4O_2024_05_13("gpt-4o-2024-05-13", true),
GPT_4_TURBO_2024_04_09("gpt-4-turbo-2024-04-09", true),
GPT_4_0125_PREVIEW("gpt-4-0125-preview", true),
GPT_4_1106_PREVIEW("gpt-4-1106-preview", true),
GPT_4_0613("gpt-4-0613", true),
GPT_4_0314("gpt-4-0314", true),
GPT_4_32K("gpt-4-32k", true),
GPT_4_32K_0613("gpt-4-32k-0613", true),
TEXT_DAVINCI_003("text-davinci-003", false),
TEXT_DAVINCI_002("text-davinci-002", false),
TEXT_DAVINCI_001("text-davinci-001", false),
DAVINCI("davinci", false),
TEXT_CURIE_001("text-curie-001", false),
CURIE("curie", false),
TEXT_BABBAGE_001("text-babbage-001", false),
BABBAGE("babbage", false),
TEXT_ADA_001("text-ada-001", false),
ADA("ada", false);
GPT_3_5_TURBO_0125("gpt-3.5-turbo-0125", true),
GPT_3_5_TURBO_1106("gpt-3.5-turbo-1106", true),
GPT_3_5_TURBO_0613("gpt-3.5-turbo-0613", true),
GPT_3_5_TURBO_16K_0613("gpt-3.5-turbo-16k-0613", true),
GPT_3_5_TURBO_0301("gpt-3.5-turbo-0301", true),
GPT_3_5_TURBO_INSTRUCT("gpt-3.5-turbo-instruct", false),
DAVINCI_002("davinci-002", false),
BABBAGE_002("babbage-002", false);
private final String name;
private final boolean chat;
@ -92,7 +83,7 @@ public final class ModelSettings
"Controls the model's creativity and randomness. A higher value will"
+ " result in more creative and sometimes nonsensical completions,"
+ " while a lower value will result in more boring completions.",
0.7, 0, 2, 0.01, ValueDisplay.DECIMAL);
1, 0, 2, 0.01, ValueDisplay.DECIMAL);
public final SliderSetting topP = new SliderSetting("Top P",
"An alternative to temperature. Makes the model less random by only"
@ -107,8 +98,7 @@ public final class ModelSettings
+ " history.\n\n"
+ "Positive values encourage the model to use synonyms and"
+ " talk about different topics. Negative values encourage the"
+ " model to repeat the same word over and over again.\n\n"
+ "Only works with OpenAI models.",
+ " model to repeat the same word over and over again.",
0, -2, 2, 0.01, ValueDisplay.DECIMAL);
public final SliderSetting frequencyPenalty =
@ -117,25 +107,8 @@ public final class ModelSettings
+ " appears in the chat history.\n\n"
+ "Positive values encourage the model to use synonyms and"
+ " talk about different topics. Negative values encourage the"
+ " model to repeat existing chat messages.\n\n"
+ "Only works with OpenAI models.",
0.6, -2, 2, 0.01, ValueDisplay.DECIMAL);
public final SliderSetting repetitionPenalty =
new SliderSetting("Repetition penalty",
"Similar to presence penalty, but uses a different algorithm.\n\n"
+ "1.0 means no penalty, negative values are not possible and"
+ " 1.5 is the maximum value.\n\n"
+ "Only works with the oobabooga web UI.",
1, 1, 1.5, 0.01, ValueDisplay.DECIMAL);
public final SliderSetting encoderRepetitionPenalty =
new SliderSetting("Encoder repetition penalty",
"Similar to frequency penalty, but uses a different algorithm.\n\n"
+ "1.0 means no penalty, 0.8 behaves like a negative value and"
+ " 1.5 is the maximum value.\n\n"
+ "Only works with the oobabooga web UI.",
1, 0.8, 1.5, 0.01, ValueDisplay.DECIMAL);
+ " model to repeat existing chat messages.",
0, -2, 2, 0.01, ValueDisplay.DECIMAL);
public final EnumSetting<StopSequence> stopSequence = new EnumSetting<>(
"Stop sequence",
@ -179,7 +152,7 @@ public final class ModelSettings
+ " predictions.\n\n"
+ "Higher values improve the quality of predictions, but also"
+ " increase the time it takes to generate them, as well as cost"
+ " (for OpenAI API users) or RAM usage (for oobabooga users).",
+ " (for APIs like OpenAI) or RAM usage (for self-hosted models).",
10, 0, 100, 1, ValueDisplay.INTEGER);
public final CheckboxSetting filterServerMessages =
@ -191,6 +164,47 @@ public final class ModelSettings
+ " etc.",
false);
public final TextFieldSetting customModel = new TextFieldSetting(
"Custom model",
"If set, this model will be used instead of the one specified in the"
+ " \"OpenAI model\" setting.\n\n"
+ "Use this if you have a fine-tuned OpenAI model or if you are"
+ " using a custom endpoint that is OpenAI-compatible but offers"
+ " different models.",
"");
public final EnumSetting<CustomModelType> customModelType =
new EnumSetting<>("Custom model type", "Whether the custom"
+ " model should use the chat endpoint or the legacy endpoint.\n\n"
+ "If \"Custom model\" is left blank, this setting is ignored.",
CustomModelType.values(), CustomModelType.CHAT);
public enum CustomModelType
{
CHAT("Chat", true),
LEGACY("Legacy", false);
private final String name;
private final boolean chat;
private CustomModelType(String name, boolean chat)
{
this.name = name;
this.chat = chat;
}
public boolean isChat()
{
return chat;
}
@Override
public String toString()
{
return name;
}
}
public final TextFieldSetting openaiChatEndpoint = new TextFieldSetting(
"OpenAI chat endpoint", "Endpoint for OpenAI's chat completion API.",
"https://api.openai.com/v1/chat/completions");
@ -200,19 +214,11 @@ public final class ModelSettings
"Endpoint for OpenAI's legacy completion API.",
"https://api.openai.com/v1/completions");
public final TextFieldSetting oobaboogaEndpoint =
new TextFieldSetting("Oobabooga endpoint",
"Endpoint for your Oobabooga web UI instance.\n"
+ "Remember to start the Oobabooga server with the"
+ " \u00a7e--extensions api\u00a7r flag.",
"http://127.0.0.1:5000/api/v1/generate");
private final List<Setting> settings =
Collections.unmodifiableList(Arrays.asList(openAiModel, maxTokens,
temperature, topP, presencePenalty, frequencyPenalty,
repetitionPenalty, encoderRepetitionPenalty, stopSequence,
contextLength, filterServerMessages, openaiChatEndpoint,
openaiLegacyEndpoint, oobaboogaEndpoint));
temperature, topP, presencePenalty, frequencyPenalty, stopSequence,
contextLength, filterServerMessages, customModel, customModelType,
openaiChatEndpoint, openaiLegacyEndpoint));
public void forEach(Consumer<Setting> action)
{

View File

@ -1,84 +0,0 @@
/*
* Copyright (c) 2014-2024 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.hacks.autocomplete;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.wurstclient.util.json.JsonException;
import net.wurstclient.util.json.JsonUtils;
import net.wurstclient.util.json.WsonObject;
public final class OobaboogaMessageCompleter extends MessageCompleter
{
public OobaboogaMessageCompleter(ModelSettings modelSettings)
{
super(modelSettings);
}
@Override
protected JsonObject buildParams(String prompt)
{
JsonObject params = new JsonObject();
params.addProperty("prompt", prompt);
params.addProperty("max_length", modelSettings.maxTokens.getValueI());
params.addProperty("temperature", modelSettings.temperature.getValue());
params.addProperty("top_p", modelSettings.topP.getValue());
params.addProperty("repetition_penalty",
modelSettings.repetitionPenalty.getValue());
params.addProperty("encoder_repetition_penalty",
modelSettings.encoderRepetitionPenalty.getValue());
JsonArray stoppingStrings = new JsonArray();
stoppingStrings
.add(modelSettings.stopSequence.getSelected().getSequence());
params.add("stopping_strings", stoppingStrings);
return params;
}
@Override
protected WsonObject requestCompletion(JsonObject parameters)
throws IOException, JsonException
{
// set up the API request
URL url =
URI.create(modelSettings.oobaboogaEndpoint.getValue()).toURL();
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
// set the request body
conn.setDoOutput(true);
try(OutputStream os = conn.getOutputStream())
{
os.write(JsonUtils.GSON.toJson(parameters).getBytes());
os.flush();
}
// parse the response
return JsonUtils.parseConnectionToObject(conn);
}
@Override
protected String extractCompletion(WsonObject response) throws JsonException
{
// extract completion from response
String completion =
response.getArray("results").getObject(0).getString("text");
// remove newlines
completion = completion.replace("\n", " ");
return completion;
}
}

View File

@ -12,6 +12,7 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@ -28,14 +29,12 @@ public final class OpenAiMessageCompleter extends MessageCompleter
}
@Override
protected JsonObject buildParams(String prompt)
protected JsonObject buildParams(String prompt, int maxSuggestions)
{
// build the request parameters
JsonObject params = new JsonObject();
params.addProperty("stop",
modelSettings.stopSequence.getSelected().getSequence());
params.addProperty("model",
"" + modelSettings.openAiModel.getSelected());
params.addProperty("max_tokens", modelSettings.maxTokens.getValueI());
params.addProperty("temperature", modelSettings.temperature.getValue());
params.addProperty("top_p", modelSettings.topP.getValue());
@ -43,11 +42,29 @@ public final class OpenAiMessageCompleter extends MessageCompleter
modelSettings.presencePenalty.getValue());
params.addProperty("frequency_penalty",
modelSettings.frequencyPenalty.getValue());
params.addProperty("n", maxSuggestions);
// add the prompt, depending on the model
if(modelSettings.openAiModel.getSelected().isChatModel())
// determine model name and type
boolean customModel = !modelSettings.customModel.getValue().isBlank();
String modelName = customModel ? modelSettings.customModel.getValue()
: "" + modelSettings.openAiModel.getSelected();
boolean chatModel =
customModel ? modelSettings.customModelType.getSelected().isChat()
: modelSettings.openAiModel.getSelected().isChatModel();
// add the model name
params.addProperty("model", modelName);
// add the prompt, depending on model type
if(chatModel)
{
JsonArray messages = new JsonArray();
JsonObject systemMessage = new JsonObject();
systemMessage.addProperty("role", "system");
systemMessage.addProperty("content",
"Complete the following text. Reply only with the completion."
+ " You are not an assistant.");
messages.add(systemMessage);
JsonObject promptMessage = new JsonObject();
promptMessage.addProperty("role", "user");
promptMessage.addProperty("content", prompt);
@ -61,7 +78,7 @@ public final class OpenAiMessageCompleter extends MessageCompleter
}
@Override
protected WsonObject requestCompletion(JsonObject parameters)
protected WsonObject requestCompletions(JsonObject parameters)
throws IOException, JsonException
{
// get the API URL
@ -90,20 +107,31 @@ public final class OpenAiMessageCompleter extends MessageCompleter
}
@Override
protected String extractCompletion(WsonObject response) throws JsonException
protected String[] extractCompletions(WsonObject response)
throws JsonException
{
// extract completion from response
String completion;
ArrayList<String> completions = new ArrayList<>();
// extract choices from response
ArrayList<WsonObject> choices =
response.getArray("choices").getAllObjects();
// extract completions from choices
if(modelSettings.openAiModel.getSelected().isChatModel())
completion = response.getArray("choices").getObject(0)
.getObject("message").getString("content");
for(WsonObject choice : choices)
{
WsonObject message = choice.getObject("message");
String content = message.getString("content");
completions.add(content);
}
else
completion =
response.getArray("choices").getObject(0).getString("text");
for(WsonObject choice : choices)
completions.add(choice.getString("text"));
// remove newlines
completion = completion.replace("\n", " ");
for(String completion : completions)
completion = completion.replace("\n", " ");
return completion;
return completions.toArray(new String[completions.size()]);
}
}

View File

@ -14,6 +14,7 @@ import java.util.function.BiConsumer;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.util.math.MathHelper;
import net.wurstclient.settings.Setting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
@ -22,14 +23,11 @@ public final class SuggestionHandler
{
private final ArrayList<String> suggestions = new ArrayList<>();
private final SliderSetting maxSuggestionPerDraft = new SliderSetting(
"Max suggestions per draft",
"How many suggestions the AI is allowed to generate for the same draft"
+ " message.\n\n"
+ "\u00a7c\u00a7lWARNING:\u00a7r Higher values can use up a lot of"
+ " tokens. Definitely limit this to 1 for expensive models like"
+ " GPT-4.",
3, 1, 10, 1, ValueDisplay.INTEGER);
private final SliderSetting maxSuggestionsPerDraft =
new SliderSetting("Max suggestions per draft",
"How many suggestions the AI is allowed to generate for the same"
+ " draft message.",
3, 1, 10, 1, ValueDisplay.INTEGER);
private final SliderSetting maxSuggestionsKept = new SliderSetting(
"Max suggestions kept", "Maximum number of suggestions kept in memory.",
@ -43,7 +41,7 @@ public final class SuggestionHandler
+ " on your screen resolution and GUI scale.",
5, 1, 10, 1, ValueDisplay.INTEGER);
private final List<Setting> settings = Arrays.asList(maxSuggestionPerDraft,
private final List<Setting> settings = Arrays.asList(maxSuggestionsPerDraft,
maxSuggestionsKept, maxSuggestionsShown);
public List<Setting> getSettings()
@ -51,13 +49,15 @@ public final class SuggestionHandler
return settings;
}
public boolean hasEnoughSuggestionFor(String draftMessage)
public int getMaxSuggestionsFor(String draftMessage)
{
synchronized(suggestions)
{
return suggestions.stream().map(String::toLowerCase)
.filter(s -> s.startsWith(draftMessage.toLowerCase()))
.count() >= maxSuggestionPerDraft.getValue();
int existing = (int)suggestions.stream().map(String::toLowerCase)
.filter(s -> s.startsWith(draftMessage.toLowerCase())).count();
int maxPerDraft = maxSuggestionsPerDraft.getValueI();
return MathHelper.clamp(maxPerDraft - existing, 0, maxPerDraft);
}
}

View File

@ -129,9 +129,12 @@ public final class FishingSpotManager
private void moveToNextSpot()
{
IKeyBinding forwardKey = IKeyBinding.get(MC.options.forwardKey);
IKeyBinding jumpKey = IKeyBinding.get(MC.options.jumpKey);
PositionAndRotation nextPosRot = nextSpot.input();
((IKeyBinding)MC.options.forwardKey).resetPressedState();
((IKeyBinding)MC.options.jumpKey).resetPressedState();
forwardKey.resetPressedState();
jumpKey.resetPressedState();
// match position
Vec3d nextPos = nextPosRot.pos();
@ -149,14 +152,14 @@ public final class FishingSpotManager
}
// jump if necessary
MC.options.jumpKey.setPressed(
jumpKey.setPressed(
MC.player.isTouchingWater() || MC.player.horizontalCollision);
// walk or teleport depending on distance
if(distance < 0.2)
MC.player.setPosition(nextPos.x, nextPos.y, nextPos.z);
else if(distance > 0.7 || MC.player.age % 10 == 0)
MC.options.forwardKey.setPressed(true);
forwardKey.setPressed(true);
return;
}

View File

@ -95,6 +95,7 @@ public final class KeybindList
try(Stream<Path> files = Files.list(profilesFolder))
{
return files.filter(Files::isRegularFile)
.filter(path -> path.getFileName().toString().endsWith(".json"))
.collect(Collectors.toCollection(ArrayList::new));
}catch(IOException e)

View File

@ -11,10 +11,11 @@ import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.command.CommandOutput;
@ -29,19 +30,22 @@ import net.wurstclient.events.VelocityFromFluidListener.VelocityFromFluidEvent;
@Mixin(Entity.class)
public abstract class EntityMixin implements Nameable, EntityLike, CommandOutput
{
@Redirect(at = @At(value = "INVOKE",
/**
* This mixin makes the VelocityFromFluidEvent work, which is used by
* AntiWaterPush. It's set to require 0 because it doesn't work in Forge,
* when using Sinytra Connector.
*/
@WrapWithCondition(at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;setVelocity(Lnet/minecraft/util/math/Vec3d;)V",
opcode = Opcodes.INVOKEVIRTUAL,
ordinal = 0),
method = "updateMovementInFluid(Lnet/minecraft/registry/tag/TagKey;D)Z")
private void setVelocityFromFluid(Entity entity, Vec3d velocity)
method = "updateMovementInFluid(Lnet/minecraft/registry/tag/TagKey;D)Z",
require = 0)
private boolean shouldSetVelocity(Entity instance, Vec3d velocity)
{
VelocityFromFluidEvent event =
new VelocityFromFluidEvent((Entity)(Object)this);
VelocityFromFluidEvent event = new VelocityFromFluidEvent(instance);
EventManager.fire(event);
if(!event.isCancelled())
entity.setVelocity(velocity);
return !event.isCancelled();
}
@Inject(at = @At("HEAD"),

View File

@ -7,9 +7,12 @@
*/
package net.wurstclient.mixin;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.wurstclient.WurstClient;
@ -22,19 +25,47 @@ public abstract class KeyBindingMixin implements IKeyBinding
private InputUtil.Key boundKey;
@Override
public boolean isActallyPressed()
@Unique
@Deprecated // use IKeyBinding.resetPressedState() instead
public void wurst_resetPressedState()
{
long handle = WurstClient.MC.getWindow().getHandle();
int code = boundKey.getCode();
return InputUtil.isKeyPressed(handle, code);
setPressed(InputUtil.isKeyPressed(handle, code));
}
@Override
public void resetPressedState()
@Unique
@Deprecated // use IKeyBinding.simulatePress() instead
public void wurst_simulatePress(boolean pressed)
{
setPressed(isActallyPressed());
MinecraftClient mc = WurstClient.MC;
long window = mc.getWindow().getHandle();
int action = pressed ? 1 : 0;
switch(boundKey.getCategory())
{
case KEYSYM:
mc.keyboard.onKey(window, boundKey.getCode(), 0, action, 0);
break;
case SCANCODE:
mc.keyboard.onKey(window, GLFW.GLFW_KEY_UNKNOWN, boundKey.getCode(),
action, 0);
break;
case MOUSE:
mc.mouse.onMouseButton(window, boundKey.getCode(), action, 0);
break;
default:
System.out
.println("Unknown keybinding type: " + boundKey.getCategory());
break;
}
}
@Override
@Shadow
public abstract void setPressed(boolean pressed);
}

View File

@ -7,16 +7,57 @@
*/
package net.wurstclient.mixinterface;
import net.minecraft.client.option.KeyBinding;
public interface IKeyBinding
{
/**
* @return true if the user is actually pressing this key on their keyboard.
*/
public boolean isActallyPressed();
/**
* Resets the pressed state to whether or not the user is actually pressing
* this key on their keyboard.
*/
public void resetPressedState();
public default void resetPressedState()
{
wurst_resetPressedState();
}
/**
* Simulates the user pressing this key on their keyboard or mouse. This is
* much more aggressive than using {@link #setPressed(boolean)} and should
* be used sparingly.
*/
public default void simulatePress(boolean pressed)
{
wurst_simulatePress(pressed);
}
public default void setPressed(boolean pressed)
{
asVanilla().setPressed(pressed);
}
public default KeyBinding asVanilla()
{
return (KeyBinding)this;
}
/**
* Returns the given KeyBinding object as an IKeyBinding, allowing you to
* access the resetPressedState() method.
*/
public static IKeyBinding get(KeyBinding kb)
{
return (IKeyBinding)kb;
}
/**
* @deprecated Use {@link #resetPressedState()} instead.
*/
@Deprecated
public void wurst_resetPressedState();
/**
* @deprecated Use {@link #simulatePress()} instead.
*/
@Deprecated
public void wurst_simulatePress(boolean pressed);
}

View File

@ -271,7 +271,9 @@ public final class NavigatorFeatureScreen extends NavigatorScreen
return;
}
Rectangle area = new Rectangle(width / 2 - 154, 60, 308, height - 103);
boolean noButtons = Screens.getButtons(this).isEmpty();
Rectangle area = new Rectangle(width / 2 - 154, 60, 308,
height - 60 - (noButtons ? 43 : 67));
if(!area.contains(x, y))
return;
@ -402,6 +404,11 @@ public final class NavigatorFeatureScreen extends NavigatorScreen
{
int yc1 = window.getChild(i).getY();
int yc2 = yc1 - 2;
if(yc1 < bgy1 - windowY1)
continue;
if(yc2 > bgy3 - windowY1)
break;
bufferBuilder.vertex(matrix, xc1, yc2, 0).next();
bufferBuilder.vertex(matrix, xc1, yc1, 0).next();
bufferBuilder.vertex(matrix, xc2, yc1, 0).next();
@ -429,8 +436,16 @@ public final class NavigatorFeatureScreen extends NavigatorScreen
}
for(int i = 0; i < window.countChildren(); i++)
window.getChild(i).render(context, mouseX - bgx1, mouseY - windowY1,
{
Component child = window.getChild(i);
if(child.getY() + child.getHeight() < bgy1 - windowY1)
continue;
if(child.getY() > bgy3 - windowY1)
break;
child.render(context, mouseX - bgx1, mouseY - windowY1,
partialTicks);
}
matrixStack.pop();
// buttons

View File

@ -19,8 +19,9 @@ import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.ColorSetting;
import net.wurstclient.settings.EnumSetting;
@SearchTags({"ArrayList", "ModList", "CheatList", "mod list", "array list",
"hack list", "cheat list"})
@SearchTags({"hack list", "HakList", "hak list", "HacksList", "hacks list",
"HaxList", "hax list", "ArrayList", "array list", "ModList", "mod list",
"CheatList", "cheat list"})
@DontBlock
public final class HackListOtf extends OtherFeature
{

View File

@ -18,6 +18,7 @@ import java.util.Set;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.minecraft.block.Block;
import net.minecraft.registry.Registries;
@ -29,7 +30,6 @@ import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.util.BlockUtils;
import net.wurstclient.util.json.JsonException;
import net.wurstclient.util.json.JsonUtils;
import net.wurstclient.util.json.WsonArray;
public final class BlockListSetting extends Setting
{
@ -90,10 +90,17 @@ public final class BlockListSetting extends Setting
{
try
{
WsonArray wson = JsonUtils.getAsArray(json);
blockNames.clear();
wson.getAllStrings().parallelStream()
// if string "default", load default blocks
if(JsonUtils.getAsString(json, "nope").equals("default"))
{
blockNames.addAll(Arrays.asList(defaultNames));
return;
}
// otherwise, load the blocks in the JSON array
JsonUtils.getAsArray(json).getAllStrings().parallelStream()
.map(s -> Registries.BLOCK.get(new Identifier(s)))
.filter(Objects::nonNull).map(BlockUtils::getName).distinct()
.sorted().forEachOrdered(s -> blockNames.add(s));
@ -108,6 +115,10 @@ public final class BlockListSetting extends Setting
@Override
public JsonElement toJson()
{
// if blockNames is the same as defaultNames, save string "default"
if(blockNames.equals(Arrays.asList(defaultNames)))
return new JsonPrimitive("default");
JsonArray json = new JsonArray();
blockNames.forEach(s -> json.add(s));
return json;

View File

@ -18,6 +18,7 @@ import java.util.Set;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.wurstclient.WurstClient;
import net.wurstclient.clickgui.Component;
@ -26,7 +27,6 @@ import net.wurstclient.hacks.autolibrarian.BookOffer;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.util.json.JsonException;
import net.wurstclient.util.json.JsonUtils;
import net.wurstclient.util.json.WsonArray;
import net.wurstclient.util.json.WsonObject;
public final class BookOffersSetting extends Setting
@ -146,12 +146,20 @@ public final class BookOffersSetting extends Setting
{
try
{
WsonArray wson = JsonUtils.getAsArray(json);
offers.clear();
wson.getAllObjects().parallelStream().map(this::loadOffer)
.filter(Objects::nonNull).filter(BookOffer::isMostlyValid)
.distinct().sorted().forEachOrdered(offers::add);
// if string "default", load default offers
if(JsonUtils.getAsString(json, "nope").equals("default"))
{
offers.addAll(Arrays.asList(defaultOffers));
return;
}
// otherwise, load the offers in the JSON array
JsonUtils.getAsArray(json).getAllObjects().parallelStream()
.map(this::loadOffer).filter(Objects::nonNull)
.filter(BookOffer::isMostlyValid).distinct().sorted()
.forEachOrdered(offers::add);
}catch(JsonException e)
{
@ -181,6 +189,10 @@ public final class BookOffersSetting extends Setting
@Override
public JsonElement toJson()
{
// if offers is the same as defaultOffers, save string "default"
if(offers.equals(Arrays.asList(defaultOffers)))
return new JsonPrimitive("default");
JsonArray json = new JsonArray();
offers.forEach(offer -> {

View File

@ -18,6 +18,7 @@ import java.util.Set;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
@ -28,7 +29,6 @@ import net.wurstclient.clickgui.components.ItemListEditButton;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.util.json.JsonException;
import net.wurstclient.util.json.JsonUtils;
import net.wurstclient.util.json.WsonArray;
public final class ItemListSetting extends Setting
{
@ -90,10 +90,17 @@ public final class ItemListSetting extends Setting
{
try
{
WsonArray wson = JsonUtils.getAsArray(json);
itemNames.clear();
wson.getAllStrings().parallelStream()
// if string "default", load default items
if(JsonUtils.getAsString(json, "nope").equals("default"))
{
itemNames.addAll(Arrays.asList(defaultNames));
return;
}
// otherwise, load the items in the JSON array
JsonUtils.getAsArray(json).getAllStrings().parallelStream()
.map(s -> Registries.ITEM.get(new Identifier(s)))
.filter(Objects::nonNull)
.map(i -> Registries.ITEM.getId(i).toString()).distinct()
@ -109,6 +116,10 @@ public final class ItemListSetting extends Setting
@Override
public JsonElement toJson()
{
// if itemNames is the same as defaultNames, save string "default"
if(itemNames.equals(Arrays.asList(defaultNames)))
return new JsonPrimitive("default");
JsonArray json = new JsonArray();
itemNames.forEach(s -> json.add(s));
return json;

View File

@ -326,6 +326,16 @@ public class SliderSetting extends Setting implements SliderLock
public static final ValueDisplay ROUNDING_PRECISION =
v -> (int)v == 0 ? "1" : "0." + "0".repeat((int)v - 1) + "1";
/**
* Treats the stored value as a radius from the center block and
* displays the resulting area. For example, a value of 1 will display
* "3x3", 2 will display "5x5", and so on.
*/
public static final ValueDisplay AREA_FROM_RADIUS = v -> {
int d = 2 * (int)v + 1;
return d + "x" + d;
};
public static final ValueDisplay NONE = v -> "";
public String getValueString(double value);

View File

@ -18,11 +18,21 @@ public final class SwingHandSetting
extends EnumSetting<SwingHandSetting.SwingHand>
{
private static final MinecraftClient MC = WurstClient.MC;
private static final String DESCRIPTION_SUFFIX = buildDescriptionSuffix();
private static final String FULL_DESCRIPTION_SUFFIX =
buildDescriptionSuffix(true);
private static final String REDUCED_DESCRIPTION_SUFFIX =
buildDescriptionSuffix(false);
public SwingHandSetting(String description)
private SwingHandSetting(String name, String description,
SwingHand[] values, SwingHand selected)
{
this(description, SwingHand.SERVER);
super(name, description, values, selected);
}
public SwingHandSetting(String name, String description, SwingHand selected)
{
this(name, description + FULL_DESCRIPTION_SUFFIX, SwingHand.values(),
selected);
}
public SwingHandSetting(String description, SwingHand selected)
@ -30,10 +40,23 @@ public final class SwingHandSetting
this("Swing hand", description, selected);
}
public SwingHandSetting(String name, String description, SwingHand selected)
public SwingHandSetting(String description)
{
super(name, description + DESCRIPTION_SUFFIX, SwingHand.values(),
selected);
this(description, SwingHand.SERVER);
}
public static SwingHandSetting withoutOffOption(String name,
String description, SwingHand selected)
{
SwingHand[] values = {SwingHand.SERVER, SwingHand.CLIENT};
return new SwingHandSetting(name,
description + REDUCED_DESCRIPTION_SUFFIX, values, selected);
}
public static SwingHandSetting withoutOffOption(String description,
SwingHand selected)
{
return withoutOffOption("Swing hand", description, selected);
}
public void swing(Hand hand)
@ -41,11 +64,13 @@ public final class SwingHandSetting
getSelected().swing(hand);
}
private static String buildDescriptionSuffix()
private static String buildDescriptionSuffix(boolean includeOff)
{
StringBuilder builder = new StringBuilder("\n\n");
SwingHand[] values = includeOff ? SwingHand.values()
: new SwingHand[]{SwingHand.SERVER, SwingHand.CLIENT};
for(SwingHand value : SwingHand.values())
for(SwingHand value : values)
builder.append("\u00a7l").append(value.name).append("\u00a7r - ")
.append(value.description).append("\n\n");

View File

@ -8,6 +8,7 @@
package net.wurstclient.settings.filters;
import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.entity.passive.TadpoleEntity;
@ -24,6 +25,10 @@ public final class FilterBabiesSetting extends EntityFilterCheckbox
@Override
public boolean test(Entity e)
{
// never filter out hostile mobs (including hoglins)
if(e instanceof Monster)
return true;
// filter out passive entity babies
if(e instanceof PassiveEntity pe && pe.isBaby())
return false;

View File

@ -27,7 +27,7 @@ public final class FilterHostileSetting extends EntityFilterCheckbox
{
// never filter out neutral mobs (including piglins)
if(e instanceof Angerable || e instanceof PiglinEntity)
return false;
return true;
return !(e instanceof Monster);
}

View File

@ -10,6 +10,7 @@ package net.wurstclient.settings.filters;
import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.AmbientEntity;
import net.minecraft.entity.mob.Angerable;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.mob.WaterCreatureEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PufferfishEntity;
@ -27,6 +28,10 @@ public final class FilterPassiveSetting extends EntityFilterCheckbox
@Override
public boolean test(Entity e)
{
// never filter out hostile mobs (including hoglins)
if(e instanceof Monster)
return true;
// never filter out neutral mobs (including pufferfish)
if(e instanceof Angerable || e instanceof PufferfishEntity)
return true;

View File

@ -83,12 +83,21 @@ public final class WurstUpdater implements UpdateListener
e.printStackTrace();
}
String currentVersionEncoded = URLEncoder.encode(
"Wurst " + currentVersion + " MC" + WurstClient.MC_VERSION,
StandardCharsets.UTF_8);
String baseUrl = "https://www.wurstclient.net/download/";
String utmSource = "Wurst+Client";
String utmMedium = "WurstUpdater+chat+message";
if(latestVersion == null || latestVersion.isInvalid())
{
String text = "An error occurred while checking for updates."
+ " Click \u00a7nhere\u00a7r to check manually.";
String url =
"https://www.wurstclient.net/download/?utm_source=Wurst+Client&utm_medium=WurstUpdater+chat+message&utm_content=An+error+occurred+while+checking+for+updates.";
String url = baseUrl + "?utm_source=" + utmSource + "&utm_medium="
+ utmMedium + "&utm_content=" + currentVersionEncoded
+ "+error+checking+updates+chat+message";
showLink(text, url);
return;
}
@ -96,13 +105,14 @@ public final class WurstUpdater implements UpdateListener
if(!outdated)
return;
String textPart1 = "Wurst " + latestVersion + " MC"
+ WurstClient.MC_VERSION + " is now available.";
String text =
textPart1 + " Click \u00a7nhere\u00a7r to download the update.";
String url =
"https://www.wurstclient.net/download/?utm_source=Wurst+Client&utm_medium=WurstUpdater+chat+message&utm_content="
+ URLEncoder.encode(textPart1, StandardCharsets.UTF_8);
String text = "Wurst " + latestVersion
+ " is now available for Minecraft " + WurstClient.MC_VERSION
+ ". \u00a7nUpdate now\u00a7r to benefit from new features and/or bugfixes!";
String utmContent = currentVersionEncoded + "+update+chat+message";
String url = baseUrl + "?utm_source=" + utmSource + "&utm_medium="
+ utmMedium + "&utm_content=" + utmContent;
showLink(text, url);
}

View File

@ -14,6 +14,7 @@ import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
@ -126,13 +127,18 @@ public enum BlockBreaker
side = sides[i];
}
return new BlockBreakingParams(side, hitVecs[side.ordinal()],
return new BlockBreakingParams(pos, side, hitVecs[side.ordinal()],
distancesSq[side.ordinal()], linesOfSight[side.ordinal()]);
}
public static record BlockBreakingParams(Direction side, Vec3d hitVec,
double distanceSq, boolean lineOfSight)
{}
public static record BlockBreakingParams(BlockPos pos, Direction side,
Vec3d hitVec, double distanceSq, boolean lineOfSight)
{
public BlockHitResult toHitResult()
{
return new BlockHitResult(hitVec, side, pos, false);
}
}
public static void breakBlocksWithPacketSpam(Iterable<BlockPos> blocks)
{

View File

@ -120,10 +120,10 @@ public enum RotationUtils
float pitchChange =
Math.abs(MathHelper.wrapDegrees(endPitch - startPitch));
float maxChangeYaw =
Math.min(maxChange, maxChange * yawChange / pitchChange);
float maxChangePitch =
Math.min(maxChange, maxChange * pitchChange / yawChange);
float maxChangeYaw = pitchChange == 0 ? maxChange
: Math.min(maxChange, maxChange * yawChange / pitchChange);
float maxChangePitch = yawChange == 0 ? maxChange
: Math.min(maxChange, maxChange * pitchChange / yawChange);
float nextYaw = limitAngleChange(startYaw, endYaw, maxChangeYaw);
float nextPitch =

View File

@ -0,0 +1,17 @@
{
"targets": [
"swap"
],
"passes": [
{
"name": "lsd",
"intarget": "minecraft:main",
"outtarget": "swap"
},
{
"name": "blit",
"intarget": "swap",
"outtarget": "minecraft:main"
}
]
}

View File

@ -0,0 +1,60 @@
#version 150
uniform sampler2D DiffuseSampler;
in vec2 texCoord;
in vec2 oneTexel;
uniform vec2 InSize;
uniform float Time;
uniform vec2 Frequency;
uniform vec2 WobbleAmount;
out vec4 fragColor;
vec3 hue(float h)
{
float r = abs(h * 6.0 - 3.0) - 1.0;
float g = 2.0 - abs(h * 6.0 - 2.0);
float b = 2.0 - abs(h * 6.0 - 4.0);
return clamp(vec3(r,g,b), 0.0, 1.0);
}
vec3 HSVtoRGB(vec3 hsv) {
return ((hue(hsv.x) - 1.0) * hsv.y + 1.0) * hsv.z;
}
vec3 RGBtoHSV(vec3 rgb) {
vec3 hsv = vec3(0.0);
hsv.z = max(rgb.r, max(rgb.g, rgb.b));
float min = min(rgb.r, min(rgb.g, rgb.b));
float c = hsv.z - min;
if (c != 0.0)
{
hsv.y = c / hsv.z;
vec3 delta = (hsv.z - rgb) / c;
delta.rgb -= delta.brg;
delta.rg += vec2(2.0, 4.0);
if (rgb.r >= hsv.z) {
hsv.x = delta.b;
} else if (rgb.g >= hsv.z) {
hsv.x = delta.r;
} else {
hsv.x = delta.g;
}
hsv.x = fract(hsv.x / 6.0);
}
return hsv;
}
void main() {
float xOffset = sin(texCoord.y * Frequency.x + Time * 3.1415926535 * 2.0) * WobbleAmount.x;
float yOffset = cos(texCoord.x * Frequency.y + Time * 3.1415926535 * 2.0) * WobbleAmount.y;
vec2 offset = vec2(xOffset, yOffset);
vec4 rgb = texture(DiffuseSampler, texCoord + offset);
vec3 hsv = RGBtoHSV(rgb.rgb);
hsv.x = fract(hsv.x + Time);
fragColor = vec4(HSVtoRGB(hsv), 1.0);
}

View File

@ -0,0 +1,86 @@
{
"blend": {
"func": "add",
"srcrgb": "one",
"dstrgb": "zero"
},
"vertex": "sobel",
"fragment": "lsd",
"attributes": [
"Position"
],
"samplers": [
{
"name": "DiffuseSampler"
}
],
"uniforms": [
{
"name": "ProjMat",
"type": "matrix4x4",
"count": 16,
"values": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0
]
},
{
"name": "InSize",
"type": "float",
"count": 2,
"values": [
1.0,
1.0
]
},
{
"name": "OutSize",
"type": "float",
"count": 2,
"values": [
1.0,
1.0
]
},
{
"name": "Time",
"type": "float",
"count": 1,
"values": [
0.0
]
},
{
"name": "Frequency",
"type": "float",
"count": 2,
"values": [
512.0,
288.0
]
},
{
"name": "WobbleAmount",
"type": "float",
"count": 2,
"values": [
0.002,
0.002
]
}
]
}

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.airplace": "Umožňuje umístit bloky do prázdného prostoru.",
"description.wurst.hack.anchoraura": "Automaticky umísťí (volitelně), nabije a odpalí kotvy oživení k zabití entit kolem vás.",
"description.wurst.hack.antiafk": "Prochází se náhodně, aby vás skryl před AFK detektory.\nPotřebuje alespoň 3x3 bloků volného místa.",
"description.wurst.hack.antiafk": "Prochází se náhodně, aby vás skryl před AFK detektory.",
"description.wurst.hack.antiblind": "Zabraňuje blindness a efekty tmy.\nNekompatibilní s OptiFinem.",
"description.wurst.hack.anticactus": "Chrání vás před poškozením kaktusem.",
"description.wurst.hack.antihunger": "Zpomalí váš hlad, když chodíte.",

View File

@ -2,7 +2,7 @@
"description.wurst.hack.aimassist": "Hilft dir dabei, auf Mobs und Spieler in deiner Umgebung zu zielen.",
"description.wurst.hack.airplace": "Ermöglicht dir, Blöcke in der Luft zu platzieren.",
"description.wurst.hack.anchoraura": "Platziert automatisch Seelenanker um dich herum, lädt diese mit Glowstone auf, und sprengt sie dann, um damit Mobs und Spieler um dich herum zu killen.",
"description.wurst.hack.antiafk": "Läuft zufällig durch die Gegend, um dich vor Anti-AFK Plugins zu verstecken.\nBenötigt mindestens 3x3 Blöcke freien Platz.",
"description.wurst.hack.antiafk": "Läuft zufällig durch die Gegend, um dich vor Anti-AFK Plugins zu verstecken.",
"description.wurst.hack.antiblind": "Verhindert Blindheits- und Dunkelheitseffekte.\nNicht kompatibel mit OptiFine.",
"description.wurst.hack.anticactus": "Schützt dich vor Kakteen.",
"description.wurst.hack.antihunger": "Verlangsamt deinen Hunger während du läufst.",

View File

@ -2,7 +2,7 @@
"description.wurst.hack.aimassist": "Helps you aim at nearby entities.",
"description.wurst.hack.airplace": "Allows you to place blocks in mid-air.",
"description.wurst.hack.anchoraura": "Automatically places (optional), charges, and detonates respawn anchors to kill entities around you.",
"description.wurst.hack.antiafk": "Walks around randomly to hide you from AFK detectors.\nNeeds at least 3x3 blocks of free space.",
"description.wurst.hack.antiafk": "Walks around randomly to hide you from AFK detectors.",
"description.wurst.hack.antiblind": "Prevents blindness and darkness effects.\nIncompatible with OptiFine.",
"description.wurst.hack.anticactus": "Protects you from cactus damage.",
"description.wurst.hack.antientitypush": "Prevents you from getting pushed by players and mobs.",
@ -16,7 +16,7 @@
"description.wurst.setting.arrowdmg.trident_yeet_mode": "When enabled, tridents fly much further. Doesn't seem to affect damage or Riptide.\n\n§c§lWARNING:§r You can easily lose your trident by enabling this option!",
"description.wurst.hack.autoarmor": "Manages your armor automatically.",
"description.wurst.hack.autobuild": "Builds things automatically.\nPlace a single block to start building.",
"description.wurst.hack.autocomplete": "Auto-completes your chat messages using large language models. Requires either an OpenAI account with API access or a locally installed language model with the oobabooga web UI.",
"description.wurst.hack.autocomplete": "Auto-completes your chat messages using large language models. Requires an OpenAI account with API access or any other language model API that is OpenAI-compatible.",
"description.wurst.hack.autodrop": "Automatically drops unwanted items.",
"description.wurst.hack.autoleave": "Automatically leaves the server when your health is low.",
"description.wurst.hack.autolibrarian": "Automatically trains a villager to become a librarian that sells a specific enchanted book. You can set up an entire trading hall in no time by using this hack.",

View File

@ -1,6 +1,6 @@
{
"description.wurst.hack.anchoraura": "Place automatiquement (optionnel), charge et fait exploser les ancres de réapparition pour tuer les entités autour de vous.",
"description.wurst.hack.antiafk": "Marche au hasard pour vous cacher des détecteurs d'AFK.\nNécessite au moins 3x3 blocs d'espace libre.",
"description.wurst.hack.antiafk": "Marche au hasard pour vous cacher des détecteurs d'AFK.",
"description.wurst.hack.antiblind": "Empêche l'effet cécité et d'obscurité.\nIncompatible avec OptiFine.",
"description.wurst.hack.anticactus": "Vous protège des dommages causés par les cactus.",
"description.wurst.hack.antiknockback": "Vous empêche d'être poussé par les joueurs et les mobs.",

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.airplace": "Permette di posizionare blocchi in mezz'aria.",
"description.wurst.hack.anchoraura": "Posiziona automaticamente (opzionale), carica e fa esplodere le ancore di rigenerazione per uccidere le entità intorno a te.",
"description.wurst.hack.antiafk": "Cammina randomicamente per nasconderti dai detector di player AFK.\nHa bisogno di almeno un 3x3 di spazio libero.",
"description.wurst.hack.antiafk": "Cammina randomicamente per nasconderti dai detector di player AFK.",
"description.wurst.hack.antiblind": "Previene la cecità ed effetti oscurità.\nIncompatibile con OptiFine.",
"description.wurst.hack.anticactus": "Ti protegge dai danni causati dai cactus.",
"description.wurst.hack.antihunger": "Rallenta la tua fame quando cammini.",

View File

@ -2,7 +2,7 @@
"description.wurst.hack.aimassist": "近くの存在を狙うのに役立ちます。",
"description.wurst.hack.airplace": "空中にブロックを設置できるようになる。",
"description.wurst.hack.anchoraura": "リスポーンアンカーを自動で設置(任意)、チャージ、爆発させ、付近にいるエンティティを倒す。",
"description.wurst.hack.antiafk": "離席を検知されないよう、辺りをランダムに歩き回る。\n最低3×3の広さの自由なスペースが必要。",
"description.wurst.hack.antiafk": "離席を検知されないよう、辺りをランダムに歩き回る。",
"description.wurst.hack.antiblind": "盲目や暗闇の効果を防ぎます。\nOptiFineとの互換性はありません。",
"description.wurst.hack.anticactus": "サボテンのダメージを無効化する。",
"description.wurst.hack.antientitypush": "プレイヤーやモブに押されるのを防ぎます。",
@ -16,7 +16,7 @@
"description.wurst.setting.arrowdmg.trident_yeet_mode": "有効時、トライデントがより遠くまで飛ばせるようになる。ダメージ量や激流エンチャントには影響しない模様。\n\n§c§l注意: §rこのオプションを有効化した場合、トライデントをロストしやすくなる。",
"description.wurst.hack.autoarmor": "防具を自動で管理する。",
"description.wurst.hack.autobuild": "自動で建築を行う。\nブロックを一つ設置することで建築が開始される。",
"description.wurst.hack.autocomplete": "大規模な言語モデルを使用してチャット メッセージをオートコンプリートします。 API アクセスのある OpenAI アカウント、または oobabooga Web UI を使用してローカルにインストールされた言語モデルのいずれかが必要です。",
"description.wurst.hack.autocomplete": "大規模な言語モデルを使用してチャット メッセージをオートコンプリートします。 API アクセス権を持つ OpenAI アカウント、または OpenAI 互換の他の言語モデル API が必要です。",
"description.wurst.hack.autodrop": "必要のないアイテムを自動で捨てる。",
"description.wurst.hack.autoleave": "残り体力が少なくなるとに自動的にサーバーから切断する。",
"description.wurst.hack.autolibrarian": "村人を自動的に訓練して、特定の魔法の本を販売する司書にします。 このハックを使用すると、すぐに取引ホール全体をセットアップできます。",

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.aimassist": "주변 엔티티를 조준하는 데 도움을 줍니다.",
"description.wurst.hack.airplace": "공중에 블록을 배치할 수 있게 해줍니다.",
"description.wurst.hack.antiafk": "자리비움 검출기에서 숨기기 위해 무작위로 이동합니다.\n적어도 3x3 블록의 빈 공간이 필요합니다.",
"description.wurst.hack.antiafk": "자리비움 검출기에서 숨기기 위해 무작위로 이동합니다.",
"description.wurst.hack.antiblind": "실명 및 어둠 효과를 방지합니다.\nOptiFine과 호환되지 않습니다.",
"description.wurst.hack.anticactus": "선인장 대미지를 받지 않습니다.",
"description.wurst.hack.antientitypush": "다른 플레이어나 몹에게 밀려나는 것을 방지합니다.",
@ -12,7 +12,7 @@
"description.wurst.setting.arrowdmg.packets": "전송할 패킷 수.\n패킷이 많을수록 공격력이 높아집니다.",
"description.wurst.hack.autoarmor": "자동으로 방어구를 관리합니다.",
"description.wurst.hack.autobuild": "자동으로 건물을 건설합니다.\n한 개의 블록을 놓으면 건설을 시작합니다.",
"description.wurst.hack.autocomplete": "대형 언어 모델을 사용하여 채팅 메시지를 자동 완성합니다. OpenAI 계정 API 접근 권한이나 지역적으로 설치된 oobabooga 웹 UI가 필요합니다.",
"description.wurst.hack.autocomplete": "대형 언어 모델을 사용하여 채팅 메시지를 자동 완성합니다. OpenAI 계정 API 접근 권한 또는 OpenAI와 호환되는 다른 언어 모델 API가 필요합니다.",
"description.wurst.hack.autodrop": "원하지 않는 아이템을 자동으로 버립니다.",
"description.wurst.hack.autoleave": "체력이 낮을 때 자동으로 서버에서 나갑니다.",
"description.wurst.hack.autolibrarian": "특정 인챈트된 책을 판매하는 마을 주민을 자동으로 훈련합니다. 이 핵을 사용하면 전체 거래 구간을 짧은 시간 내에 설정할 수 있습니다.",

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.airplace": "Pozwala stawiać bloki w powietrzu.",
"description.wurst.hack.anchoraura": "Automatycznie umieszcza (opcjonalnie), ładuje i wysadza kotwice odrodzenia, aby zabijać otaczające cię istoty.",
"description.wurst.hack.antiafk": "Spaceruje losowo dookoła, aby ukryć cię przed wykrywaczami AFK.\nWymaga co najmniej 3x3 bloków wolnego miejsca.",
"description.wurst.hack.antiafk": "Spaceruje losowo dookoła, aby ukryć cię przed wykrywaczami AFK.",
"description.wurst.hack.antiblind": "Zapobiega efektom oślepienia i ciemności.\nNiekompatybilny z OptiFine.",
"description.wurst.hack.anticactus": "Ochrania cię przed obrażeniami od kaktusa.",
"description.wurst.hack.antihunger": "Spowalnia głód podczas chodzenia.",

View File

@ -1,6 +1,6 @@
{
"description.wurst.hack.anchoraura": "Plaseaza automat (optional), incarca, si detoneaza respawn anchoruri pentru a ucide entitati din jurul tau.",
"description.wurst.hack.antiafk": "Umbla anapoda pentru a evita pluginuri anti-afk.\nNeceseita un spatiu liber de cel putin 3x3.",
"description.wurst.hack.antiafk": "Umbla anapoda pentru a evita pluginuri anti-afk.",
"description.wurst.hack.antiblind": "Previne orbirea si efectele întunericului.\nIncompatibl cu OptiFine.",
"description.wurst.hack.anticactus": "Esti protejat de damage-ul dat de cactusi.",
"description.wurst.hack.antiknockback": "Te previne din a fi impins de catre playeri sau mobi.",

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.airplace": "Позволяет ставить блоки в воздухе.",
"description.wurst.hack.anchoraura": "Автоматически ставит (если отмечено), заряжает и взрывает якоря возрождения, чтобы убить сущностей вокруг вас.",
"description.wurst.hack.antiafk": "Ходит в случайном направлении чтобы сервер не знал что Вы АФК.\nДля работы необходимо свободное пространство хотя бы в 3 на 3 блока.",
"description.wurst.hack.antiafk": "Ходит в случайном направлении чтобы сервер не знал что Вы АФК.",
"description.wurst.hack.antiblind": "Предотвращает эффекты слепоты и темноты.\nНесовместим с OptiFine.",
"description.wurst.hack.anticactus": "Защищает Вас от урона от столкновения с кактусами.",
"description.wurst.hack.antihunger": "Замедляет уменьшение голода, когда вы ходите.",

View File

@ -1,6 +1,6 @@
{
"description.wurst.hack.anchoraura": "Автоматично ставить (якщо прийнято), заряджає і підриває якоря відродження, щоб убити сутності навколо.",
"description.wurst.hack.antiafk": "Ходить у випадковому напрямку, щоб сервер не знав, що ви є АФК.\nДля роботи необхідний простір хоча б 3х3 блоку.",
"description.wurst.hack.antiafk": "Ходить у випадковому напрямку, щоб сервер не знав, що ви є АФК.",
"description.wurst.hack.antiblind": "Запобігає ефекту сліпоти та темряви.\nНесумісний з OptiFine.",
"description.wurst.hack.anticactus": "Захищає вас від урону від зіткнення з кактусами.",
"description.wurst.hack.antiknockback": "Запобігає відкиданням при отриманні урону.",

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.airplace": "允许您在空中放置方块。",
"description.wurst.hack.anchoraura": "自动放置(可选),充能,引爆重生锚并击杀你附近的实体。",
"description.wurst.hack.antiafk": "随机走动,用于避免服务器挂机检测。\n需要至少有 3x3 的区域可以走动。",
"description.wurst.hack.antiafk": "随机走动,用于避免服务器挂机检测。",
"description.wurst.hack.antiblind": "防止失明和黑暗效果。\n与 OptiFine 不兼容。",
"description.wurst.hack.anticactus": "保护你免受仙人掌伤害。",
"description.wurst.hack.antihunger": "在你走路时减缓你的饥饿状态。",

View File

@ -1,6 +1,6 @@
{
"description.wurst.hack.anchoraura": "自動放置(可選),充能並引爆重生錨以擊殺你附近嘅實體。",
"description.wurst.hack.antiafk": "隨便行,避免被伺服器掛機檢查。\n需 3x3 嘅區域。",
"description.wurst.hack.antiafk": "隨便行,避免被伺服器掛機檢查。",
"OUTDATED.description.wurst.hack.antiblind": "以防盲咗。\n同 OptiFine高清修復唔兼容。",
"description.wurst.hack.anticactus": "保護你避免受到仙人掌傷害。",
"description.wurst.hack.antiknockback": "保護你唔會被其他生物或者玩家推動同埋用劍擊退。",

View File

@ -1,7 +1,7 @@
{
"description.wurst.hack.airplace": "允許你在半空中放置方塊。",
"description.wurst.hack.anchoraura": "自動放置(可選),充能並引爆重生錨並擊殺你附近的實體。",
"description.wurst.hack.antiafk": "隨機走動,用於避免伺服器掛機檢測。\n需要至少有3x3的區域可以走動。",
"description.wurst.hack.antiafk": "隨機走動,用於避免伺服器掛機檢測。",
"description.wurst.hack.antiblind": "防止失明和黑暗效果。\n與 OptiFine不相容。",
"description.wurst.hack.anticactus": "保護你免受仙人掌傷害。",
"description.wurst.hack.antihunger": "走路時減緩你的飢餓度。",

View File

@ -1,6 +1,7 @@
accessWidener v1 named
accessible class net/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier
accessible method net/minecraft/client/MinecraftClient doItemUse ()V
accessible method net/minecraft/client/Mouse onMouseButton (JIII)V
accessible method net/minecraft/client/render/BackgroundRenderer getFogModifier (Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;
accessible method net/minecraft/client/render/GameRenderer loadPostProcessor (Lnet/minecraft/util/Identifier;)V
accessible method net/minecraft/entity/projectile/FishingBobberEntity isOpenOrWaterAround (Lnet/minecraft/util/math/BlockPos;)Z