mirror of
https://github.com/funkemunky/KauriV3.git
synced 2026-07-01 18:28:25 +00:00
Fixed jump boost false positive on Fly C
This commit is contained in:
@@ -8,6 +8,7 @@ import dev.brighten.ac.data.APlayer;
|
||||
import dev.brighten.ac.packet.wrapper.in.WPacketPlayInFlying;
|
||||
import dev.brighten.ac.utils.MathUtils;
|
||||
import dev.brighten.ac.utils.MovementUtils;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
|
||||
@@ -19,7 +19,6 @@ public class NoFallB extends Check {
|
||||
|
||||
private int airBuffer, groundBuffer;
|
||||
|
||||
@Async
|
||||
WAction<WPacketPlayInFlying> flying = packet -> {
|
||||
if(player.getMovement().getLastTeleport().isNotPassed(3)
|
||||
|| player.getMovement().getMoveTicks() < 2
|
||||
|
||||
@@ -271,6 +271,8 @@ public class Horizontal extends Check {
|
||||
previousFrom = player.getMovement().getFrom().getLoc().clone();
|
||||
};
|
||||
|
||||
|
||||
|
||||
private static final float[] SIN_TABLE_FAST = new float[4096], SIN_TABLE_FAST_NEW = new float[4096];
|
||||
private static final float[] SIN_TABLE = new float[65536];
|
||||
private static final float radToIndex = roundToFloat(651.8986469044033D);
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.brighten.ac.data.info;
|
||||
import dev.brighten.ac.Anticheat;
|
||||
import dev.brighten.ac.data.APlayer;
|
||||
import dev.brighten.ac.packet.ProtocolVersion;
|
||||
import dev.brighten.ac.packet.wrapper.objects.EnumParticle;
|
||||
import dev.brighten.ac.utils.*;
|
||||
import dev.brighten.ac.utils.math.IntVector;
|
||||
import dev.brighten.ac.utils.world.BlockData;
|
||||
@@ -75,8 +76,8 @@ public class BlockInformation {
|
||||
|
||||
int startX = Location.locToBlock(player.getMovement().getTo().getLoc().x - 1 - dh);
|
||||
int endX = Location.locToBlock(player.getMovement().getTo().getLoc().x + 1 + dh);
|
||||
int startY = Location.locToBlock(player.getMovement().getTo().getLoc().y - Math.max(0.6, 0.6 + Math.abs(dy)));
|
||||
int endY = Location.locToBlock(player.getMovement().getTo().getLoc().y + Math.max(2.1, 2.1 + Math.abs(dy)));
|
||||
int startY = Location.locToBlock(player.getMovement().getTo().getLoc().y - 0.6 + dy);
|
||||
int endY = Location.locToBlock(player.getMovement().getTo().getLoc().y + 2.4 + dy);
|
||||
int startZ = Location.locToBlock(player.getMovement().getTo().getLoc().z - 1 - dh);
|
||||
int endZ = Location.locToBlock(player.getMovement().getTo().getLoc().z + 1 + dh);
|
||||
|
||||
@@ -113,7 +114,7 @@ public class BlockInformation {
|
||||
aboveCollisions.clear();
|
||||
}
|
||||
final World world = player.getBukkitPlayer().getWorld();
|
||||
int it = 9 * 9;
|
||||
int it = 10 * 10;
|
||||
|
||||
if(player.getMovement().getFrom().getBox() != null) {
|
||||
SimpleCollisionBox boundsForCollision = player.getMovement().getFrom().getBox().copy().shrink(0.001D, 0.001D, 0.001D);
|
||||
@@ -152,10 +153,10 @@ public class BlockInformation {
|
||||
Chunk chunk = world.getChunkAt(chunkx, chunkz);
|
||||
if (chunk != null) {
|
||||
int cz = chunkz << 4;
|
||||
int xstart = Math.max(startX, cx);
|
||||
int xend = Math.min(endX, cx + 16);
|
||||
int zstart = Math.max(startZ, cz);
|
||||
int zend = Math.min(endZ, cz + 16);
|
||||
int xstart = startX < cx ? cx : startX;
|
||||
int xend = endX < cx + 16 ? endX : cx + 16;
|
||||
int zstart = startZ < cz ? cz : startZ;
|
||||
int zend = endZ < cz + 16 ? endZ : cz + 16;
|
||||
|
||||
for (int x = xstart; x <= xend; ++x) {
|
||||
for (int z = zstart; z <= zend; ++z) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import lombok.Setter;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -31,6 +32,7 @@ public class GeneralInformation {
|
||||
lastBlockUpdate = new TickTimer(), lastMiscNear = new TickTimer(), lastHalfBlock = new TickTimer(),
|
||||
lastFence = new TickTimer();
|
||||
public LivingEntity target;
|
||||
public Optional<PotionEffect> groundJumpBoost;
|
||||
public boolean serverGround, lastServerGround, canFly, nearGround, worldLoaded, generalCancel, inVehicle, creative,
|
||||
sneaking, lsneaking, sprinting, gliding, riptiding, wasOnSlime, onLadder, doingVelocity, breakingBlock;
|
||||
public List<Entity> nearbyEntities = Collections.emptyList();
|
||||
|
||||
@@ -17,6 +17,7 @@ import lombok.Setter;
|
||||
import lombok.val;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -206,6 +207,7 @@ public class MovementHandler {
|
||||
player.getInfo().setWasOnSlime(player.getBlockInfo().onSlime);
|
||||
groundTicks++;
|
||||
airTicks = 0;
|
||||
player.getInfo().groundJumpBoost = player.getPotionHandler().getEffectByType(PotionEffectType.JUMP);
|
||||
} else {
|
||||
airTicks++;
|
||||
groundTicks = 0;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class BlockUpdateHandler {
|
||||
|
||||
player.getInfo().getLastPlace().reset();
|
||||
|
||||
Deque<Material> possible = getPossibleMaterials(pos);
|
||||
Deque<Material> possible = getDirectPossibleMaterials(pos);
|
||||
possible.add(place.getItemStack().getType());
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class BlockUpdateHandler {
|
||||
public void onDig(WPacketPlayInBlockDig dig) {
|
||||
player.getInfo().lastBlockUpdate.reset();
|
||||
if(dig.getDigType() == WPacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
|
||||
Deque<Material> possible = getPossibleMaterials(dig.getBlockPos());
|
||||
Deque<Material> possible = getDirectPossibleMaterials(dig.getBlockPos());
|
||||
possible.clear();
|
||||
possible.add(Material.AIR);
|
||||
}
|
||||
@@ -166,4 +166,24 @@ public class BlockUpdateHandler {
|
||||
return blockI;
|
||||
}));
|
||||
}
|
||||
|
||||
private Deque<Material> getDirectPossibleMaterials(IntVector loc) {
|
||||
return blockInformation.compute(loc, (blockLoc, blockI) -> {
|
||||
if(blockI == null) {
|
||||
blockI = new LinkedList<>();
|
||||
|
||||
val optional = BlockUtils
|
||||
.getBlockAsync(loc.toBukkitVector()
|
||||
.toLocation(player.getBukkitPlayer().getWorld()));
|
||||
|
||||
if(optional.isPresent()) {
|
||||
Block block = optional.get();
|
||||
|
||||
blockI.add(block.getType());
|
||||
}
|
||||
}
|
||||
|
||||
return blockI;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MovementUtils {
|
||||
public static double getJumpHeight(APlayer data) {
|
||||
float baseHeight = 0.42f;
|
||||
|
||||
baseHeight+= data.getPotionHandler().getEffectByType(PotionEffectType.JUMP).map(ef -> ef.getAmplifier() + 1)
|
||||
baseHeight+= data.getInfo().groundJumpBoost.map(ef -> ef.getAmplifier() + 1)
|
||||
.orElse(0) * 0.1f;
|
||||
|
||||
return baseHeight;
|
||||
|
||||
Reference in New Issue
Block a user