Improving shit

This commit is contained in:
Dawson
2023-03-07 14:32:38 -05:00
parent 11b4a62924
commit dc089d022e
4 changed files with 25 additions and 11 deletions
@@ -149,8 +149,17 @@ public class APlayer {
EMULATOR = new Emulator(new DataSupplier() {
@Override
public List<AxisAlignedBB> getCollidingBoxes(AxisAlignedBB bb) {
SimpleCollisionBox sbc = new SimpleCollisionBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
// Greater than 20? We want to truncate to prevent huge processing cost
if(sbc.min().distanceSquared(sbc.max()) > 400) {
sbc.maxX = sbc.minX + Math.min(sbc.maxX - sbc.minX, 20);
sbc.maxY = sbc.minY + Math.max(sbc.maxY - sbc.minY, 20);
sbc.maxZ = sbc.minZ + Math.max(sbc.maxZ - sbc.minZ, 20);
}
return Helper.getCollisions(APlayer.this,
new SimpleCollisionBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ),
sbc,
Materials.COLLIDABLE).stream().map(bb2 ->
new AxisAlignedBB(bb2.minX, bb2.minY, bb2.minZ, bb2.maxX, bb2.maxY, bb2.maxZ))
.collect(Collectors.toList());
@@ -729,6 +729,7 @@ it
if (distance < 1E-9) {
lastTeleport.reset();
from.setLoc(this.to);
iterator.remove();
break;
}
@@ -25,10 +25,12 @@ public class JoinListener implements Listener {
.getPlayer(event.getPlayer().getUniqueId());
aplayer.ifPresent(player -> {
if(Anticheat.INSTANCE.getPacketHandler()
.process(player, event.getType(), event.getPacket())) {
event.setCancelled(true);
}
RunUtils.task(() -> {
if(Anticheat.INSTANCE.getPacketHandler()
.process(player, event.getType(), event.getPacket())) {
event.setCancelled(true);
}
});
});
});
@@ -264,14 +264,16 @@ public class Helper {
}
}
for (Entity entity : player.getInfo().getNearbyEntities()) {
if (!BlockUtils.isEntityCollidable(entity)) continue;
if(player != null) {
for (Entity entity : player.getInfo().getNearbyEntities()) {
if (!BlockUtils.isEntityCollidable(entity)) continue;
SimpleCollisionBox entityCollisionBox =
new SimpleCollisionBox((Object)MinecraftReflection.getEntityBoundingBox(entity));
SimpleCollisionBox entityCollisionBox =
new SimpleCollisionBox((Object) MinecraftReflection.getEntityBoundingBox(entity));
if (entityCollisionBox.isIntersected(collisionBox))
entityCollisionBox.downCast(collisionBoxes);
if (entityCollisionBox.isIntersected(collisionBox))
entityCollisionBox.downCast(collisionBoxes);
}
}
return collisionBoxes;