Skip to content

Commit

Permalink
VIAVERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed Mar 10, 2024
1 parent c551d18 commit d3394ef
Show file tree
Hide file tree
Showing 26 changed files with 96 additions and 106 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def viaLibs = [
"com.viaversion:viabackwards:${project.viabackwards_version}",
"com.viaversion:viarewind-universal:${project.viarewind_version}",
"net.raphimc:ViaLoader:${project.vialoader_version}",
"org.yaml:snakeyaml:${project.snake_yml_version}",
"org.slf4j:slf4j-api:${project.slf4j_version}"
"org.yaml:snakeyaml:${project.snake_yml_version}"
]

dependencies {
Expand All @@ -71,7 +70,6 @@ dependencies {
exclude module: "gson"
exclude module: "launchwrapper"
exclude module: "log4j-core"
exclude module: "slf4j-api"
}

for (final def via in viaLibs) {
Expand Down
11 changes: 5 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ detekt_version = 1.19.0
forgegradle_version = a3d86a59c0
mixingradle_version = ae2a80e

viaversion_version=4.10.0-24w09a-SNAPSHOT
viabackwards_version=4.10.0-24w09a-SNAPSHOT
viarewind_version=3.0.7-24w09a-SNAPSHOT
vialoader_version=2.2.13-SNAPSHOT
viaversion_version=4.9.4-SNAPSHOT
viabackwards_version=4.9.3-SNAPSHOT
viarewind_version=3.0.7-SNAPSHOT
vialoader_version=2.2.12

snake_yml_version=2.2
slf4j_version=2.0.12
snake_yml_version=2.2
4 changes: 2 additions & 2 deletions src/main/java/net/aspw/client/features/api/PacketManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.aspw.client.features.api;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.Launch;
import net.aspw.client.event.*;
import net.aspw.client.features.module.impl.combat.KillAura;
Expand All @@ -17,6 +16,7 @@
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.raphimc.vialoader.util.VersionEnum;

import java.util.Objects;

Expand Down Expand Up @@ -130,7 +130,7 @@ public void onPacket(PacketEvent event) {
}
}

if (ProtocolBase.getManager().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_10)) {
if (ProtocolBase.getManager().getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_10)) {
if (packet instanceof C08PacketPlayerBlockPlacement) {
((C08PacketPlayerBlockPlacement) packet).facingX = 0.5F;
((C08PacketPlayerBlockPlacement) packet).facingY = 0.5F;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.viaversion.viarewind.protocol.protocol1_8to1_9.Protocol1_8To1_9
import com.viaversion.viarewind.utils.PacketUtil
import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.type.Type
import net.aspw.client.Launch
import net.aspw.client.event.*
Expand Down Expand Up @@ -44,6 +43,7 @@ import net.minecraft.util.BlockPos
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumParticleTypes
import net.minecraft.util.Vec3
import net.raphimc.vialoader.util.VersionEnum
import org.lwjgl.opengl.GL11
import java.awt.Color
import java.util.*
Expand Down Expand Up @@ -534,7 +534,7 @@ class KillAura : Module() {
if (multiCombo.get()) {
event.targetEntity ?: return
repeat(amountValue.get()) {
if (ProtocolBase.getManager().targetVersion.newerThan(ProtocolVersion.v1_8))
if (ProtocolBase.getManager().targetVersion.isNewerThan(VersionEnum.r1_8))
mc.netHandler.addToSendQueue(
C02PacketUseEntity(
event.targetEntity,
Expand All @@ -544,7 +544,7 @@ class KillAura : Module() {

mc.netHandler.addToSendQueue(C0APacketAnimation())

if (!ProtocolBase.getManager().targetVersion.newerThan(ProtocolVersion.v1_8))
if (!ProtocolBase.getManager().targetVersion.isNewerThan(VersionEnum.r1_8))
mc.netHandler.addToSendQueue(
C02PacketUseEntity(
event.targetEntity,
Expand Down Expand Up @@ -740,7 +740,7 @@ class KillAura : Module() {
}

// Attack target
if (ProtocolBase.getManager().targetVersion.newerThan(ProtocolVersion.v1_8))
if (ProtocolBase.getManager().targetVersion.isNewerThan(VersionEnum.r1_8))
mc.netHandler.addToSendQueue(C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK))

when (swingValue.get().lowercase(Locale.getDefault())) {
Expand All @@ -754,7 +754,7 @@ class KillAura : Module() {
"packet" -> mc.netHandler.addToSendQueue(C0APacketAnimation())
}

if (!ProtocolBase.getManager().targetVersion.newerThan(ProtocolVersion.v1_8))
if (!ProtocolBase.getManager().targetVersion.isNewerThan(VersionEnum.r1_8))
mc.netHandler.addToSendQueue(C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK))

when (particleValue.get().lowercase()) {
Expand Down Expand Up @@ -911,7 +911,7 @@ class KillAura : Module() {
}

"1.9+" -> {
if (ProtocolBase.getManager().targetVersion.newerThanOrEqualTo(ProtocolVersion.v1_9)) {
if (ProtocolBase.getManager().targetVersion.isNewerThanOrEqualTo(VersionEnum.r1_9)) {
val useItem =
PacketWrapper.create(29, null, Via.getManager().connectionManager.connections.iterator().next())
useItem.write(Type.VAR_INT, 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.aspw.client.features.module.impl.combat

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import net.aspw.client.event.EventTarget
import net.aspw.client.event.UpdateEvent
import net.aspw.client.event.WorldEvent
Expand All @@ -21,6 +20,7 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.network.play.client.C02PacketUseEntity
import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition
import net.minecraft.network.play.client.C0APacketAnimation
import net.raphimc.vialoader.util.VersionEnum
import java.util.*


Expand Down Expand Up @@ -134,15 +134,15 @@ class TPAura : Module() {

lastTarget = it

if (ProtocolBase.getManager().targetVersion.newerThan(ProtocolVersion.v1_8))
if (ProtocolBase.getManager().targetVersion.isNewerThan(VersionEnum.r1_8))
mc.netHandler.addToSendQueue(C02PacketUseEntity(it, C02PacketUseEntity.Action.ATTACK))

when (swingValue.get().lowercase(Locale.getDefault())) {
"normal" -> mc.thePlayer.swingItem()
"packet" -> mc.netHandler.addToSendQueue(C0APacketAnimation())
}

if (!ProtocolBase.getManager().targetVersion.newerThan(ProtocolVersion.v1_8))
if (!ProtocolBase.getManager().targetVersion.isNewerThan(VersionEnum.r1_8))
mc.netHandler.addToSendQueue(C02PacketUseEntity(it, C02PacketUseEntity.Action.ATTACK))

path.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,16 @@ class Speed : Module() {
}

@JvmField
val portMax = FloatValue("AAC-PortLength", 1f, 1f, 20f) { typeValue.get().equals("aac", ignoreCase = true) }
val portMax = FloatValue("AAC-PortLength", 1f, 1f, 20f) {
typeValue.get().equals("aac", ignoreCase = true) && aacModeValue.get().equals("port", true)
}

@JvmField
val aacGroundTimerValue =
FloatValue("AACGround-Timer", 3f, 1.1f, 10f) { typeValue.get().equals("aac", ignoreCase = true) }
FloatValue("AACGround-Timer", 3f, 1.1f, 10f) {
typeValue.get().equals("aac", ignoreCase = true) && (aacModeValue.get()
.equals("ground", true) || aacModeValue.get().equals("ground2", true))
}

@JvmField
val velocitySpeed =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@

import java.util.Map;

/**
* The type Transformer loader.
*/
@IFMLLoadingPlugin.MCVersion("1.8.9")
public class MixinLoader implements IFMLLoadingPlugin {

/**
* Instantiates a new Transformer loader.
*/
public MixinLoader() {
MixinBootstrap.init();
Mixins.addConfiguration("client.forge.mixins.json");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.aspw.client.injection.forge.mixins.block;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.protocol.ProtocolBase;
import net.aspw.client.utils.MinecraftInstance;
import net.minecraft.block.BlockLadder;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
Expand All @@ -16,7 +16,7 @@ public abstract class MixinBlockLadder extends MixinBlock {

@ModifyConstant(method = "setBlockBoundsBasedOnState", constant = @Constant(floatValue = 0.125F))
private float ViaVersion_LadderBB(float constant) {
if (ProtocolBase.getManager().getTargetVersion().newerThan(ProtocolVersion.v1_8) && !MinecraftInstance.mc.isIntegratedServerRunning())
if (ProtocolBase.getManager().getTargetVersion().isNewerThan(VersionEnum.r1_8) && !MinecraftInstance.mc.isIntegratedServerRunning())
return 0.1875F;
return 0.125F;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.aspw.client.injection.forge.mixins.block;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.protocol.ProtocolBase;
import net.aspw.client.utils.MinecraftInstance;
import net.minecraft.block.BlockBush;
Expand All @@ -9,6 +8,7 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

Expand All @@ -24,7 +24,7 @@ public abstract class MixinBlockLilyPad extends BlockBush {
*/
@Overwrite
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) {
if (ProtocolBase.getManager().getTargetVersion().newerThan(ProtocolVersion.v1_8) && !MinecraftInstance.mc.isIntegratedServerRunning())
if (ProtocolBase.getManager().getTargetVersion().isNewerThan(VersionEnum.r1_8) && !MinecraftInstance.mc.isIntegratedServerRunning())
return new AxisAlignedBB((double) pos.getX() + 0.0625D, (double) pos.getY() + 0.0D, (double) pos.getZ() + 0.0625D, (double) pos.getX() + 0.9375D, (double) pos.getY() + 0.09375D, (double) pos.getZ() + 0.9375D);
return new AxisAlignedBB((double) pos.getX() + 0.0D, (double) pos.getY() + 0.0D, (double) pos.getZ() + 0.0D, (double) pos.getX() + 1.0D, (double) pos.getY() + 0.015625D, (double) pos.getZ() + 1.0D);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.aspw.client.injection.forge.mixins.entity;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.Launch;
import net.aspw.client.event.StrafeEvent;
import net.aspw.client.features.module.impl.combat.HitBox;
Expand All @@ -17,6 +16,7 @@
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityDispatcher;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -355,12 +355,12 @@ private void getCollisionBorderSize(final CallbackInfoReturnable<Float> callback
final HitBox hitBoxes = Objects.requireNonNull(Launch.moduleManager.getModule(HitBox.class));

if (hitBoxes.getState() && EntityUtils.isSelected(((Entity) ((Object) this)), true)) {
if (ProtocolBase.getManager().getTargetVersion().newerThan(ProtocolVersion.v1_8) && !MinecraftInstance.mc.isIntegratedServerRunning()) {
if (ProtocolBase.getManager().getTargetVersion().isNewerThan(VersionEnum.r1_8) && !MinecraftInstance.mc.isIntegratedServerRunning()) {
callbackInfoReturnable.setReturnValue(hitBoxes.getSizeValue().get());
} else {
callbackInfoReturnable.setReturnValue(0.1F + hitBoxes.getSizeValue().get());
}
} else if (ProtocolBase.getManager().getTargetVersion().newerThan(ProtocolVersion.v1_8) && !MinecraftInstance.mc.isIntegratedServerRunning()) {
} else if (ProtocolBase.getManager().getTargetVersion().isNewerThan(VersionEnum.r1_8) && !MinecraftInstance.mc.isIntegratedServerRunning()) {
callbackInfoReturnable.setReturnValue(0.0F);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.aspw.client.injection.forge.mixins.entity;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.Launch;
import net.aspw.client.event.JumpEvent;
import net.aspw.client.features.module.impl.movement.Jesus;
Expand All @@ -17,6 +16,7 @@
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -176,7 +176,7 @@ private void isPotionActive(Potion p_isPotionActive_1_, final CallbackInfoReturn

@ModifyConstant(method = "onLivingUpdate", constant = @Constant(doubleValue = 0.005D))
private double ViaVersion_MovementThreshold(double constant) {
if (ProtocolBase.getManager().getTargetVersion().newerThan(ProtocolVersion.v1_8) && !MinecraftInstance.mc.isIntegratedServerRunning())
if (ProtocolBase.getManager().getTargetVersion().isNewerThan(VersionEnum.r1_8) && !MinecraftInstance.mc.isIntegratedServerRunning())
return 0.003D;
return 0.005D;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.aspw.client.injection.forge.mixins.entity;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.Launch;
import net.aspw.client.event.*;
import net.aspw.client.features.module.impl.exploit.PortalMenu;
Expand Down Expand Up @@ -33,6 +32,7 @@
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.potion.Potion;
import net.minecraft.util.*;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down Expand Up @@ -194,7 +194,7 @@ protected boolean isCurrentViewEntity() {

@Redirect(method = "onUpdateWalkingPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/NetHandlerPlayClient;addToSendQueue(Lnet/minecraft/network/Packet;)V", ordinal = 7))
public void emulateIdlePacket(NetHandlerPlayClient instance, Packet p_addToSendQueue_1_) {
if (ProtocolBase.getManager().getTargetVersion().newerThan(ProtocolVersion.v1_8) && !MinecraftInstance.mc.isIntegratedServerRunning()) {
if (ProtocolBase.getManager().getTargetVersion().isNewerThan(VersionEnum.r1_8) && !MinecraftInstance.mc.isIntegratedServerRunning()) {
if (this.viaForge$prevOnGround == this.onGround) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package net.aspw.client.injection.forge.mixins.gui;

import net.aspw.client.protocol.ProtocolBase;
import net.aspw.client.utils.MinecraftInstance;
import net.aspw.client.utils.ServerUtils;
import net.aspw.client.visual.font.semi.Fonts;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiIngameMenu;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -26,10 +29,12 @@ private void actionPerformed(GuiButton button, CallbackInfo callbackInfo) {

@Inject(method = "drawScreen", at = @At("RETURN"))
private void drawScreen(CallbackInfo callbackInfo) {
Fonts.minecraftFont.drawStringWithShadow(
"§7Username: §d" + mc.getSession().getUsername(),
6f,
6f,
0xffffff);
final VersionEnum version = ProtocolBase.getManager().getTargetVersion();

Fonts.minecraftFont.drawStringWithShadow("§7Username: §d" + mc.getSession().getUsername(), 6f, 6f, 0xffffff);

if (!MinecraftInstance.mc.isIntegratedServerRunning())
Fonts.minecraftFont.drawStringWithShadow("§7Protocol: §d" + version.getName(), 6f, 16f, 0xffffff);
else Fonts.minecraftFont.drawStringWithShadow("§7Protocol: §d1.8.x", 6f, 16f, 0xffffff);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package net.aspw.client.injection.forge.mixins.gui;

import net.aspw.client.protocol.ProtocolBase;
import net.aspw.client.protocol.api.ProtocolSelector;
import net.aspw.client.utils.MinecraftInstance;
import net.aspw.client.visual.client.altmanager.GuiAltManager;
import net.aspw.client.visual.font.semi.Fonts;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiScreen;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -25,11 +28,13 @@ private void initGui(CallbackInfo callbackInfo) {

@Inject(method = "drawScreen", at = @At("RETURN"))
private void drawScreen(CallbackInfo callbackInfo) {
Fonts.minecraftFont.drawStringWithShadow(
"§7Username: §d" + mc.getSession().getUsername(),
6f,
6f,
0xffffff);
final VersionEnum version = ProtocolBase.getManager().getTargetVersion();

Fonts.minecraftFont.drawStringWithShadow("§7Username: §d" + mc.getSession().getUsername(), 6f, 6f, 0xffffff);

if (!MinecraftInstance.mc.isIntegratedServerRunning())
Fonts.minecraftFont.drawStringWithShadow("§7Protocol: §d" + version.getName(), 6f, 16f, 0xffffff);
else Fonts.minecraftFont.drawStringWithShadow("§7Protocol: §d1.8.x", 6f, 16f, 0xffffff);
}

@Inject(method = "actionPerformed", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package net.aspw.client.injection.forge.mixins.gui;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.Launch;
import net.aspw.client.protocol.ProtocolBase;
import net.aspw.client.utils.MinecraftInstance;
import net.minecraft.client.gui.GuiOverlayDebug;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -17,7 +17,7 @@ public class MixinGuiOverlayDebug {

@Inject(method = "getDebugInfoRight", at = @At(value = "TAIL"))
public void addProtocolVersion(CallbackInfoReturnable<List<String>> cir) {
final ProtocolVersion version = ProtocolBase.getManager().getTargetVersion();
final VersionEnum version = ProtocolBase.getManager().getTargetVersion();

cir.getReturnValue().add("");

Expand Down
Loading

0 comments on commit d3394ef

Please sign in to comment.