use of net.minecraft.client.world.ClientChunkManager in project EdenClient by HahaOO7.
the class ContainerInfo method tick.
private void tick(ClientPlayerEntity player) {
ChunkPos center = player.getChunkPos();
ClientChunkManager cm = player.clientWorld.getChunkManager();
ChunkPos.stream(center, 2).map(cp -> cm.getWorldChunk(cp.x, cp.z, false)).filter(Objects::nonNull).forEach(this::updateChunk);
}
use of net.minecraft.client.world.ClientChunkManager in project EdenClient by HahaOO7.
the class TileEntityEsp method tick.
private void tick(ClientPlayerEntity player) {
if (!enabled) {
tileEntities = new ArrayList<>();
return;
}
ChunkPos chunkPos = player.getChunkPos();
ClientChunkManager cm = player.clientWorld.getChunkManager();
BlockPos pp = player.getBlockPos();
tileEntities = ChunkPos.stream(chunkPos, distance).flatMap(cp -> {
WorldChunk wc = cm.getWorldChunk(cp.x, cp.z, false);
if (wc == null)
return null;
return wc.getBlockEntities().entrySet().stream();
}).filter(e -> types.contains(e.getValue().getType())).map(Map.Entry::getKey).sorted(Comparator.comparingDouble(pos -> pos.getSquaredDistance(pp))).limit(maxCount).map(v -> (Vec3i) v).toList();
}
use of net.minecraft.client.world.ClientChunkManager in project EdenClient by HahaOO7.
the class HeadHunt method tick.
private void tick(ClientPlayerEntity player) {
if (!enabled) {
heads = new HashSet<>();
foundHeads = new HashSet<>();
return;
}
ChunkPos chunkPos = player.getChunkPos();
ClientChunkManager cm = player.clientWorld.getChunkManager();
BlockPos pp = player.getBlockPos();
heads = ChunkPos.stream(chunkPos, 20).flatMap(cp -> {
WorldChunk wc = cm.getWorldChunk(cp.x, cp.z, false);
if (wc == null)
return null;
return wc.getBlockEntities().entrySet().stream();
}).filter(e -> e.getValue().getType() == BlockEntityType.SKULL).map(Map.Entry::getKey).sorted(Comparator.comparingDouble(pos -> pos.getSquaredDistance(pp))).limit(1000).map(v -> (Vec3i) v).collect(Collectors.toSet());
heads.removeAll(foundHeads);
heads.stream().filter(bp -> player.getPos().squaredDistanceTo(Vec3d.ofCenter(bp)) < 20).forEach(this::clickPos);
System.out.println("Heads found: " + heads.size());
}
Aggregations