mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 02:29:14 +00:00
Fix entities stuck in the ground closes #607
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user