mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-09 06:50:32 +08:00
fa9c5e0f95
Previously, Entity Activation Range only applied to the root entity of a vehicle chain. If that vehicle is active, every entity as it's passenger would then tick. This creates scenarios where EAR does not apply your desired ranges to passengers. Additionally, any entity that was a passenger never had its inactiveTick method called when the parent was inactive, creating behavioral desyncs. This could of been a source of many villager issues when those villagers were in minecarts as players commonly do. Now we will process passengers checking their activation state independently of their vehicle and if they are inactive, call their inactiveTick() method to ensure state remains consistent. This also helps improve any desync issues with entity position of passengers too. This also removes immunity for passenger/vehicles, so it should improve performance of these minecart villagers too for EAR.
80 lines
3.1 KiB
Diff
80 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Thu, 2 Jul 2020 18:11:43 -0500
|
|
Subject: [PATCH] Add entity liquid API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index e064a1560c9d6438563858c468bf989a53131dab..013ae4264eae85eb967839e005acb0d3c343b7c8 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1073,12 +1073,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
return this.inWater;
|
|
}
|
|
|
|
- private boolean isInRain() {
|
|
+ public boolean isInRain() { // Paper - private -> public
|
|
BlockPosition blockposition = this.getChunkCoordinates();
|
|
|
|
return this.world.isRainingAt(blockposition) || this.world.isRainingAt(new BlockPosition((double) blockposition.getX(), this.getBoundingBox().maxY, (double) blockposition.getZ()));
|
|
}
|
|
|
|
+ public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
|
|
private boolean k() {
|
|
return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
|
|
}
|
|
@@ -1092,6 +1093,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
return this.isInWater() || this.isInRain() || this.k();
|
|
}
|
|
|
|
+ public final boolean isInWaterOrBubbleColumn() { return aG(); } // Paper - OBFHELPER
|
|
public boolean aG() {
|
|
return this.isInWater() || this.k();
|
|
}
|
|
@@ -1234,6 +1236,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
return this.O == tag;
|
|
}
|
|
|
|
+ public final boolean isInLava() { return aP(); } // Paper - OBFHELPER
|
|
public boolean aP() {
|
|
return !this.justCreated && this.M.getDouble(TagsFluid.LAVA) > 0.0D;
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
index 26376c995102753fcd298b1eea6e195bae238d65..b1fdc5737d332c6210d57793468da1eda8f8b9d2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -1093,5 +1093,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
|
|
return getHandle().spawnReason;
|
|
}
|
|
+
|
|
+ public boolean isInWater() {
|
|
+ return getHandle().isInWater();
|
|
+ }
|
|
+
|
|
+ public boolean isInRain() {
|
|
+ return getHandle().isInRain();
|
|
+ }
|
|
+
|
|
+ public boolean isInBubbleColumn() {
|
|
+ return getHandle().isInBubbleColumn();
|
|
+ }
|
|
+
|
|
+ public boolean isInWaterOrRain() {
|
|
+ return getHandle().isInWaterOrRain();
|
|
+ }
|
|
+
|
|
+ public boolean isInWaterOrBubbleColumn() {
|
|
+ return getHandle().isInWaterOrBubbleColumn();
|
|
+ }
|
|
+
|
|
+ public boolean isInWaterOrRainOrBubbleColumn() {
|
|
+ return getHandle().isInWaterOrRainOrBubble();
|
|
+ }
|
|
+
|
|
+ public boolean isInLava() {
|
|
+ return getHandle().isInLava();
|
|
+ }
|
|
// Paper end
|
|
}
|