LevelEntityGetterAdapter .java

net.minecraft.world.level.entity.LevelEntityGetterAdapter (class): members: visibleEntities, sectionStorage, getAll, get. imports: AABB, Nullable.

net.minecraft.world.level.entityclass48 linescommonextends EntityAccess>1.4 KB

Implements

API Surface (4)

Iterable<T> getAll()
<U extends T> void get(final EntityTypeTest<T, U> type, final AbortableIterationConsumer<U> consumer)
void get(final AABB bb, final Consumer<T> output)
<U extends T> void get(final EntityTypeTest<T, U> type, final AABB bb, final AbortableIterationConsumer<U> consumer)

Fields & Constants (2)

visibleEntities
sectionStorage

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

LevelEntityGetterAdapter.java48 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.entity;
2
3
import java.util.UUID;
4
import java.util.function.Consumer;
5
import net.minecraft.util.AbortableIterationConsumer;
6
import net.minecraft.world.phys.AABB;
7
import org.jspecify.annotations.Nullable;
8
9
public class LevelEntityGetterAdapter<T extends EntityAccess> implements LevelEntityGetter<T> {
10
	private final EntityLookup<T> visibleEntities;
11
	private final EntitySectionStorage<T> sectionStorage;
12
13
	public LevelEntityGetterAdapter(final EntityLookup<T> visibleEntities, final EntitySectionStorage<T> sectionStorage) {
14
		this.visibleEntities = visibleEntities;
15
		this.sectionStorage = sectionStorage;
16
	}
17
18
	@Override
19
	public @Nullable T get(final int id) {
20
		return this.visibleEntities.getEntity(id);
21
	}
22
23
	@Override
24
	public @Nullable T get(final UUID id) {
25
		return this.visibleEntities.getEntity(id);
26
	}
27
28
	@Override
29
	public Iterable<T> getAll() {
30
		return this.visibleEntities.getAllEntities();
31
	}
32
33
	@Override
34
	public <U extends T> void get(final EntityTypeTest<T, U> type, final AbortableIterationConsumer<U> consumer) {
35
		this.visibleEntities.getEntities(type, consumer);
36
	}
37
38
	@Override
39
	public void get(final AABB bb, final Consumer<T> output) {
40
		this.sectionStorage.getEntities(bb, AbortableIterationConsumer.forConsumer(output));
41
	}
42
43
	@Override
44
	public <U extends T> void get(final EntityTypeTest<T, U> type, final AABB bb, final AbortableIterationConsumer<U> consumer) {
45
		this.sectionStorage.getEntities(type, bb, consumer);
46
	}
47
}
48

Decompiled Minecraft 26.3 source of LevelEntityGetterAdapter (net/minecraft/world/level/entity/LevelEntityGetterAdapter.java) with Mojang official mappings, stored verbatim on the site.