Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build-data/paper.at
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,5 @@ public net.minecraft.world.entity.animal.Fox setDefending(Z)V
public net.minecraft.world.entity.animal.Fox isFaceplanted()Z
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V

# Entity Visibility API
public net.minecraft.world.entity.ai.goal.RemoveBlockGoal removerMob
61 changes: 61 additions & 0 deletions patches/api/0321-Add-Entity-Visibility-API.patch
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
Copy link
Copy Markdown
Member

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

+ /**
+ * 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Copy Markdown
Author

@Janmm14 Janmm14 Nov 29, 2021

Choose a reason for hiding this comment

The 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 {

Loading