mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 23:01:01 +01:00
Entity#isTicking
This commit is contained in:
parent
2f55ab6d4e
commit
972b6a6f18
2 changed files with 23 additions and 12 deletions
|
@ -61,7 +61,7 @@
|
||||||
+// CraftBukkit end
|
+// CraftBukkit end
|
||||||
|
|
||||||
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
|
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private static final int CURRENT_LEVEL = 2;
|
+ private static final int CURRENT_LEVEL = 2;
|
||||||
+ public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation
|
+ public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
+ }
|
+ }
|
||||||
+ return this.bukkitEntity;
|
+ return this.bukkitEntity;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
+ // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||||
+ public int getDefaultMaxAirSupply() {
|
+ public int getDefaultMaxAirSupply() {
|
||||||
+ return Entity.TOTAL_AIR_SUPPLY;
|
+ return Entity.TOTAL_AIR_SUPPLY;
|
||||||
|
@ -831,11 +831,10 @@
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||||
@@ -2079,7 +2520,69 @@
|
@@ -2080,6 +2521,68 @@
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Entity has invalid position");
|
throw new IllegalStateException("Entity has invalid position");
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
|
@ -858,7 +857,7 @@
|
||||||
+ boolean bukkitInvisible = nbt.getBoolean("Bukkit.invisible");
|
+ boolean bukkitInvisible = nbt.getBoolean("Bukkit.invisible");
|
||||||
+ this.setInvisible(bukkitInvisible);
|
+ this.setInvisible(bukkitInvisible);
|
||||||
+ this.persistentInvisibility = bukkitInvisible;
|
+ this.persistentInvisibility = bukkitInvisible;
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
@ -1480,7 +1479,7 @@
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private final CommandSource commandSource = new CommandSource() {
|
+ private final CommandSource commandSource = new CommandSource() {
|
||||||
+
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void sendSystemMessage(Component message) {
|
+ public void sendSystemMessage(Component message) {
|
||||||
+ }
|
+ }
|
||||||
|
@ -1506,21 +1505,22 @@
|
||||||
+ }
|
+ }
|
||||||
+ };
|
+ };
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
public CommandSourceStack createCommandSourceStackForNameResolution(ServerLevel world) {
|
public CommandSourceStack createCommandSourceStackForNameResolution(ServerLevel world) {
|
||||||
- return new CommandSourceStack(CommandSource.NULL, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this);
|
- return new CommandSourceStack(CommandSource.NULL, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this);
|
||||||
+ return new CommandSourceStack(this.commandSource, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this); // CraftBukkit
|
+ return new CommandSourceStack(this.commandSource, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||||
@@ -3551,6 +4308,11 @@
|
@@ -3550,7 +4307,12 @@
|
||||||
|
|
||||||
vec3d = vec3d.add(vec3d1);
|
vec3d = vec3d.add(vec3d1);
|
||||||
++k1;
|
++k1;
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit start - store last lava contact location
|
+ // CraftBukkit start - store last lava contact location
|
||||||
+ if (tag == FluidTags.LAVA) {
|
+ if (tag == FluidTags.LAVA) {
|
||||||
+ this.lastLavaContact = blockposition_mutableblockposition.immutable();
|
+ this.lastLavaContact = blockposition_mutableblockposition.immutable();
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1615,7 +1615,7 @@
|
||||||
|
|
||||||
if (entityliving instanceof Player entityhuman) {
|
if (entityliving instanceof Player entityhuman) {
|
||||||
if (this.isAlive()) {
|
if (this.isAlive()) {
|
||||||
@@ -3962,4 +4760,10 @@
|
@@ -3962,4 +4760,14 @@
|
||||||
|
|
||||||
void accept(Entity entity, double x, double y, double z);
|
void accept(Entity entity, double x, double y, double z);
|
||||||
}
|
}
|
||||||
|
@ -1624,5 +1624,9 @@
|
||||||
+ public static int nextEntityId() {
|
+ public static int nextEntityId() {
|
||||||
+ return ENTITY_COUNTER.incrementAndGet();
|
+ return ENTITY_COUNTER.incrementAndGet();
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isTicking() {
|
||||||
|
+ return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
|
||||||
|
+ }
|
||||||
+ // Paper end - Expose entity id counter
|
+ // Paper end - Expose entity id counter
|
||||||
}
|
}
|
||||||
|
|
|
@ -1058,4 +1058,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
return getHandle().isInLava();
|
return getHandle().isInLava();
|
||||||
}
|
}
|
||||||
// Paper end - entity liquid API
|
// Paper end - entity liquid API
|
||||||
|
|
||||||
|
// Paper start - isTicking API
|
||||||
|
@Override
|
||||||
|
public boolean isTicking() {
|
||||||
|
return getHandle().isTicking();
|
||||||
|
}
|
||||||
|
// Paper end - isTicking API
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue