Fix entities stuck in the ground closes #607

This commit is contained in:
cyberpwn 2021-09-10 09:27:11 -04:00
parent debe8eb81c
commit 2e645f04e7
2 changed files with 20 additions and 6 deletions

View File

@ -22,7 +22,7 @@ plugins {
}
group 'com.volmit.iris'
version '1.8.7'
version '1.8.8'
def apiVersion = '1.17'
def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris'

View File

@ -63,6 +63,7 @@ import org.bukkit.util.Vector;
import java.util.Collection;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@ -183,12 +184,23 @@ public class IrisEntity extends IrisRegistrant {
if (!Chunks.isSafe(at)) {
return null;
}
if (isSpawnEffectRiseOutOfGround()) {
Location b = at.clone();
double sy = b.getY() - 5;
Location start = new Location(b.getWorld(), b.getX(), sy, b.getZ());
at = start;
AtomicReference<Location> f = new AtomicReference<>(at);
try {
J.sfut(() -> {
if(Chunks.hasPlayersNearby(f.get()))
{
Location b = f.get().clone();
Location start = new Location(b.getWorld(), b.getX(), b.getY() - 5, b.getZ());
f.set(start);
}
}).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
at = f.get();
}
Entity ee = doSpawn(at);
@ -347,6 +359,7 @@ public class IrisEntity extends IrisRegistrant {
}
Location finalAt1 = at;
J.s(() -> {
if (isSpawnEffectRiseOutOfGround() && e instanceof LivingEntity && Chunks.hasPlayersNearby(finalAt1)) {
Location start = finalAt1.clone();
@ -381,6 +394,7 @@ public class IrisEntity extends IrisRegistrant {
}
});
return e;
}