mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-26 01:12:20 +01:00
Updated
This commit is contained in:
parent
774d3ad1d7
commit
2d13b79237
@ -5,51 +5,51 @@ Subject: [PATCH] Player standing on position API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index a2a423d4e4c2702ba5967223cab0432dd7d04732..6fa7d251f54be9d0ef6b0ec0283efa927bae1a0b 100644
|
||||
index 1d0fd7ff8449f815a7d980af0b378181ea8bf8d8..651bc459141af8a7f9637799d547bcaffe781f13 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -954,4 +954,44 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
@@ -1107,4 +1107,44 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
|
||||
// Paper End - Collision API
|
||||
@NotNull String getScoreboardEntryName();
|
||||
// Paper end - entity scoreboard name
|
||||
+ // Paper start - Player standing on position API
|
||||
+ /**
|
||||
+ * Gets the block that is currently being used to calculate movement affects (i.e friction) on the entity.
|
||||
+ * Gets the position of the block that is currently being used to calculate movement affects (i.e friction) on the entity.
|
||||
+ * <p>
|
||||
+ * Examples:
|
||||
+ * - When sanding on a slab under an ice block, this will return the position of the ice block.
|
||||
+ * - When standing on a slab under an ice block, this will return the position of the ice block.
|
||||
+ * - When flying on top of a flower located under a grass block this will return the position of the grass block (although this technically will not affect your movement).
|
||||
+ *
|
||||
+ * @return block position used for movement affects
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.math.BlockPosition getBlockPosBelowThatAffectsMyMovement();
|
||||
+ io.papermc.paper.math.BlockPosition getMovementAffectingBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block that is currently under the entity.
|
||||
+ * This will return {@link Entity#getSupportingPos()} as long as it is not null,
|
||||
+ * Gets the position of the the that is currently under the entity.
|
||||
+ * This will return {@link Entity#getSupportingBlock()} as long as it is not null,
|
||||
+ * else it will instead return the bottom most block at the entity's hitbox.
|
||||
+ * <p>
|
||||
+ * Examples:
|
||||
+ * - When sanding on a slab under an ice block, this will return the position of the slab.
|
||||
+ * - When flying on top of a flower located under a grass block this will return the position of the corn flower.
|
||||
+ * - When standing on a slab under an ice block, this will return the position of the slab.
|
||||
+ * - When flying on top of a flower located under a grass block this will return the position of the flower.
|
||||
+ *
|
||||
+ * @return {@link Entity#getSupportingPos()} if not null or the entity's bottom most block
|
||||
+ * @return {@link Entity#getSupportingBlock()} if not null or the entity's bottom most block
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.math.BlockPosition getOnPos();
|
||||
+ io.papermc.paper.math.BlockPosition getStandingPosition();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block that is currently supporting the entity.
|
||||
+ * Gets the position of the block that is currently supporting the entity.
|
||||
+ * This takes into account the collisions of blocks under the entity.
|
||||
+ * <p>
|
||||
+ * Examples:
|
||||
+ * - When sanding on a slab under an ice block, this will return the position of the slab.
|
||||
+ * - When standing on a slab under an ice block, this will return the position of the slab.
|
||||
+ * - When flying on top of a flower located under a grass block this will return null, because no block is holding your location.
|
||||
+ *
|
||||
+ * @return block position currently supporting the entity, or null if a block is currently not supporting the entity
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ io.papermc.paper.math.BlockPosition getSupportingPos();
|
||||
+ io.papermc.paper.math.BlockPosition getSupportingBlock();
|
||||
+ // Paper end
|
||||
}
|
@ -7,28 +7,28 @@ Subject: [PATCH] Player standing on position API
|
||||
public net.minecraft.world.entity.Entity getBlockPosBelowThatAffectsMyMovement()Lnet/minecraft/core/BlockPos;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index ea056babe2f8123f20dc608d8a636da1de634b8c..146019c3021439d5738fe0b32cb05b28ad8ce78f 100644
|
||||
index 1c3e1153d08b59d29b3613fc3b50a4780aa7a3ac..443b7e52f2bac95de9433d3927ab4d732c03f20a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1442,4 +1442,24 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return !this.getHandle().level().noCollision(this.getHandle(), aabb);
|
||||
@@ -1227,4 +1227,24 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return this.getHandle().getScoreboardName();
|
||||
}
|
||||
// Paper End - Collision API
|
||||
// Paper end - entity scoreboard name
|
||||
+ // Paper start - Player standing on position API
|
||||
+ @Override
|
||||
+ public io.papermc.paper.math.BlockPosition getBlockPosBelowThatAffectsMyMovement() {
|
||||
+ public io.papermc.paper.math.BlockPosition getMovementAffectingBlock() {
|
||||
+ net.minecraft.core.BlockPos blockPos = this.getHandle().getBlockPosBelowThatAffectsMyMovement();
|
||||
+ return io.papermc.paper.math.Position.block(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.math.BlockPosition getOnPos() {
|
||||
+ public io.papermc.paper.math.BlockPosition getStandingPosition() {
|
||||
+ net.minecraft.core.BlockPos blockPos = this.getHandle().getOnPos();
|
||||
+ return io.papermc.paper.math.Position.block(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.math.BlockPosition getSupportingPos() {
|
||||
+ public io.papermc.paper.math.BlockPosition getSupportingBlock() {
|
||||
+ return this.getHandle().mainSupportingBlockPos
|
||||
+ .map((func) -> io.papermc.paper.math.Position.block(func.getX(), func.getY(), func.getZ()))
|
||||
+ .orElse(null);
|
Loading…
Reference in New Issue
Block a user