Class ModelDataManager
java.lang.Object
net.neoforged.neoforge.client.model.data.ModelDataManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves model data for a block at the given position.@UnmodifiableView it.unimi.dsi.fastutil.longs.Long2ObjectMap<ModelData> getAt(SectionPos pos) Provides all the model data for a given chunk section.private booleanstatic voidonChunkUnload(ChunkEvent.Unload event) private voidrefreshAt(long section) voidrequestRefresh(BlockEntity blockEntity) Request a refresh of the stored data for the givenBlockEntity.it.unimi.dsi.fastutil.longs.Long2ObjectFunction<ModelData> snapshotSectionRegion(int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ) Snapshot the state of this manager for all sections in the volume specified by the given section coordinates.
-
Field Details
-
owningThread
-
level
-
needModelDataRefresh
-
modelDataCache
private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<it.unimi.dsi.fastutil.longs.Long2ObjectMap<ModelData>> modelDataCache -
EMPTY_SNAPSHOT
-
-
Constructor Details
-
ModelDataManager
-
-
Method Details
-
requestRefresh
Request a refresh of the stored data for the givenBlockEntity. The givenBlockEntitymust be in the level owning this manager -
getAt
public @UnmodifiableView it.unimi.dsi.fastutil.longs.Long2ObjectMap<ModelData> getAt(SectionPos pos) Provides all the model data for a given chunk section. This is useful for mods which wish to retrieve a fast view of the model data for a single section in a level.The returned map must be copied if it needs to be accessed from another thread, as it may be modified by this data manager.
- Parameters:
pos- the section to query- Returns:
- an (unmodifiable) map containing the
ModelDatastored for the given chunk section
-
getAt
Retrieves model data for a block at the given position.- Parameters:
pos- the position to query- Returns:
- the model data at this position, or
ModelData.EMPTYif none exists
-
snapshotSectionRegion
public it.unimi.dsi.fastutil.longs.Long2ObjectFunction<ModelData> snapshotSectionRegion(int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ) Snapshot the state of this manager for all sections in the volume specified by the given section coordinates. The snapshot will returnModelData.EMPTYfor nonexistent keys. -
refreshAt
private void refreshAt(long section) -
isOtherThread
private boolean isOtherThread() -
onChunkUnload
-