mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-17 18:47:40 +01:00
Move invisible setting up to entities (#10346)
This commit is contained in:
parent
5efed01031
commit
0c76cbb7cc
7 changed files with 95 additions and 10 deletions
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- 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();
|
||||
boolean isInvisible();
|
||||
// Paper end - move invisibility up to Entity
|
||||
|
||||
+ // Paper start - Freeze Tick Lock API
|
||||
+ /**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.entity.getBukkitYaw();
|
||||
+ }
|
||||
// Paper end
|
||||
// Paper start - Collision API
|
||||
@Override
|
||||
|
||||
// Paper start - move up invisibility
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
|
|
|
@ -45,7 +45,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return !this.entity.valid && this.entity.level().addFreshEntity(this.entity, reason);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
|
||||
// Paper start - move up invisibility
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
|
|
|
@ -26,9 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
|
||||
this.getHandle().setSharedFlag(Entity.FLAG_INVISIBLE, invisible);
|
||||
}
|
||||
// Paper end
|
||||
// Paper end - move up invisibility
|
||||
+
|
||||
+ // Paper start - Collision API
|
||||
+ @Override
|
||||
+ public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) {
|
||||
|
|
|
@ -20,7 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
|
||||
// Paper start - move up invisibility
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
|
|
|
@ -29,6 +29,7 @@ public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
|
|||
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
|
||||
public net.minecraft.world.entity.AreaEffectCloud ownerUUID
|
||||
public net.minecraft.world.entity.animal.MushroomCow stewEffects
|
||||
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
@ -37,6 +38,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/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -667,6 +669,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return set;
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Paper start - move up invisibility
|
||||
+ @Override
|
||||
+ public boolean isInvisible() {
|
||||
+ return this.getHandle().isInvisible();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setInvisible(boolean invisible) {
|
||||
+ this.getHandle().persistentInvisibility = invisible;
|
||||
+ this.getHandle().setSharedFlag(Entity.FLAG_INVISIBLE, invisible);
|
||||
+ }
|
||||
+ // Paper end - move up invisibility
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
|
@ -765,8 +789,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.getHandle().persistentInvisibility = invisible;
|
||||
this.getHandle().setSharedFlag(5, invisible);
|
||||
|
||||
@Override
|
||||
public boolean isInvisible() {
|
||||
- return this.getHandle().isInvisible();
|
||||
+ return super.isInvisible(); // Paper - move invisibility up to Entity - diff on change
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvisible(boolean invisible) {
|
||||
- this.getHandle().persistentInvisibility = invisible;
|
||||
- this.getHandle().setSharedFlag(5, invisible);
|
||||
+ super.setInvisible(invisible); // Paper - move invisibility up to Entity
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
|
|
Loading…
Add table
Reference in a new issue