Move invisible setting up to entities (#10346)

This commit is contained in:
FireInstall
2024-03-23 20:27:30 +01:00
parent 5efed01031
commit 0c76cbb7cc
7 changed files with 95 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java
new file mode 100644
@@ -414,6 +415,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int getLifetimeTicks();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
boolean isFrozen();
+ // Paper start - move invisibility up to Entity
+ /**
+ * Sets whether the entity is invisible or not.
+ * <p>
+ * This setting is undefined for non-living entities like boats or paintings.
+ * Non-living entities that are marked as invisible through this method may e.g. only hide their shadow.
+ * To hide such entities from players completely, see {@link Player#hideEntity(org.bukkit.plugin.Plugin, Entity)}.
+ *
+ * @param invisible If the entity is invisible
+ */
+ void setInvisible(boolean invisible);
+
+ /**
+ * Gets whether the entity is invisible or not.
+ *
+ * @return Whether the entity is invisible
+ */
+ boolean isInvisible();
+ // Paper end - move invisibility up to Entity
+
/**
* Mark the entity's removal.
*
diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/bukkit/entity/Fireball.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Fireball.java
@@ -541,6 +573,22 @@ diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/o
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*
* @param invisible If the entity is invisible
*/
+ @Override // Paper - move invisibility up to Entity
public void setInvisible(boolean invisible);
/**
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*
* @return Whether the entity is invisible
*/
+ @Override // Paper - move invisibility up to Entity
public boolean isInvisible();
// Paper start
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
void clearActiveItem();
// Paper end