Class PoiManager
java.lang.Object
net.minecraft.world.level.chunk.storage.SectionStorage<PoiSection, PoiSection.Packed>
net.minecraft.world.entity.ai.village.poi.PoiManager
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PoiManager.DistanceTrackerprivate final it.unimi.dsi.fastutil.longs.LongSetstatic final intstatic final intFields inherited from class SectionStorage
levelHeightAccessor -
Constructor Summary
ConstructorsConstructorDescriptionPoiManager(RegionStorageInfo info, Path folder, com.mojang.datafixers.DataFixer fixerUpper, boolean sync, RegistryAccess registryAccess, ChunkIOErrorReporter errorReporter, LevelHeightAccessor levelHeightAccessor) -
Method Summary
Modifier and TypeMethodDescription@Nullable PoiRecordvoidcheckConsistencyWithBlocks(SectionPos sectionPos, LevelChunkSection blockSection) voidensureLoadedAndValid(LevelReader reader, BlockPos center, int radius) booleanbooleanexistsAtPosition(ResourceKey<PoiType> poiType, BlockPos blockPos) find(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, BlockPos center, int radius, PoiManager.Occupancy occupancy) findAll(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, BlockPos center, int radius, PoiManager.Occupancy occupancy) findAllClosestFirstWithType(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, BlockPos center, int radius, PoiManager.Occupancy occupancy) findAllWithType(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, BlockPos center, int radius, PoiManager.Occupancy occupancy) findClosest(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, BlockPos center, int radius, PoiManager.Occupancy occupancy) findClosest(Predicate<Holder<PoiType>> predicate, BlockPos center, int radius, PoiManager.Occupancy occupancy) findClosestWithType(Predicate<Holder<PoiType>> predicate, BlockPos center, int radius, PoiManager.Occupancy occupancy) longgetCountInRange(Predicate<Holder<PoiType>> predicate, BlockPos center, int radius, PoiManager.Occupancy occupancy) @Nullable DebugPoiInfogetDebugPoiInfo(BlockPos pos) getInChunk(Predicate<Holder<PoiType>> predicate, ChunkPos chunkPos, PoiManager.Occupancy occupancy) getInRange(Predicate<Holder<PoiType>> predicate, BlockPos center, int radius, PoiManager.Occupancy occupancy) getInSquare(Predicate<Holder<PoiType>> predicate, BlockPos center, int radius, PoiManager.Occupancy occupancy) getRandom(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, PoiManager.Occupancy occupancy, BlockPos center, int radius, RandomSource random) private booleanisVillageCenter(long sectionPos) private static booleanmayHavePoi(LevelChunkSection blockSection) protected voidonSectionLoad(long sectionPos) booleanvoidintsectionsToVillage(SectionPos sectionPos) protected voidsetDirty(long sectionPos) take(Predicate<Holder<PoiType>> predicate, BiPredicate<Holder<PoiType>, BlockPos> filter, BlockPos center, int radius) voidtick(BooleanSupplier haveTime) private voidupdateFromSection(LevelChunkSection blockSection, SectionPos pos, BiConsumer<BlockPos, Holder<PoiType>> output) Methods inherited from class SectionStorage
close, flush, flushAll, get, getOrCreate, getOrLoad, hasWork, outsideStoredRange, prefetch, remove
-
Field Details
-
MAX_VILLAGE_DISTANCE
public static final int MAX_VILLAGE_DISTANCE- See Also:
-
VILLAGE_SECTION_SIZE
public static final int VILLAGE_SECTION_SIZE- See Also:
-
distanceTracker
-
loadedChunks
private final it.unimi.dsi.fastutil.longs.LongSet loadedChunks
-
-
Constructor Details
-
PoiManager
public PoiManager(RegionStorageInfo info, Path folder, com.mojang.datafixers.DataFixer fixerUpper, boolean sync, RegistryAccess registryAccess, ChunkIOErrorReporter errorReporter, LevelHeightAccessor levelHeightAccessor)
-
-
Method Details
-
add
-
remove
-
getCountInRange
public long getCountInRange(Predicate<Holder<PoiType>> predicate, BlockPos center, int radius, PoiManager.Occupancy occupancy) -
existsAtPosition
-
getInSquare
-
getInRange
-
getInChunk
-
findAll
-
findAllWithType
-
findAllClosestFirstWithType
-
find
-
findClosest
-
findClosestWithType
-
findClosest
-
take
-
getRandom
public Optional<BlockPos> getRandom(Predicate<Holder<PoiType>> predicate, Predicate<BlockPos> filter, PoiManager.Occupancy occupancy, BlockPos center, int radius, RandomSource random) -
release
-
exists
-
getType
-
getDebugPoiInfo
-
sectionsToVillage
-
isVillageCenter
private boolean isVillageCenter(long sectionPos) -
tick
- Overrides:
tickin classSectionStorage<PoiSection, PoiSection.Packed>
-
setDirty
protected void setDirty(long sectionPos) - Overrides:
setDirtyin classSectionStorage<PoiSection, PoiSection.Packed>
-
onSectionLoad
protected void onSectionLoad(long sectionPos) - Overrides:
onSectionLoadin classSectionStorage<PoiSection, PoiSection.Packed>
-
checkConsistencyWithBlocks
-
mayHavePoi
-
updateFromSection
private void updateFromSection(LevelChunkSection blockSection, SectionPos pos, BiConsumer<BlockPos, Holder<PoiType>> output) -
ensureLoadedAndValid
-