2022-07-31 17:30:34 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
|
|
Date: Wed, 6 Oct 2021 20:10:44 -0400
|
|
|
|
Subject: [PATCH] Collision API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
2024-04-24 22:32:38 +02:00
|
|
|
index d1c265733941874002f6dfc7543917af88600659..72c275d7da798ee10a224bbd3f4c92abd82601e1 100644
|
2022-07-31 17:30:34 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -539,5 +539,12 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
2022-07-31 17:30:34 +02:00
|
|
|
|
2023-12-06 20:40:37 +01:00
|
|
|
return this.getHandle().clip(new net.minecraft.world.level.ClipContext(start, end, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, net.minecraft.world.phys.shapes.CollisionContext.empty())).getType() == net.minecraft.world.phys.HitResult.Type.MISS;
|
2022-07-31 17:30:34 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean hasCollisionsIn(@org.jetbrains.annotations.NotNull org.bukkit.util.BoundingBox boundingBox) {
|
2024-01-23 18:01:39 +01:00
|
|
|
+ net.minecraft.world.phys.AABB aabb = new net.minecraft.world.phys.AABB(boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), boundingBox.getMaxX(), boundingBox.getMaxY(), boundingBox.getMaxZ());
|
2022-07-31 17:30:34 +02:00
|
|
|
+
|
|
|
|
+ return !this.getHandle().noCollision(aabb);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2024-04-24 22:32:38 +02:00
|
|
|
index b6fef2ca5b564c293cb602cb8e300d35dba89b1f..92c80776273f6be43b40686c7ab7dd7371b1c06f 100644
|
2022-07-31 17:30:34 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2024-04-24 22:32:38 +02:00
|
|
|
@@ -1174,4 +1174,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2024-03-23 22:26:17 +01:00
|
|
|
return this.getHandle().noPhysics;
|
2022-07-31 17:30:34 +02:00
|
|
|
}
|
2024-03-23 22:26:17 +01:00
|
|
|
// Paper end - missing entity api
|
2024-03-23 20:27:30 +01:00
|
|
|
+
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper start - Collision API
|
2022-07-31 17:30:34 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) {
|
|
|
|
+ net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ());
|
|
|
|
+
|
2023-06-08 21:35:20 +02:00
|
|
|
+ return !this.getHandle().level().noCollision(this.getHandle(), aabb);
|
2022-07-31 17:30:34 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean wouldCollideUsing(@org.jetbrains.annotations.NotNull BoundingBox boundingBox) {
|
2024-01-23 18:01:39 +01:00
|
|
|
+ net.minecraft.world.phys.AABB aabb = new AABB(boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), boundingBox.getMaxX(), boundingBox.getMaxY(), boundingBox.getMaxZ());
|
2022-07-31 17:30:34 +02:00
|
|
|
+
|
2023-06-08 21:35:20 +02:00
|
|
|
+ return !this.getHandle().level().noCollision(this.getHandle(), aabb);
|
2022-07-31 17:30:34 +02:00
|
|
|
+ }
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper end - Collision API
|
2022-07-31 17:30:34 +02:00
|
|
|
}
|