mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Merge tag 'v7.37' into 23w32a
This commit is contained in:
commit
9ebda7eb57
@ -13,7 +13,7 @@ loader_version=0.14.22
|
||||
fabric_version=0.86.2+1.20.2
|
||||
|
||||
# Mod Properties
|
||||
mod_version = v7.36-MC23w32a
|
||||
mod_version = v7.37-MC23w32a
|
||||
maven_group = net.wurstclient
|
||||
archives_base_name = Wurst-Client
|
||||
|
||||
|
@ -56,7 +56,7 @@ public enum WurstClient
|
||||
public static MinecraftClient MC;
|
||||
public static IMinecraftClient IMC;
|
||||
|
||||
public static final String VERSION = "7.36";
|
||||
public static final String VERSION = "7.37";
|
||||
public static final String MC_VERSION = "23w32a";
|
||||
|
||||
private WurstAnalytics analytics;
|
||||
|
@ -10,6 +10,7 @@ package net.wurstclient.events;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.wurstclient.event.Event;
|
||||
import net.wurstclient.event.Listener;
|
||||
|
||||
@ -21,11 +22,13 @@ public interface ShouldDrawSideListener extends Listener
|
||||
extends Event<ShouldDrawSideListener>
|
||||
{
|
||||
private final BlockState state;
|
||||
private final BlockPos pos;
|
||||
private Boolean rendered;
|
||||
|
||||
public ShouldDrawSideEvent(BlockState state)
|
||||
public ShouldDrawSideEvent(BlockState state, BlockPos pos)
|
||||
{
|
||||
this.state = state;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
public BlockState getState()
|
||||
@ -33,6 +36,11 @@ public interface ShouldDrawSideListener extends Listener
|
||||
return state;
|
||||
}
|
||||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
public Boolean isRendered()
|
||||
{
|
||||
return rendered;
|
||||
|
@ -10,6 +10,7 @@ package net.wurstclient.events;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.wurstclient.event.CancellableEvent;
|
||||
import net.wurstclient.event.Listener;
|
||||
|
||||
@ -21,10 +22,12 @@ public interface TesselateBlockListener extends Listener
|
||||
extends CancellableEvent<TesselateBlockListener>
|
||||
{
|
||||
private final BlockState state;
|
||||
private final BlockPos pos;
|
||||
|
||||
public TesselateBlockEvent(BlockState state)
|
||||
public TesselateBlockEvent(BlockState state, BlockPos pos)
|
||||
{
|
||||
this.state = state;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
public BlockState getState()
|
||||
@ -32,6 +35,11 @@ public interface TesselateBlockListener extends Listener
|
||||
return state;
|
||||
}
|
||||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fire(ArrayList<TesselateBlockListener> listeners)
|
||||
{
|
||||
|
@ -10,8 +10,6 @@ package net.wurstclient.hacks;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
@ -20,11 +18,7 @@ import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.RespawnAnchorBlock;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -39,6 +33,8 @@ import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.EnumSetting;
|
||||
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.filterlists.AnchorAuraFilterList;
|
||||
@ -48,7 +44,6 @@ import net.wurstclient.util.ChatUtils;
|
||||
import net.wurstclient.util.FakePlayerEntity;
|
||||
import net.wurstclient.util.InventoryUtils;
|
||||
import net.wurstclient.util.RotationUtils;
|
||||
import net.wurstclient.util.RotationUtils.Rotation;
|
||||
|
||||
@SearchTags({"anchor aura", "CrystalAura", "crystal aura"})
|
||||
public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
@ -63,11 +58,12 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
+ "When disabled, AnchorAura will only charge and detonate manually placed anchors.",
|
||||
true);
|
||||
|
||||
private final EnumSetting<FaceBlocks> faceBlocks = new EnumSetting<>(
|
||||
"Face anchors",
|
||||
"Whether or not AnchorAura should face the correct direction when placing and right-clicking respawn anchors.\n\n"
|
||||
+ "Slower but can help with anti-cheat plugins.",
|
||||
FaceBlocks.values(), FaceBlocks.OFF);
|
||||
private final FacingSetting faceBlocks =
|
||||
FacingSetting.withPacketSpam("Face anchors",
|
||||
"Whether or not AnchorAura should face the correct direction when"
|
||||
+ " placing and right-clicking respawn anchors.\n\n"
|
||||
+ "Slower but can help with anti-cheat plugins.",
|
||||
Facing.OFF);
|
||||
|
||||
private final CheckboxSetting checkLOS = new CheckboxSetting(
|
||||
"Check line of sight",
|
||||
@ -132,8 +128,10 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
return;
|
||||
}
|
||||
|
||||
int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot;
|
||||
|
||||
if(!unchargedAnchors.isEmpty()
|
||||
&& hasItem(item -> item == Items.GLOWSTONE))
|
||||
&& InventoryUtils.indexOf(Items.GLOWSTONE, maxInvSlot) >= 0)
|
||||
{
|
||||
charge(unchargedAnchors);
|
||||
// TODO: option to wait until next tick?
|
||||
@ -142,13 +140,14 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
}
|
||||
|
||||
if(!autoPlace.isChecked()
|
||||
|| !hasItem(item -> item == Items.RESPAWN_ANCHOR))
|
||||
|| InventoryUtils.indexOf(Items.RESPAWN_ANCHOR, maxInvSlot) == -1)
|
||||
return;
|
||||
|
||||
ArrayList<Entity> targets = getNearbyTargets();
|
||||
ArrayList<BlockPos> newAnchors = placeAnchorsNear(targets);
|
||||
|
||||
if(!newAnchors.isEmpty() && hasItem(item -> item == Items.GLOWSTONE))
|
||||
if(!newAnchors.isEmpty()
|
||||
&& InventoryUtils.indexOf(Items.GLOWSTONE, maxInvSlot) >= 0)
|
||||
{
|
||||
// TODO: option to wait until next tick?
|
||||
charge(newAnchors);
|
||||
@ -187,9 +186,9 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
if(isSneaking())
|
||||
return;
|
||||
|
||||
InventoryUtils.selectItem(Items.GLOWSTONE,
|
||||
InventoryUtils.selectItem(stack -> !stack.isOf(Items.GLOWSTONE),
|
||||
takeItemsFrom.getSelected().maxInvSlot);
|
||||
if(!MC.player.isHolding(Items.GLOWSTONE))
|
||||
if(MC.player.isHolding(Items.GLOWSTONE))
|
||||
return;
|
||||
|
||||
boolean shouldSwing = false;
|
||||
@ -222,23 +221,6 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
MC.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
|
||||
private boolean hasItem(Predicate<Item> item)
|
||||
{
|
||||
PlayerInventory inventory = MC.player.getInventory();
|
||||
int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot;
|
||||
|
||||
for(int slot = 0; slot < maxInvSlot; slot++)
|
||||
{
|
||||
ItemStack stack = inventory.getStack(slot);
|
||||
if(!item.test(stack.getItem()))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean rightClickBlock(BlockPos pos)
|
||||
{
|
||||
Vec3d eyesPos = RotationUtils.getEyesPos();
|
||||
@ -423,45 +405,6 @@ public final class AnchorAuraHack extends Hack implements UpdateListener
|
||||
return MC.player.isSneaking() || WURST.getHax().sneakHack.isEnabled();
|
||||
}
|
||||
|
||||
private enum FaceBlocks
|
||||
{
|
||||
OFF("Off", v -> {}),
|
||||
|
||||
SERVER("Server-side",
|
||||
v -> WURST.getRotationFaker().faceVectorPacket(v)),
|
||||
|
||||
CLIENT("Client-side",
|
||||
v -> WURST.getRotationFaker().faceVectorClient(v)),
|
||||
|
||||
SPAM("Packet spam", v -> {
|
||||
Rotation rotation = RotationUtils.getNeededRotations(v);
|
||||
PlayerMoveC2SPacket.LookAndOnGround packet =
|
||||
new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(),
|
||||
rotation.getPitch(), MC.player.isOnGround());
|
||||
MC.player.networkHandler.sendPacket(packet);
|
||||
});
|
||||
|
||||
private String name;
|
||||
private Consumer<Vec3d> face;
|
||||
|
||||
private FaceBlocks(String name, Consumer<Vec3d> face)
|
||||
{
|
||||
this.name = name;
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
public void face(Vec3d v)
|
||||
{
|
||||
face.accept(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private enum TakeItemsFrom
|
||||
{
|
||||
HOTBAR("Hotbar", 9),
|
||||
|
@ -89,8 +89,8 @@ public final class AutoLibrarianHack extends Hack
|
||||
private final SliderSetting range =
|
||||
new SliderSetting("Range", 5, 1, 6, 0.05, ValueDisplay.DECIMAL);
|
||||
|
||||
private final FacingSetting facing =
|
||||
new FacingSetting("How to face the villager and job site.\n\n"
|
||||
private final FacingSetting facing = FacingSetting
|
||||
.withoutPacketSpam("How to face the villager and job site.\n\n"
|
||||
+ "\u00a7lOff\u00a7r - Don't face the villager at all. Will be"
|
||||
+ " detected by anti-cheat plugins.\n\n"
|
||||
+ "\u00a7lServer-side\u00a7r - Face the villager on the"
|
||||
|
@ -63,7 +63,7 @@ public final class BuildRandomHack extends Hack
|
||||
"Ensure that BuildRandom won't try to place blocks behind walls.",
|
||||
false);
|
||||
|
||||
private final FacingSetting facing = new FacingSetting(
|
||||
private final FacingSetting facing = FacingSetting.withoutPacketSpam(
|
||||
"How BuildRandom should face the randomly placed blocks.\n\n"
|
||||
+ "\u00a7lOff\u00a7r - Don't face the blocks at all. Will be"
|
||||
+ " detected by anti-cheat plugins.\n\n"
|
||||
|
@ -9,8 +9,6 @@ package net.wurstclient.hacks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
@ -21,11 +19,7 @@ import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.decoration.EndCrystalEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -37,17 +31,18 @@ import net.wurstclient.Category;
|
||||
import net.wurstclient.SearchTags;
|
||||
import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.mixinterface.IClientPlayerInteractionManager;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.EnumSetting;
|
||||
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.filterlists.CrystalAuraFilterList;
|
||||
import net.wurstclient.settings.filterlists.EntityFilterList;
|
||||
import net.wurstclient.util.BlockUtils;
|
||||
import net.wurstclient.util.FakePlayerEntity;
|
||||
import net.wurstclient.util.InventoryUtils;
|
||||
import net.wurstclient.util.RotationUtils;
|
||||
import net.wurstclient.util.RotationUtils.Rotation;
|
||||
|
||||
@SearchTags({"crystal aura"})
|
||||
public final class CrystalAuraHack extends Hack implements UpdateListener
|
||||
@ -62,11 +57,12 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
|
||||
+ "When disabled, CrystalAura will only detonate manually placed crystals.",
|
||||
true);
|
||||
|
||||
private final EnumSetting<FaceBlocks> faceBlocks = new EnumSetting<>(
|
||||
"Face crystals",
|
||||
"Whether or not CrystalAura should face the correct direction when placing and left-clicking end crystals.\n\n"
|
||||
+ "Slower but can help with anti-cheat plugins.",
|
||||
FaceBlocks.values(), FaceBlocks.OFF);
|
||||
private final FacingSetting faceBlocks =
|
||||
FacingSetting.withPacketSpam("Face crystals",
|
||||
"Whether or not CrystalAura should face the correct direction when"
|
||||
+ " placing and left-clicking end crystals.\n\n"
|
||||
+ "Slower but can help with anti-cheat plugins.",
|
||||
Facing.OFF);
|
||||
|
||||
private final CheckboxSetting checkLOS = new CheckboxSetting(
|
||||
"Check line of sight",
|
||||
@ -129,8 +125,11 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
|
||||
return;
|
||||
}
|
||||
|
||||
if(!autoPlace.isChecked()
|
||||
|| !hasItem(item -> item == Items.END_CRYSTAL))
|
||||
if(!autoPlace.isChecked())
|
||||
return;
|
||||
|
||||
if(InventoryUtils.indexOf(Items.END_CRYSTAL,
|
||||
takeItemsFrom.getSelected().maxInvSlot) == -1)
|
||||
return;
|
||||
|
||||
ArrayList<Entity> targets = getNearbyTargets();
|
||||
@ -175,56 +174,6 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
|
||||
MC.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
|
||||
private boolean selectItem(Predicate<Item> item)
|
||||
{
|
||||
PlayerInventory inventory = MC.player.getInventory();
|
||||
IClientPlayerInteractionManager im = IMC.getInteractionManager();
|
||||
int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot;
|
||||
|
||||
for(int slot = 0; slot < maxInvSlot; slot++)
|
||||
{
|
||||
ItemStack stack = inventory.getStack(slot);
|
||||
if(!item.test(stack.getItem()))
|
||||
continue;
|
||||
|
||||
if(slot < 9)
|
||||
inventory.selectedSlot = slot;
|
||||
else if(inventory.getEmptySlot() < 9)
|
||||
im.windowClick_QUICK_MOVE(slot);
|
||||
else if(inventory.getEmptySlot() != -1)
|
||||
{
|
||||
im.windowClick_QUICK_MOVE(inventory.selectedSlot + 36);
|
||||
im.windowClick_QUICK_MOVE(slot);
|
||||
}else
|
||||
{
|
||||
im.windowClick_PICKUP(inventory.selectedSlot + 36);
|
||||
im.windowClick_PICKUP(slot);
|
||||
im.windowClick_PICKUP(inventory.selectedSlot + 36);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasItem(Predicate<Item> item)
|
||||
{
|
||||
PlayerInventory inventory = MC.player.getInventory();
|
||||
int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot;
|
||||
|
||||
for(int slot = 0; slot < maxInvSlot; slot++)
|
||||
{
|
||||
ItemStack stack = inventory.getStack(slot);
|
||||
if(!item.test(stack.getItem()))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean placeCrystal(BlockPos pos)
|
||||
{
|
||||
Vec3d eyesPos = RotationUtils.getEyesPos();
|
||||
@ -258,7 +207,9 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
|
||||
.getType() != HitResult.Type.MISS)
|
||||
continue;
|
||||
|
||||
if(!selectItem(item -> item == Items.END_CRYSTAL))
|
||||
InventoryUtils.selectItem(Items.END_CRYSTAL,
|
||||
takeItemsFrom.getSelected().maxInvSlot);
|
||||
if(!MC.player.isHolding(Items.END_CRYSTAL))
|
||||
return false;
|
||||
|
||||
faceBlocks.getSelected().face(hitVec);
|
||||
@ -358,45 +309,6 @@ public final class CrystalAuraHack extends Hack implements UpdateListener
|
||||
&& !BlockUtils.getState(pos).isReplaceable();
|
||||
}
|
||||
|
||||
private enum FaceBlocks
|
||||
{
|
||||
OFF("Off", v -> {}),
|
||||
|
||||
SERVER("Server-side",
|
||||
v -> WURST.getRotationFaker().faceVectorPacket(v)),
|
||||
|
||||
CLIENT("Client-side",
|
||||
v -> WURST.getRotationFaker().faceVectorClient(v)),
|
||||
|
||||
SPAM("Packet spam", v -> {
|
||||
Rotation rotation = RotationUtils.getNeededRotations(v);
|
||||
PlayerMoveC2SPacket.LookAndOnGround packet =
|
||||
new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(),
|
||||
rotation.getPitch(), MC.player.isOnGround());
|
||||
MC.player.networkHandler.sendPacket(packet);
|
||||
});
|
||||
|
||||
private String name;
|
||||
private Consumer<Vec3d> face;
|
||||
|
||||
private FaceBlocks(String name, Consumer<Vec3d> face)
|
||||
{
|
||||
this.name = name;
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
public void face(Vec3d v)
|
||||
{
|
||||
face.accept(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private enum TakeItemsFrom
|
||||
{
|
||||
HOTBAR("Hotbar", 9),
|
||||
|
@ -99,9 +99,7 @@ public final class FullbrightHack extends Hack implements UpdateListener
|
||||
wasGammaChanged = true;
|
||||
|
||||
SimpleOption<Double> gammaOption = MC.options.getGamma();
|
||||
@SuppressWarnings("unchecked")
|
||||
ISimpleOption<Double> gammaOption2 =
|
||||
(ISimpleOption<Double>)(Object)gammaOption;
|
||||
ISimpleOption<Double> gammaOption2 = ISimpleOption.get(gammaOption);
|
||||
double oldGammaValue = gammaOption.getValue();
|
||||
|
||||
if(!fade.isChecked() || Math.abs(oldGammaValue - target) <= 0.5)
|
||||
@ -119,9 +117,7 @@ public final class FullbrightHack extends Hack implements UpdateListener
|
||||
private void resetGamma(double target)
|
||||
{
|
||||
SimpleOption<Double> gammaOption = MC.options.getGamma();
|
||||
@SuppressWarnings("unchecked")
|
||||
ISimpleOption<Double> gammaOption2 =
|
||||
(ISimpleOption<Double>)(Object)gammaOption;
|
||||
ISimpleOption<Double> gammaOption2 = ISimpleOption.get(gammaOption);
|
||||
double oldGammaValue = gammaOption.getValue();
|
||||
|
||||
if(!fade.isChecked() || Math.abs(oldGammaValue - target) <= 0.5)
|
||||
@ -167,6 +163,15 @@ public final class FullbrightHack extends Hack implements UpdateListener
|
||||
return nightVisionStrength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of Fullbright's "Default brightness" slider. Used by
|
||||
* {@link XRayHack} to restore the gamma value when X-Ray is turned off.
|
||||
*/
|
||||
public double getDefaultGamma()
|
||||
{
|
||||
return defaultGamma.getValue();
|
||||
}
|
||||
|
||||
private static enum Method
|
||||
{
|
||||
GAMMA("Gamma"),
|
||||
|
@ -9,15 +9,15 @@ package net.wurstclient.hacks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.fabricmc.loader.api.metadata.ModMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.wurstclient.Category;
|
||||
import net.wurstclient.SearchTags;
|
||||
import net.wurstclient.clickgui.screens.EditBlockListScreen;
|
||||
@ -30,6 +30,7 @@ import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.mixinterface.ISimpleOption;
|
||||
import net.wurstclient.settings.BlockListSetting;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.util.BlockUtils;
|
||||
import net.wurstclient.util.ChatUtils;
|
||||
|
||||
@ -38,7 +39,10 @@ public final class XRayHack extends Hack implements UpdateListener,
|
||||
SetOpaqueCubeListener, GetAmbientOcclusionLightLevelListener,
|
||||
ShouldDrawSideListener, TesselateBlockListener, RenderBlockEntityListener
|
||||
{
|
||||
private final BlockListSetting ores = new BlockListSetting("Ores", "",
|
||||
private final BlockListSetting ores = new BlockListSetting("Ores",
|
||||
"A list of blocks that X-Ray will show. They don't have to be just ores"
|
||||
+ " - you can add any block you want.\n\n"
|
||||
+ "Remember to restart X-Ray when changing this setting.",
|
||||
"minecraft:ancient_debris", "minecraft:anvil", "minecraft:beacon",
|
||||
"minecraft:bone_block", "minecraft:bookshelf",
|
||||
"minecraft:brewing_stand", "minecraft:chain_command_block",
|
||||
@ -66,28 +70,26 @@ public final class XRayHack extends Hack implements UpdateListener,
|
||||
"minecraft:suspicious_sand", "minecraft:tnt", "minecraft:torch",
|
||||
"minecraft:trapped_chest", "minecraft:water");
|
||||
|
||||
private ArrayList<String> oreNames;
|
||||
private final String warning;
|
||||
private final CheckboxSetting onlyExposed = new CheckboxSetting(
|
||||
"Only show exposed",
|
||||
"Only shows ores that would be visible in caves. This can help against"
|
||||
+ " anti-X-Ray plugins.\n\n"
|
||||
+ "Remember to restart X-Ray when changing this setting.",
|
||||
false);
|
||||
|
||||
private final String optiFineWarning;
|
||||
private final String renderName =
|
||||
Math.random() < 0.01 ? "X-Wurst" : getName();
|
||||
|
||||
private ArrayList<String> oreNamesCache;
|
||||
|
||||
public XRayHack()
|
||||
{
|
||||
super("X-Ray");
|
||||
setCategory(Category.RENDER);
|
||||
addSetting(ores);
|
||||
|
||||
List<String> mods = FabricLoader.getInstance().getAllMods().stream()
|
||||
.map(ModContainer::getMetadata).map(ModMetadata::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Pattern optifine = Pattern.compile("opti(?:fine|fabric).*");
|
||||
|
||||
if(mods.stream().anyMatch(optifine.asPredicate()))
|
||||
warning = "OptiFine is installed. X-Ray will not work properly!";
|
||||
else
|
||||
warning = null;
|
||||
addSetting(onlyExposed);
|
||||
optiFineWarning = checkOptiFine();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,49 +101,51 @@ public final class XRayHack extends Hack implements UpdateListener,
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
oreNames = new ArrayList<>(ores.getBlockNames());
|
||||
// cache block names in case the setting changes while X-Ray is enabled
|
||||
oreNamesCache = new ArrayList<>(ores.getBlockNames());
|
||||
|
||||
// add event listeners
|
||||
EVENTS.add(UpdateListener.class, this);
|
||||
EVENTS.add(SetOpaqueCubeListener.class, this);
|
||||
EVENTS.add(GetAmbientOcclusionLightLevelListener.class, this);
|
||||
EVENTS.add(ShouldDrawSideListener.class, this);
|
||||
EVENTS.add(TesselateBlockListener.class, this);
|
||||
EVENTS.add(RenderBlockEntityListener.class, this);
|
||||
|
||||
// reload chunks
|
||||
MC.worldRenderer.reload();
|
||||
|
||||
if(warning != null)
|
||||
ChatUtils.warning(warning);
|
||||
// display warning if OptiFine is detected
|
||||
if(optiFineWarning != null)
|
||||
ChatUtils.warning(optiFineWarning);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
// remove event listeners
|
||||
EVENTS.remove(UpdateListener.class, this);
|
||||
EVENTS.remove(SetOpaqueCubeListener.class, this);
|
||||
EVENTS.remove(GetAmbientOcclusionLightLevelListener.class, this);
|
||||
EVENTS.remove(ShouldDrawSideListener.class, this);
|
||||
EVENTS.remove(TesselateBlockListener.class, this);
|
||||
EVENTS.remove(RenderBlockEntityListener.class, this);
|
||||
|
||||
// reload chunks
|
||||
MC.worldRenderer.reload();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ISimpleOption<Double> gammaOption =
|
||||
(ISimpleOption<Double>)(Object)MC.options.getGamma();
|
||||
|
||||
// TODO: Why does this use 0.5 instead of
|
||||
// FullBright's defaultGamma setting?
|
||||
if(!WURST.getHax().fullbrightHack.isEnabled())
|
||||
gammaOption.forceSetValue(0.5);
|
||||
// reset gamma
|
||||
FullbrightHack fullbright = WURST.getHax().fullbrightHack;
|
||||
if(!fullbright.isEnabled())
|
||||
ISimpleOption.get(MC.options.getGamma())
|
||||
.forceSetValue(fullbright.getDefaultGamma());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
ISimpleOption<Double> gammaOption =
|
||||
(ISimpleOption<Double>)(Object)MC.options.getGamma();
|
||||
|
||||
gammaOption.forceSetValue(16.0);
|
||||
// force gamma to 16 so that ores are bright enough to see
|
||||
ISimpleOption.get(MC.options.getGamma()).forceSetValue(16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -160,32 +164,61 @@ public final class XRayHack extends Hack implements UpdateListener,
|
||||
@Override
|
||||
public void onShouldDrawSide(ShouldDrawSideEvent event)
|
||||
{
|
||||
event.setRendered(isVisible(event.getState().getBlock()));
|
||||
event.setRendered(
|
||||
isVisible(event.getState().getBlock(), event.getPos()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTesselateBlock(TesselateBlockEvent event)
|
||||
{
|
||||
if(!isVisible(event.getState().getBlock()))
|
||||
if(!isVisible(event.getState().getBlock(), event.getPos()))
|
||||
event.cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBlockEntity(RenderBlockEntityEvent event)
|
||||
{
|
||||
if(!isVisible(BlockUtils.getBlock(event.getBlockEntity().getPos())))
|
||||
BlockPos pos = event.getBlockEntity().getPos();
|
||||
if(!isVisible(BlockUtils.getBlock(pos), pos))
|
||||
event.cancel();
|
||||
}
|
||||
|
||||
private boolean isVisible(Block block, BlockPos pos)
|
||||
{
|
||||
String name = BlockUtils.getName(block);
|
||||
int index = Collections.binarySearch(oreNamesCache, name);
|
||||
boolean visible = index >= 0;
|
||||
|
||||
if(visible && onlyExposed.isChecked())
|
||||
return !BlockUtils.isOpaqueFullCube(pos.up())
|
||||
|| !BlockUtils.isOpaqueFullCube(pos.down())
|
||||
|| !BlockUtils.isOpaqueFullCube(pos.east())
|
||||
|| !BlockUtils.isOpaqueFullCube(pos.west())
|
||||
|| !BlockUtils.isOpaqueFullCube(pos.north())
|
||||
|| !BlockUtils.isOpaqueFullCube(pos.south());
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if OptiFine/OptiFabric is installed and returns a warning message
|
||||
* if it is.
|
||||
*/
|
||||
private String checkOptiFine()
|
||||
{
|
||||
Stream<String> mods = FabricLoader.getInstance().getAllMods().stream()
|
||||
.map(ModContainer::getMetadata).map(ModMetadata::getId);
|
||||
|
||||
Pattern optifine = Pattern.compile("opti(?:fine|fabric).*");
|
||||
|
||||
if(mods.anyMatch(optifine.asPredicate()))
|
||||
return "OptiFine is installed. X-Ray will not work properly!";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void openBlockListEditor(Screen prevScreen)
|
||||
{
|
||||
MC.setScreen(new EditBlockListScreen(prevScreen, ores));
|
||||
}
|
||||
|
||||
private boolean isVisible(Block block)
|
||||
{
|
||||
String name = BlockUtils.getName(block);
|
||||
int index = Collections.binarySearch(oreNames, name);
|
||||
return index >= 0;
|
||||
}
|
||||
}
|
||||
|
@ -26,23 +26,22 @@ import net.wurstclient.hack.HackList;
|
||||
@Mixin(Block.class)
|
||||
public abstract class BlockMixin implements ItemConvertible
|
||||
{
|
||||
@Inject(at = {@At("HEAD")},
|
||||
method = {
|
||||
"shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Z"},
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Z",
|
||||
cancellable = true)
|
||||
private static void onShouldDrawSide(BlockState state, BlockView world,
|
||||
BlockPos pos, Direction direction, BlockPos blockPos,
|
||||
CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state);
|
||||
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos);
|
||||
EventManager.fire(event);
|
||||
|
||||
if(event.isRendered() != null)
|
||||
cir.setReturnValue(event.isRendered());
|
||||
}
|
||||
|
||||
@Inject(at = {@At("HEAD")},
|
||||
method = {"getVelocityMultiplier()F"},
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "getVelocityMultiplier()F",
|
||||
cancellable = true)
|
||||
private void onGetVelocityMultiplier(CallbackInfoReturnable<Float> cir)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ import net.wurstclient.events.TesselateBlockListener.TesselateBlockEvent;
|
||||
@Mixin(BlockModelRenderer.class)
|
||||
public abstract class BlockModelRendererMixin
|
||||
{
|
||||
@Inject(at = {@At("HEAD")},
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = {
|
||||
"renderSmooth(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V",
|
||||
"renderFlat(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V"},
|
||||
@ -38,7 +38,7 @@ public abstract class BlockModelRendererMixin
|
||||
VertexConsumer vertexConsumer, boolean cull, Random random, long seed,
|
||||
int overlay, CallbackInfo ci)
|
||||
{
|
||||
TesselateBlockEvent event = new TesselateBlockEvent(state);
|
||||
TesselateBlockEvent event = new TesselateBlockEvent(state, pos);
|
||||
EventManager.fire(event);
|
||||
|
||||
if(event.isCancelled())
|
||||
@ -50,7 +50,7 @@ public abstract class BlockModelRendererMixin
|
||||
if(!cull)
|
||||
return;
|
||||
|
||||
ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(state);
|
||||
ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(state, pos);
|
||||
EventManager.fire(event2);
|
||||
if(!Boolean.TRUE.equals(event2.isRendered()))
|
||||
return;
|
||||
|
@ -23,16 +23,15 @@ import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent;
|
||||
@Mixin(FluidRenderer.class)
|
||||
public class FluidRendererMixin
|
||||
{
|
||||
@Inject(at = {@At("HEAD")},
|
||||
method = {
|
||||
"isSideCovered(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FLnet/minecraft/block/BlockState;)Z"},
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "isSideCovered(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FLnet/minecraft/block/BlockState;)Z",
|
||||
cancellable = true)
|
||||
private static void onIsSideCovered(BlockView blockView, BlockPos blockPos,
|
||||
Direction direction, float maxDeviation, BlockState blockState,
|
||||
CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
BlockState state = blockView.getBlockState(blockPos);
|
||||
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state);
|
||||
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, blockPos);
|
||||
EventManager.fire(event);
|
||||
|
||||
if(event.isRendered() != null)
|
||||
|
@ -21,20 +21,21 @@ import net.wurstclient.event.EventManager;
|
||||
import net.wurstclient.events.ShouldDrawSideListener;
|
||||
|
||||
@Pseudo
|
||||
@Mixin(
|
||||
targets = "me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache",
|
||||
@Mixin(targets = {
|
||||
"me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache",
|
||||
"me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache"},
|
||||
remap = false)
|
||||
public class SodiumBlockOcclusionCacheMixin
|
||||
{
|
||||
@Inject(method = "shouldDrawSide",
|
||||
at = @At("HEAD"),
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "shouldDrawSide",
|
||||
cancellable = true,
|
||||
remap = false)
|
||||
public void shouldDrawSide(BlockState state, BlockView view, BlockPos pos,
|
||||
Direction facing, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
ShouldDrawSideListener.ShouldDrawSideEvent event =
|
||||
new ShouldDrawSideListener.ShouldDrawSideEvent(state);
|
||||
new ShouldDrawSideListener.ShouldDrawSideEvent(state, pos);
|
||||
EventManager.fire(event);
|
||||
|
||||
if(event.isRendered() != null)
|
||||
|
@ -39,7 +39,8 @@ public class TerrainRenderContextMixin
|
||||
private void onTessellateBlock(BlockState blockState, BlockPos blockPos,
|
||||
final BakedModel model, MatrixStack matrixStack, CallbackInfo ci)
|
||||
{
|
||||
TesselateBlockEvent event = new TesselateBlockEvent(blockState);
|
||||
TesselateBlockEvent event =
|
||||
new TesselateBlockEvent(blockState, blockPos);
|
||||
EventManager.fire(event);
|
||||
|
||||
if(event.isCancelled())
|
||||
|
@ -7,7 +7,23 @@
|
||||
*/
|
||||
package net.wurstclient.mixinterface;
|
||||
|
||||
import net.minecraft.client.option.SimpleOption;
|
||||
|
||||
public interface ISimpleOption<T>
|
||||
{
|
||||
/**
|
||||
* Forces the value of the option to the specified value, even if it's
|
||||
* outside of the normal range.
|
||||
*/
|
||||
public void forceSetValue(T newValue);
|
||||
|
||||
/**
|
||||
* Returns the given SimpleOption object as an ISimpleOption, allowing you
|
||||
* to access the forceSetValue() method.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> ISimpleOption<T> get(SimpleOption<T> option)
|
||||
{
|
||||
return (ISimpleOption<T>)(Object)option;
|
||||
}
|
||||
}
|
||||
|
@ -9,26 +9,40 @@ package net.wurstclient.settings;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.wurstclient.WurstClient;
|
||||
import net.wurstclient.util.RotationUtils;
|
||||
import net.wurstclient.util.RotationUtils.Rotation;
|
||||
|
||||
public final class FacingSetting extends EnumSetting<FacingSetting.Facing>
|
||||
{
|
||||
protected static final WurstClient WURST = WurstClient.INSTANCE;
|
||||
private static final WurstClient WURST = WurstClient.INSTANCE;
|
||||
private static final MinecraftClient MC = WurstClient.MC;
|
||||
|
||||
public FacingSetting(String description)
|
||||
private FacingSetting(String name, String description, Facing[] values,
|
||||
Facing selected)
|
||||
{
|
||||
super("Facing", description, Facing.values(), Facing.SERVER);
|
||||
super(name, description, values, selected);
|
||||
}
|
||||
|
||||
public FacingSetting(String description, Facing selected)
|
||||
public static FacingSetting withoutPacketSpam(String description)
|
||||
{
|
||||
super("Facing", description, Facing.values(), selected);
|
||||
return withoutPacketSpam("Facing", description, Facing.SERVER);
|
||||
}
|
||||
|
||||
public FacingSetting(String name, String description, Facing selected)
|
||||
public static FacingSetting withoutPacketSpam(String name,
|
||||
String description, Facing selected)
|
||||
{
|
||||
super(name, description, Facing.values(), selected);
|
||||
Facing[] values = {Facing.OFF, Facing.SERVER, Facing.CLIENT};
|
||||
return new FacingSetting(name, description, values, selected);
|
||||
}
|
||||
|
||||
public static FacingSetting withPacketSpam(String name, String description,
|
||||
Facing selected)
|
||||
{
|
||||
return new FacingSetting(name, description, Facing.values(), selected);
|
||||
}
|
||||
|
||||
public enum Facing
|
||||
@ -39,7 +53,15 @@ public final class FacingSetting extends EnumSetting<FacingSetting.Facing>
|
||||
v -> WURST.getRotationFaker().faceVectorPacket(v)),
|
||||
|
||||
CLIENT("Client-side",
|
||||
v -> WURST.getRotationFaker().faceVectorClient(v));
|
||||
v -> WURST.getRotationFaker().faceVectorClient(v)),
|
||||
|
||||
SPAM("Packet spam", v -> {
|
||||
Rotation rotation = RotationUtils.getNeededRotations(v);
|
||||
PlayerMoveC2SPacket.LookAndOnGround packet =
|
||||
new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(),
|
||||
rotation.getPitch(), MC.player.isOnGround());
|
||||
MC.player.networkHandler.sendPacket(packet);
|
||||
});
|
||||
|
||||
private String name;
|
||||
private Consumer<Vec3d> face;
|
||||
|
@ -120,6 +120,11 @@ public enum BlockUtils
|
||||
return getOutlineShape(pos) != VoxelShapes.empty();
|
||||
}
|
||||
|
||||
public static boolean isOpaqueFullCube(BlockPos pos)
|
||||
{
|
||||
return getState(pos).isOpaqueFullCube(MC.world, pos);
|
||||
}
|
||||
|
||||
public static ArrayList<BlockPos> getAllInBox(BlockPos from, BlockPos to)
|
||||
{
|
||||
ArrayList<BlockPos> blocks = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user