From d1b31619ceea56389ac1bf953a792625b1aa7299 Mon Sep 17 00:00:00 2001 From: Hamza Date: Thu, 29 Aug 2024 16:52:02 +0500 Subject: [PATCH] Update minestom version --- anticheat/build.gradle.kts | 2 +- commons/build.gradle.kts | 2 +- loader/build.gradle.kts | 8 ++-- proxy.api/build.gradle.kts | 2 +- spark/build.gradle.kts | 2 +- type.generic/build.gradle.kts | 4 +- .../types/generic/entity/ArrowEntityImpl.java | 40 ++++++++++--------- type.hub/build.gradle.kts | 2 +- type.island/build.gradle.kts | 2 +- type.thefarmingislands/build.gradle.kts | 2 +- 10 files changed, 35 insertions(+), 31 deletions(-) diff --git a/anticheat/build.gradle.kts b/anticheat/build.gradle.kts index 3ae3d47f..59113f9f 100644 --- a/anticheat/build.gradle.kts +++ b/anticheat/build.gradle.kts @@ -20,7 +20,7 @@ repositories { } dependencies { - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } } diff --git a/commons/build.gradle.kts b/commons/build.gradle.kts index e55ebf46..70beaea3 100644 --- a/commons/build.gradle.kts +++ b/commons/build.gradle.kts @@ -16,7 +16,7 @@ java { dependencies { implementation(project(":packer")) - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } } \ No newline at end of file diff --git a/loader/build.gradle.kts b/loader/build.gradle.kts index 7ec161ca..6f844dde 100644 --- a/loader/build.gradle.kts +++ b/loader/build.gradle.kts @@ -11,8 +11,8 @@ group = "net.swofty" version = "3.0" java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } @@ -32,10 +32,10 @@ dependencies { implementation(project(":spark")) implementation(project(":anticheat")) implementation("org.slf4j:slf4j-api:2.0.13") - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } - implementation("dev.hollowcube:polar:1.10.0") + implementation("dev.hollowcube:polar:1.11.1") } application { diff --git a/proxy.api/build.gradle.kts b/proxy.api/build.gradle.kts index bdf16afe..7c6ec293 100644 --- a/proxy.api/build.gradle.kts +++ b/proxy.api/build.gradle.kts @@ -21,7 +21,7 @@ repositories { dependencies { implementation(project(":commons")) implementation("com.github.Swofty-Developments:AtlasRedisAPI:1.1.2") - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } implementation("net.kyori:adventure-api:4.17.0") diff --git a/spark/build.gradle.kts b/spark/build.gradle.kts index 16ebb3fd..a1edbaad 100644 --- a/spark/build.gradle.kts +++ b/spark/build.gradle.kts @@ -22,7 +22,7 @@ repositories { } dependencies { - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } implementation(files("dependencies/spark-1.10.1.10-minestom.jar")) diff --git a/type.generic/build.gradle.kts b/type.generic/build.gradle.kts index c5df2188..47f82789 100644 --- a/type.generic/build.gradle.kts +++ b/type.generic/build.gradle.kts @@ -23,10 +23,10 @@ dependencies { implementation(project(":commons")) implementation(project(":packer")) implementation(project(":proxy.api")) - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } - implementation("dev.hollowcube:polar:1.10.0") + implementation("dev.hollowcube:polar:1.11.1") } tasks.withType { diff --git a/type.generic/src/main/java/net/swofty/types/generic/entity/ArrowEntityImpl.java b/type.generic/src/main/java/net/swofty/types/generic/entity/ArrowEntityImpl.java index f31119ef..e0a11222 100644 --- a/type.generic/src/main/java/net/swofty/types/generic/entity/ArrowEntityImpl.java +++ b/type.generic/src/main/java/net/swofty/types/generic/entity/ArrowEntityImpl.java @@ -2,9 +2,7 @@ import lombok.Getter; import net.minestom.server.MinecraftServer; -import net.minestom.server.collision.CollisionUtils; -import net.minestom.server.collision.PhysicsResult; -import net.minestom.server.collision.ShapeImpl; +import net.minestom.server.collision.*; import net.minestom.server.coordinate.Pos; import net.minestom.server.coordinate.Vec; import net.minestom.server.entity.Entity; @@ -16,6 +14,9 @@ import net.minestom.server.timer.TaskSchedule; import net.swofty.types.generic.item.SkyBlockItem; import net.swofty.types.generic.utility.MathUtility; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; public class ArrowEntityImpl extends LivingEntity { private long cooldown = 0; @@ -72,24 +73,27 @@ public void tick(long time) { cooldown = System.currentTimeMillis(); } - PhysicsResult collided = CollisionUtils.checkEntityCollisions(instance, this.getBoundingBox(), posBefore, diff, 3, (e) -> e != this, result); - if (collided != null && collided.collisionShapes()[0] != shooter) { - if (collided.collisionShapes()[0] instanceof Entity entity) { - EntityType entityType = entity.getEntityType(); - if (entityType == EntityType.PLAYER || - entityType == EntityType.ARMOR_STAND) { + Collection entityCollisionResults = CollisionUtils.checkEntityCollisions(instance, this.getBoundingBox(), posBefore, diff, 3, (e) -> e != this, result); + entityCollisionResults.forEach((collided) ->{ + + if (collided != null && collided.entity() != shooter) { + if (collided.entity() instanceof Entity entity) { + EntityType entityType = entity.getEntityType(); + if (entityType == EntityType.PLAYER || + entityType == EntityType.ARMOR_STAND) { + return; + } + ProjectileCollideWithEntityEvent e = new ProjectileCollideWithEntityEvent(this, (Pos) collided.collisionPoint(), entity); + MinecraftServer.getGlobalEventHandler().call(e); + if (!e.isCancelled()) { + remove(); + kill(); + } return; } - - var e = new ProjectileCollideWithEntityEvent(this, collided.newPosition(), entity); - MinecraftServer.getGlobalEventHandler().call(e); - if (!e.isCancelled()) { - remove(); - kill(); - } - return; } - } + + }); if (result.hasCollision()) { Block hitBlock = null; diff --git a/type.hub/build.gradle.kts b/type.hub/build.gradle.kts index 5bf819e1..bceeb661 100644 --- a/type.hub/build.gradle.kts +++ b/type.hub/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { implementation(project(":type.generic")) implementation(project(":commons")) implementation(project(":proxy.api")) - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } } \ No newline at end of file diff --git a/type.island/build.gradle.kts b/type.island/build.gradle.kts index 5bf819e1..bceeb661 100644 --- a/type.island/build.gradle.kts +++ b/type.island/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { implementation(project(":type.generic")) implementation(project(":commons")) implementation(project(":proxy.api")) - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } } \ No newline at end of file diff --git a/type.thefarmingislands/build.gradle.kts b/type.thefarmingislands/build.gradle.kts index 5bf819e1..bceeb661 100644 --- a/type.thefarmingislands/build.gradle.kts +++ b/type.thefarmingislands/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { implementation(project(":type.generic")) implementation(project(":commons")) implementation(project(":proxy.api")) - implementation("net.minestom:minestom-snapshots:12794d4263") { + implementation("net.minestom:minestom-snapshots:789befee31") { exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain") } } \ No newline at end of file