mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-09 13:56:04 +01:00
608204ee0a
- Check that sectionY is within the bounds of the chunk's section array, fixes #2 - Refactor usages of Tile and Entity InstanceManagers to refer to the base class InstanceManager<>
18 lines
424 B
Java
18 lines
424 B
Java
package com.jozufozu.flywheel.util;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
import net.minecraft.world.chunk.Chunk;
|
|
import net.minecraft.world.chunk.ChunkSection;
|
|
|
|
public class ChunkUtil {
|
|
|
|
public static boolean isValidSection(@Nullable Chunk chunk, int sectionY) {
|
|
if (chunk == null) return false;
|
|
|
|
// TODO: 1.17
|
|
ChunkSection[] sections = chunk.getSections();
|
|
|
|
return sectionY >= 0 && sectionY < sections.length;
|
|
}
|
|
}
|