mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Despawn throwable entities in the void
This commit is contained in:
parent
1d75749f3d
commit
84897849e5
4 changed files with 23 additions and 1 deletions
|
@ -72,6 +72,9 @@ public class FireballEntity extends ThrowableEntity {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (removedInVoid()) {
|
||||
return;
|
||||
}
|
||||
moveAbsoluteImmediate(tickMovement(position), getYaw(), getPitch(), getHeadYaw(), false, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,9 @@ public class FishingHookEntity extends ThrowableEntity {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (removedInVoid()) {
|
||||
return;
|
||||
}
|
||||
if (hooked || !isInAir() && !isInWater() || isOnGround()) {
|
||||
motion = Vector3f.ZERO;
|
||||
return;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ItemEntity extends ThrowableEntity {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (isInWater()) {
|
||||
if (removedInVoid() || isInWater()) {
|
||||
return;
|
||||
}
|
||||
if (!isOnGround() || (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) > 0.00001) {
|
||||
|
|
|
@ -55,6 +55,9 @@ public class ThrowableEntity extends Entity implements Tickable {
|
|||
*/
|
||||
@Override
|
||||
public void tick() {
|
||||
if (removedInVoid()) {
|
||||
return;
|
||||
}
|
||||
moveAbsoluteImmediate(position.add(motion), getYaw(), getPitch(), getHeadYaw(), isOnGround(), false);
|
||||
float drag = getDrag();
|
||||
float gravity = getGravity();
|
||||
|
@ -191,4 +194,17 @@ public class ThrowableEntity extends Entity implements Tickable {
|
|||
moveAbsoluteImmediate(position, yaw, pitch, headYaw, isOnGround, teleported);
|
||||
lastJavaPosition = position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the entity if it is 64 blocks below the world.
|
||||
*
|
||||
* @return true if the entity was removed
|
||||
*/
|
||||
public boolean removedInVoid() {
|
||||
if (position.getY() < session.getDimensionType().minY() - 64) {
|
||||
session.getEntityCache().removeEntity(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue