Vision headless support

This commit is contained in:
Daniel Mills 2021-07-18 18:48:57 -04:00
parent deb75df77a
commit fa818d50d1
2 changed files with 16 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.IrisAccess;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.common.IrisWorld;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;
@ -70,7 +71,7 @@ public class IrisVision extends JPanel implements MouseWheelListener, KeyListene
private boolean alt = false;
private int posX = 0;
private IrisRenderer renderer;
private World world;
private IrisWorld world;
private double velocity = 0;
private int lowq = 12;
private int posZ = 0;
@ -726,7 +727,7 @@ public class IrisVision extends JPanel implements MouseWheelListener, KeyListene
}
}
private static void createAndShowGUI(Engine r, int s, World world) {
private static void createAndShowGUI(Engine r, int s, IrisWorld world) {
JFrame frame = new JFrame("Vision");
IrisVision nv = new IrisVision(frame);
nv.world = world;

View File

@ -26,15 +26,19 @@ import lombok.Data;
import lombok.experimental.Accessors;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.Collection;
@Builder
@Data
@Accessors(chain = true, fluent = true)
public class IrisWorld {
private static final KList<Player> NO_PLAYERS = new KList<>();
private static final KList<? extends Entity> NO_ENTITIES = new KList<>();
private String name;
private File worldFolder;
private long seed;
@ -94,4 +98,13 @@ public class IrisWorld {
Iris.error("This world is not real yet, cannot get spawn location! HEADLESS!");
return null;
}
public <T extends Entity> Collection<? extends T> getEntitiesByClass(Class<T> t) {
if(hasRealWorld())
{
return realWorld().getEntitiesByClass(t);
}
return (KList<? extends T>) NO_ENTITIES;
}
}