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' group 'com.volmit.iris'
version '1.8.7' version '1.8.8'
def apiVersion = '1.17' def apiVersion = '1.17'
def name = getRootProject().getName() // Defined in settings.gradle def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris' def main = 'com.volmit.iris.Iris'

View File

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