use of net.minecraft.world.chunk.ChunkManager in project roadrunner by MaxNeedsSnacks.
the class WorldHelper method getEntitiesOfClassGroup.
/**
* Method that allows getting entities of a class group.
* [VanillaCopy] but custom combination of: get class filtered entities together with excluding one entity
*/
public static List<Entity> getEntitiesOfClassGroup(World world, Entity excluded, EntityClassGroup type, Box box, Predicate<Entity> predicate) {
world.getProfiler().visit("getEntities");
int minChunkX = MathHelper.floor((box.minX - 2.0D) / 16.0D);
int maxChunkX = MathHelper.ceil((box.maxX + 2.0D) / 16.0D);
int minChunkZ = MathHelper.floor((box.minZ - 2.0D) / 16.0D);
int maxChunkZ = MathHelper.ceil((box.maxZ + 2.0D) / 16.0D);
List<Entity> entities = Lists.newArrayList();
ChunkManager chunkManager = world.getChunkManager();
for (int chunkX = minChunkX; chunkX < maxChunkX; chunkX++) {
for (int chunkZ = minChunkZ; chunkZ < maxChunkZ; chunkZ++) {
WorldChunk chunk = chunkManager.getWorldChunk(chunkX, chunkZ, false);
if (chunk != null) {
WorldHelper.getEntitiesOfClassGroup(chunk, excluded, type, box, entities, predicate);
}
}
}
return entities;
}
use of net.minecraft.world.chunk.ChunkManager in project dynmap by webbukkit.
the class FabricMapChunkCache method setChunks.
public void setChunks(FabricWorld dw, List<DynmapChunk> chunks) {
this.w = dw.getWorld();
if (dw.isLoaded()) {
/* Check if world's provider is ServerChunkManager */
ChunkManager cp = this.w.getChunkManager();
if (cp instanceof ServerChunkManager) {
cps = (ServerChunkManager) cp;
} else {
Log.severe("Error: world " + dw.getName() + " has unsupported chunk provider");
}
}
super.setChunks(dw, chunks);
}
use of net.minecraft.world.chunk.ChunkManager in project dynmap by webbukkit.
the class FabricMapChunkCache method setChunks.
public void setChunks(FabricWorld dw, List<DynmapChunk> chunks) {
this.w = dw.getWorld();
if (dw.isLoaded()) {
/* Check if world's provider is ServerChunkManager */
ChunkManager cp = this.w.getChunkManager();
if (cp instanceof ServerChunkManager) {
cps = (ServerChunkManager) cp;
} else {
Log.severe("Error: world " + dw.getName() + " has unsupported chunk provider");
}
}
super.setChunks(dw, chunks);
}
use of net.minecraft.world.chunk.ChunkManager in project EdenClient by HahaOO7.
the class ChestShopMod method checkForShops.
private void checkForShops(ChunkManager cm, ChunkPos chunk) {
if (!cm.isChunkLoaded(chunk.x, chunk.z))
return;
WorldChunk c = cm.getWorldChunk(chunk.x, chunk.z, false);
if (c == null)
return;
shops.remove(chunk);
ChestShopSet cs = new ChestShopSet();
c.getBlockEntities().values().stream().filter(t -> t instanceof SignBlockEntity).map(t -> (SignBlockEntity) t).map(ChestShopEntry::new).filter(ChestShopEntry::isShop).forEach(cs::add);
shops.put(chunk, cs);
}
use of net.minecraft.world.chunk.ChunkManager in project EdenClient by HahaOO7.
the class ChestShopMod method checkForShops.
private void checkForShops(ClientPlayerEntity player, int radius) {
ChunkManager cm = player.clientWorld.getChunkManager();
ChunkPos.stream(player.getChunkPos(), radius).forEach(cp -> checkForShops(cm, cp));
}
Aggregations