-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[1.17] Add Entity Visibility API #6000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
75b0491
Add Entity Visibility API
Janmm14 b1e77e9
sendParticle and playSound edited for all entities
Janmm14 9651d88
Add missed Paper comments, fixed compilation
Janmm14 cdf580b
Add access transform, add null checks, add missed paper comment, remo…
Janmm14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
| From: Janmm14 <gitconfig1@janmm14.de> | ||
| Date: Fri, 25 Jun 2021 23:22:54 +0200 | ||
| Subject: [PATCH] Add Entity Visibility API | ||
|
|
||
|
|
||
| diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java | ||
| index a9e455c5b3bbe4edbdb71f86f5c6eebc2f605547..8e7f0129f58a1d2bcb6f6f521637845da22b1be1 100644 | ||
| --- a/src/main/java/org/bukkit/entity/Entity.java | ||
| +++ b/src/main/java/org/bukkit/entity/Entity.java | ||
| @@ -753,4 +753,18 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent | ||
| */ | ||
| public boolean isTicking(); | ||
| // Paper end | ||
| + | ||
| + // Paper start - Entity Visibility API | ||
| + /** | ||
| + * Check if the entity is shown to players by default. Default: true | ||
| + * @return True if the entity is shown to players by default | ||
| + */ | ||
| + boolean isShownByDefault(); | ||
| + | ||
| + /** | ||
| + * Resets to which players this entity is shown and updates the default shown or hidden state | ||
| + * @param shownByDefault True if entity should not be visible to players by default | ||
| + */ | ||
| + void resetAndSetShownByDefault(boolean shownByDefault); | ||
| + // Paper end | ||
| } | ||
| diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java | ||
| index da83b4cbed0be6f693c7cbb1cc032356f12d7883..53435700b4968d053b884755942b28276b6c267e 100644 | ||
| --- a/src/main/java/org/bukkit/entity/Player.java | ||
| +++ b/src/main/java/org/bukkit/entity/Player.java | ||
| @@ -1986,6 +1986,27 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM | ||
| Set<Player> getTrackedPlayers(); | ||
| // Paper end | ||
|
|
||
| + // Paper start - Entity Visibility API | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But litterally a couple lines above the same thing happens already and I think that it also helps to keep patches a little more individual. |
||
| + /** | ||
| + * Checks whether this player can currently see the given entity | ||
| + * @param entity the entity to check | ||
| + * @return True if this player can see the given entity | ||
| + */ | ||
| + boolean canSee(@NotNull Entity entity); | ||
| + | ||
| + /** | ||
| + * Allows this player to see an entity that was previously hidden | ||
| + * @param entity Entity to show | ||
| + */ | ||
| + void showEntity(@NotNull Entity entity); | ||
| + | ||
| + /** | ||
| + * Hides an entity from this player | ||
| + * @param entity Entity to hide | ||
| + */ | ||
| + void hideEntity(@NotNull Entity entity); | ||
| + // Paper end | ||
| + | ||
| // Spigot start | ||
| public class Spigot extends Entity.Spigot { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't create a new comment "block" here, move it into the already existing one