Fixing Fly C slime false positives and removing Hitbox debug

This commit is contained in:
Dawson
2022-08-30 11:41:46 -04:00
parent d8225182b9
commit ffd996382e
7 changed files with 31 additions and 22 deletions
+1 -7
View File
@@ -98,12 +98,6 @@
<version>1.8.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.brighten.ac</groupId>
<artifactId>API</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -156,7 +150,7 @@
<groupId>co.aikar</groupId>
<artifactId>acf-bukkit</artifactId>
<version>0.5.0-SNAPSHOT</version>
<scope>provided</scope>
<scope>compile</scope>
</dependency>
</dependencies>
+1 -1
View File
@@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicLong;
@Getter
@Init
@MavenLibrary(groupId = "co.aikar", artifactId = "acf-bukkit", version = "0.5.0", repo = @Repository(url = "https://nexus.funkemunky.cc/content/repositories/releases/"))
//@MavenLibrary(groupId = "co.aikar", artifactId = "acf-bukkit", version = "0.5.0", repo = @Repository(url = "https://nexus.funkemunky.cc/content/repositories/releases/"))
@MavenLibrary(groupId = "com.google.guava", artifactId = "guava", version = "21.0", repo = @Repository(url = "https://repo1.maven.org/maven2"))
@MavenLibrary(groupId = "com.h2database", artifactId = "h2", version = "2.1.214", repo = @Repository(url = "https://repo1.maven.org/maven2"))
@MavenLibrary(groupId = "it.unimi.dsi", artifactId = "fastutil", version = "8.5.6", repo = @Repository(url = "https://repo1.maven.org/maven2"))
@@ -8,16 +8,13 @@ import dev.brighten.ac.data.APlayer;
import dev.brighten.ac.packet.ProtocolVersion;
import dev.brighten.ac.packet.wrapper.in.WPacketPlayInFlying;
import dev.brighten.ac.packet.wrapper.in.WPacketPlayInUseEntity;
import dev.brighten.ac.packet.wrapper.objects.EnumParticle;
import dev.brighten.ac.utils.*;
import dev.brighten.ac.utils.timer.Timer;
import dev.brighten.ac.utils.timer.impl.TickTimer;
import dev.brighten.ac.utils.world.EntityData;
import dev.brighten.ac.utils.world.types.SimpleCollisionBox;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.*;
@@ -81,8 +78,6 @@ public class Hitbox extends Check {
SimpleCollisionBox box = (SimpleCollisionBox)
EntityData.getEntityBox(oldLocation.toVector(), target.one);
box.draw(EnumParticle.FLAME, Bukkit.getOnlinePlayers().toArray(new Player[0]));
if(player.getPlayerVersion().isBelow(ProtocolVersion.V1_9)) {
box = box.expand(0.1325);
} else box = box.expand(0.0325);
@@ -92,8 +87,6 @@ public class Hitbox extends Check {
SimpleCollisionBox box = (SimpleCollisionBox)
EntityData.getEntityBox(oldLocation.toVector(), target.one);
box.draw(EnumParticle.FLAME, Bukkit.getOnlinePlayers().toArray(new Player[0]));
if(player.getPlayerVersion().isBelow(ProtocolVersion.V1_9)) {
box = box.expand(0.1325);
} else box = box.expand(0.0325);
@@ -104,8 +97,6 @@ public class Hitbox extends Check {
SimpleCollisionBox box = (SimpleCollisionBox)
EntityData.getEntityBox(oldLocation.toVector(), target.one);
box.draw(EnumParticle.FLAME, Bukkit.getOnlinePlayers().toArray(new Player[0]));
if(player.getPlayerVersion().isBelow(ProtocolVersion.V1_9)) {
box = box.expand(0.1325);
} else box = box.expand(0.0325);
@@ -20,6 +20,8 @@ public class FlyC extends Check {
super(player);
}
private double slimeY = 0;
WAction<WPacketPlayInFlying> flyingAction = packet -> {
if(player.getMovement().getLastTeleport().isNotPassed((1))
|| player.getMovement().getMoveTicks() <= 2
@@ -34,6 +36,17 @@ public class FlyC extends Check {
// Adding only possible jump height with current circumstances
possibleHeights.add(MovementUtils.getJumpHeight(player));
if(player.getBlockInfo().onSlime && packet.isOnGround() && player.getMovement().getDeltaY() < 0) {
double ldeltaY = player.getMovement().getLDeltaY() * -1, deltaY = player.getMovement().getDeltaY() * -1;
if(ldeltaY > deltaY) {
deltaY+= ldeltaY;
}
slimeY = deltaY;
debug("SlimeY: " + slimeY);
} else if(!player.getInfo().wasOnSlime)
slimeY = 0;
// Adding all possible velocity deltaY.
player.getVelocityHandler().getPossibleVectors().forEach(vec -> possibleHeights.add(vec.getY()));
@@ -44,6 +57,9 @@ public class FlyC extends Check {
jumpCheck: {
if(!jumped || player.getInfo().blockAbove.isNotPassed(1)
|| player.getInfo().climbTimer.isNotPassed(1)
|| player.getInfo().wasOnSlime
|| player.getInfo().lastFence.isNotPassed(1)
|| player.getInfo().lastHalfBlock.isNotPassed(1)
|| player.getInfo().slimeTimer.isNotPassed(1)
|| player.getInfo().lastLiquid.isNotPassed(1)) break jumpCheck;
@@ -62,6 +78,9 @@ public class FlyC extends Check {
.map(s -> String.valueOf(MathUtils.round(s, 5))).collect(Collectors.joining(";")));
}
if(player.getInfo().wasOnSlime)
possibleHeights.add(slimeY);
maximumHeightCheck: {
if(player.getInfo().nearGround) break maximumHeightCheck;
@@ -238,7 +238,7 @@ public class BlockInformation {
.isIntersected(blockBox))
player.getInfo().setNearGround(true);
if(groundBox.isCollided(blockBox)) {
if(groundBox.copy().expandMin(0, -0.4, 0).isCollided(blockBox)) {
player.getInfo().setServerGround(true);
if(blockMaterial != null)
@@ -247,11 +247,13 @@ public class BlockInformation {
case BLUE_ICE:
case FROSTED_ICE:
case PACKED_ICE: {
onIce = true;
if(groundBox.isCollided(blockBox))
onIce = true;
break;
}
case SOUL_SAND: {
onSoulSand = true;
if(groundBox.isCollided(blockBox))
onSoulSand = true;
break;
}
case SLIME_BLOCK: {
@@ -28,7 +28,8 @@ public class GeneralInformation {
lastPlace = new TickTimer(), climbTimer = new TickTimer(), lastUseItem = new TickTimer(),
lastRespawn = new TickTimer(), lastEntityCollision = new TickTimer(), lastWeb = new TickTimer(),
lastLiquid = new TickTimer(), lastBlockDig = new TickTimer(), lastBlockPlace = new TickTimer(),
lastBlockUpdate = new TickTimer(), lastMiscNear = new TickTimer(), lastHalfBlock = new TickTimer();
lastBlockUpdate = new TickTimer(), lastMiscNear = new TickTimer(), lastHalfBlock = new TickTimer(),
lastFence = new TickTimer();
public LivingEntity target;
public boolean serverGround, lastServerGround, canFly, nearGround, worldLoaded, generalCancel, inVehicle, creative,
sneaking, lsneaking, sprinting, gliding, riptiding, wasOnSlime, onLadder, doingVelocity, breakingBlock;
@@ -230,7 +230,9 @@ public class MovementHandler {
if (player.getInfo().isGliding()) player.getInfo().getLastElytra().reset();
if (player.getInfo().isSneaking()) player.getInfo().getLastSneak().reset();
if (player.getBlockInfo().inLiquid) player.getInfo().getLastLiquid().reset();
if(player.getBlockInfo().inWeb) player.getInfo().lastWeb.reset();
if (player.getBlockInfo().inWeb) player.getInfo().lastWeb.reset();
if (player.getBlockInfo().onHalfBlock) player.getInfo().getLastHalfBlock().reset();
if (player.getBlockInfo().fenceBelow) player.getInfo().getLastFence().reset();
if (!to.isOnGround() && moveTicks > 0) {
if (!jumped && from.isOnGround()