Skip to content

Commit

Permalink
Mark Entity::lastLavaContact how Nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
Doc94 committed Jan 19, 2025
1 parent 73f7736 commit 5f49c9b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ index d95413af04121fe91ca0f3b0c70025b9808acef9..ad665c7535c615d2b03a3e7864be435f
import org.slf4j.Logger;

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 3164f3784131babf9a6663335517a12df7e88a7b..da8848e2a3e3745949eb2356a049451d30f763a7 100644
index 79d23c3403efc6dbef2381a3fa5946023f862452..3b19229427d83290bba1431bee5357e2ced34f94 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -551,6 +551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
Expand Down Expand Up @@ -476,10 +476,10 @@ index 24735284fda151414d99faad401d25ba60995f9a..23b342cc31c7e72ade0e1ccad86a9ccf
public void tick() {
super.tick();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index e7889c9c7b155db46730f5e168bb7fd3d1732a8c..334859c5ff7023c730513301cc11c9837b2c7823 100644
index 22171630820618e686adb85546711234094c84a9..d9533a6b5b1b9557ce17bbc991cf535e0d23ede8 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -380,6 +380,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -381,6 +381,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean fixedPose = false; // Paper - Expand Pose API
private final int despawnTime; // Paper - entity despawn time limit
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
Expand All @@ -495,7 +495,7 @@ index e7889c9c7b155db46730f5e168bb7fd3d1732a8c..334859c5ff7023c730513301cc11c983

public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
this.origin = location.toVector();
@@ -417,6 +426,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -418,6 +427,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
Expand All @@ -509,7 +509,7 @@ index e7889c9c7b155db46730f5e168bb7fd3d1732a8c..334859c5ff7023c730513301cc11c983
SynchedEntityData.Builder builder = new SynchedEntityData.Builder(this);
builder.define(DATA_SHARED_FLAGS_ID, (byte)0);
builder.define(DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
@@ -981,6 +997,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -982,6 +998,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else {
this.wasOnFire = this.isOnFire();
if (type == MoverType.PISTON) {
Expand All @@ -518,7 +518,7 @@ index e7889c9c7b155db46730f5e168bb7fd3d1732a8c..334859c5ff7023c730513301cc11c983
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -994,6 +1012,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -995,6 +1013,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26735,7 +26735,7 @@ index da793ad12565c36fffb26eb771ff68c76632caf7..db06f966077928419bfe469260f04d7d
if (!passengers.equals(this.lastPassengers)) {
this.broadcastAndSend(new ClientboundSetPassengersPacket(this.entity)); // CraftBukkit
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 192977dd661ee795ada13db895db770293e9b402..95a4e37a3c93f9b3c56c7a7376ed521cd46fbb6f 100644
index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c639223f09 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -170,7 +170,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
Expand Down Expand Up @@ -28372,7 +28372,7 @@ index 8cc5c0716392ba06501542ff5cbe71ee43979e5d..09fd99c9cbd23b5f3c899bfb00c9b896
+ // Paper end - block counting
}
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8240e85e7 100644
index 33db4187899d98381155c3f30b7f416e7e7edad8..77b4a8e24a3ecdcf53b9d0c1215764d6ce26d328 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -135,7 +135,7 @@ import net.minecraft.world.scores.ScoreHolder;
Expand Down Expand Up @@ -28466,7 +28466,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
}
// Paper end - Share random for entities to make them more random
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
@@ -419,6 +375,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -420,6 +376,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.dimensions.makeBoundingBox(x, y, z);
}
// Paper end
Expand Down Expand Up @@ -28623,7 +28623,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8

public Entity(EntityType<?> entityType, Level level) {
this.type = entityType;
@@ -1327,35 +1433,77 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1328,35 +1434,77 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return distance;
}

Expand Down Expand Up @@ -28725,7 +28725,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
}

private static float[] collectCandidateStepUpHeights(AABB box, List<VoxelShape> colliders, float deltaY, float maxUpStep) {
@@ -2662,23 +2810,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2663,23 +2811,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public boolean isInWall() {
Expand Down Expand Up @@ -28849,7 +28849,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
}

public InteractionResult interact(Player player, InteractionHand hand) {
@@ -4102,15 +4337,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4103,15 +4338,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public Iterable<Entity> getIndirectPassengers() {
Expand All @@ -28875,7 +28875,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
}

public int countPlayerPassengers() {
@@ -4248,77 +4485,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4249,77 +4486,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return Mth.lerp(partialTick, this.yRotO, this.yRot);
}

Expand Down Expand Up @@ -29066,7 +29066,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8

public boolean touchingUnloadedChunk() {
AABB aabb = this.getBoundingBox().inflate(1.0);
@@ -4471,6 +4767,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4472,6 +4768,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPosRaw(x, y, z, false);
}
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
Expand All @@ -29082,7 +29082,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
if (!checkPosition(this, x, y, z)) {
return;
}
@@ -4601,6 +4906,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4602,6 +4907,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

@Override
public final void setRemoved(Entity.RemovalReason removalReason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
Expand All @@ -29095,7 +29095,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
// CraftBukkit end
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
@@ -4612,7 +4923,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4613,7 +4924,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.stopRiding();
}

Expand All @@ -29104,7 +29104,7 @@ index 8d7c1ee6c1cd4419621b11029eb06bf8135e59aa..1d0151a042ed5de4e235ef0bdac1a0e8
this.levelCallback.onRemove(removalReason);
this.onRemoval(removalReason);
// Paper start - Folia schedulers
@@ -4646,7 +4957,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4647,7 +4958,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean shouldBeSaved() {
return (this.removalReason == null || this.removalReason.shouldSave())
&& !this.isPassenger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
private long pistonDeltasGameTime;
private EntityDimensions dimensions;
@@ -250,6 +_,63 @@
@@ -250,6 +_,64 @@
private final List<Entity.Movement> movementThisTick = new ArrayList<>();
private final Set<BlockState> blocksInside = new ReferenceArraySet<>();
private final LongSet visitedBlocks = new LongOpenHashSet();
Expand All @@ -143,6 +143,7 @@
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
+ public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
+ public boolean persistentInvisibility = false;
+ @Nullable
+ public BlockPos lastLavaContact;
+ // Marks an entity, that it was removed by a plugin via Entity#remove
+ // Main use case currently is for SPIGOT-7487, preventing dropping of leash when leash is removed
Expand Down

0 comments on commit 5f49c9b

Please sign in to comment.