|
| 1 | +/* |
| 2 | + * Copyright (c) 2014-2025 Wurst-Imperium and contributors. |
| 3 | + * |
| 4 | + * This source code is subject to the terms of the GNU General Public |
| 5 | + * License, version 3. If a copy of the GPL was not distributed with this |
| 6 | + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt |
| 7 | + */ |
| 8 | +package net.wurstclient.hacks; |
| 9 | + |
| 10 | +import net.minecraft.util.math.Vec3d; |
| 11 | +import net.wurstclient.Category; |
| 12 | +import net.wurstclient.SearchTags; |
| 13 | +import net.wurstclient.hack.Hack; |
| 14 | +import net.wurstclient.settings.SliderSetting; |
| 15 | +import net.wurstclient.settings.SliderSetting.ValueDisplay; |
| 16 | + |
| 17 | +@SearchTags({"anti explosion", "anti blast", "no explosion knockback", |
| 18 | + "no blast knockback", "anti wind charge", "wind charge"}) |
| 19 | +public final class AntiBlastHack extends Hack |
| 20 | +{ |
| 21 | + private final SliderSetting hStrength = |
| 22 | + new SliderSetting("Horizontal Strength", |
| 23 | + "How far to reduce horizontal explosion knockback.\n" |
| 24 | + + "-100% = double knockback\n" + "0% = normal knockback\n" |
| 25 | + + "100% = no knockback\n" + ">100% = reverse knockback", |
| 26 | + 1, -1, 2, 0.01, ValueDisplay.PERCENTAGE); |
| 27 | + |
| 28 | + private final SliderSetting vStrength = |
| 29 | + new SliderSetting("Vertical Strength", |
| 30 | + "How far to reduce vertical explosion knockback.\n" |
| 31 | + + "-100% = double knockback\n" + "0% = normal knockback\n" |
| 32 | + + "100% = no knockback\n" + ">100% = reverse knockback", |
| 33 | + 1, -1, 2, 0.01, ValueDisplay.PERCENTAGE); |
| 34 | + |
| 35 | + public AntiBlastHack() |
| 36 | + { |
| 37 | + super("AntiBlast"); |
| 38 | + setCategory(Category.COMBAT); |
| 39 | + addSetting(hStrength); |
| 40 | + addSetting(vStrength); |
| 41 | + } |
| 42 | + |
| 43 | + public Vec3d modifyKnockback(double defaultX, double defaultY, |
| 44 | + double defaultZ) |
| 45 | + { |
| 46 | + if(!isEnabled()) |
| 47 | + return new Vec3d(defaultX, defaultY, defaultZ); |
| 48 | + |
| 49 | + double horizontalMultiplier = 1 - hStrength.getValue(); |
| 50 | + double verticalMultiplier = 1 - vStrength.getValue(); |
| 51 | + |
| 52 | + return new Vec3d(defaultX * horizontalMultiplier, |
| 53 | + defaultY * verticalMultiplier, defaultZ * horizontalMultiplier); |
| 54 | + } |
| 55 | +} |
0 commit comments