Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(legacy): added noslow foodonly & drinkonly & intave consume #3654

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
private val blockForwardMultiplier by FloatValue("BlockForwardMultiplier", 1f, 0.2F..1f)
private val blockStrafeMultiplier by FloatValue("BlockStrafeMultiplier", 1f, 0.2F..1f)

private val consumePacket by ListValue("ConsumeMode", arrayOf("None", "UpdatedNCP", "AAC5", "SwitchItem", "InvalidC08"), "None")
private val consumePacket by ListValue("ConsumeMode", arrayOf("None", "UpdatedNCP", "AAC5", "SwitchItem", "InvalidC08", "Intave"), "None")

// TODO: Add individual option for consume (Food, Potion, Milk)
private val consumeForwardMultiplier by FloatValue("ConsumeForwardMultiplier", 1f, 0.2F..1f)
private val consumeStrafeMultiplier by FloatValue("ConsumeStrafeMultiplier", 1f, 0.2F..1f)
private val consumeFoodOnly by BoolValue("ConsumeFoodOnly", true) { consumeForwardMultiplier > 0.2F || consumeStrafeMultiplier > 0.2F }
private val consumeDrinkOnly by BoolValue("ConsumeDrinkOnly", true) { consumeForwardMultiplier > 0.2F || consumeStrafeMultiplier > 0.2F }

private val bowPacket by ListValue("BowMode", arrayOf("None", "UpdatedNCP", "AAC5", "SwitchItem", "InvalidC08"), "None")

Expand Down Expand Up @@ -78,6 +79,9 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
if (mc.thePlayer.motionX == 0.0 && mc.thePlayer.motionZ == 0.0 && !shouldSwap)
return

if (!consumeFoodOnly && heldItem.item is ItemFood || !consumeDrinkOnly && (heldItem.item is ItemPotion || heldItem.item is ItemBucketMilk))
return

if ((heldItem.item is ItemFood || heldItem.item is ItemPotion || heldItem.item is ItemBucketMilk) && (isUsingItem || shouldSwap)) {
when (consumePacket.lowercase()) {
"aac5" ->
Expand All @@ -99,17 +103,18 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM

"invalidc08" -> {
if (event.eventState == EventState.PRE) {
// Food Only
if (heldItem.item is ItemPotion || heldItem.item is ItemBucketMilk) {
return
}

if (InventoryUtils.hasSpaceInInventory()) {
if (player.ticksExisted % 3 == 0)
sendPacket(C08PacketPlayerBlockPlacement(BlockPos(-1, -1, -1), 1, null, 0f, 0f, 0f))
}
}
}

"intave" -> {
if (event.eventState == EventState.PRE) {
sendPacket(C07PacketPlayerDigging(RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP))
}
}

else -> return
}
Expand Down Expand Up @@ -272,6 +277,9 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
fun onSlowDown(event: SlowDownEvent) {
val heldItem = mc.thePlayer.heldItem?.item

if (!consumeFoodOnly && heldItem is ItemFood || !consumeDrinkOnly && (heldItem is ItemPotion || heldItem is ItemBucketMilk))
return

event.forward = getMultiplier(heldItem, true)
event.strafe = getMultiplier(heldItem, false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public void updateEquippedItem() {
@Overwrite
public void renderItemInFirstPerson(float partialTicks) {
final KillAura killAura = KillAura.INSTANCE;
final NoSlow noSlow = NoSlow.INSTANCE;
final Animations animations = Animations.INSTANCE;

float f = 1f - (prevEquippedProgress + (equippedProgress - prevEquippedProgress) * partialTicks);
EntityPlayerSP abstractclientplayer = mc.thePlayer;
float f1 = abstractclientplayer.getSwingProgress(partialTicks);
Expand All @@ -142,13 +145,13 @@ public void renderItemInFirstPerson(float partialTicks) {
enableRescaleNormal();
pushMatrix();

if (Animations.INSTANCE.handleEvents()) {
float scale = Animations.INSTANCE.getHandItemScale();
float x = Animations.INSTANCE.getHandX();
float y = Animations.INSTANCE.getHandY();
float rotX = Animations.INSTANCE.getHandPosX();
float rotY = Animations.INSTANCE.getHandPosY();
float rotZ = Animations.INSTANCE.getHandPosZ();
if (animations.handleEvents()) {
float scale = animations.getHandItemScale();
float x = animations.getHandX();
float y = animations.getHandY();
float rotX = animations.getHandPosX();
float rotY = animations.getHandPosY();
float rotZ = animations.getHandPosZ();

translate(x, y, scale);
rotate(rotX, 1f, 0f, 0f);
Expand All @@ -159,7 +162,7 @@ public void renderItemInFirstPerson(float partialTicks) {
if (itemToRender != null) {
boolean isForceBlocking = (itemToRender.getItem() instanceof ItemSword && !killAura.getAutoBlock().equals("Off") &&
(killAura.getRenderBlocking() || killAura.getTarget() != null && (killAura.getBlinkAutoBlock() || killAura.getForceBlockRender()))
|| NoSlow.INSTANCE.isUNCPBlocking());
|| noSlow.isUNCPBlocking());

if (itemToRender.getItem() instanceof ItemMap) {
renderItemMap(abstractclientplayer, f2, f, f1);
Expand All @@ -176,7 +179,6 @@ public void renderItemInFirstPerson(float partialTicks) {
transformFirstPersonItem(f, f1);
break;
case BLOCK:
final Animations animations = Animations.INSTANCE;
final Animation animation;

if (animations.handleEvents()) {
Expand All @@ -195,8 +197,6 @@ public void renderItemInFirstPerson(float partialTicks) {
break;
}
} else {
final Animations animations = Animations.INSTANCE;

if (!animations.handleEvents() || !animations.getOddSwing()) {
doItemUsedTransformations(f1);
}
Expand Down