ViaVersion/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/Chunk.java

128 lines
3.7 KiB
Java
Raw Normal View History

/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
2023-01-12 12:45:53 +01:00
* Copyright (C) 2016-2023 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft.chunks;
2016-03-12 13:32:00 +01:00
2017-05-14 14:34:51 +02:00
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
2021-09-14 17:38:52 +02:00
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
import org.checkerframework.checker.nullness.qual.Nullable;
2021-01-20 17:59:34 +01:00
import java.util.BitSet;
import java.util.List;
// TODO specialized sub interfaces
2018-10-25 20:26:24 +02:00
public interface Chunk {
2020-04-04 00:32:00 +02:00
/**
* Returns the chunk x coordinate.
*
* @return chunk x coordinate
*/
2018-10-25 20:26:24 +02:00
int getX();
/**
* Returns the chunk z coordinate.
*
* @return chunk z coordinate
*/
2018-10-25 20:26:24 +02:00
int getZ();
2021-01-20 17:59:34 +01:00
/**
2021-04-08 10:58:54 +02:00
* Returns whether this chunk holds biome data, always true for 1.17+ chunks.
*
* @return true if this chunk holds biome data
2021-01-20 17:59:34 +01:00
*/
2018-10-25 20:26:24 +02:00
boolean isBiomeData();
2021-01-20 17:59:34 +01:00
/**
2021-04-08 10:58:54 +02:00
* Returns whether this is a full chunk, always true for 1.17+ chunks.
*
* @return true if this is a full chunk
2021-01-20 17:59:34 +01:00
*/
2020-04-04 00:32:00 +02:00
boolean isFullChunk();
2020-06-16 18:38:16 +02:00
boolean isIgnoreOldLightData();
void setIgnoreOldLightData(boolean ignoreOldLightData);
2021-01-20 17:59:34 +01:00
/**
2021-04-08 10:58:54 +02:00
* Returns the chunk section bit mask for chunks < 1.17.
*
2021-02-17 14:49:10 +01:00
* @return chunk section bit mask for chunks < 1.17
2021-01-20 17:59:34 +01:00
* @see #getChunkMask()
*/
2018-10-25 20:26:24 +02:00
int getBitmask();
2021-01-20 18:24:43 +01:00
void setBitmask(int bitmask);
2021-01-20 17:59:34 +01:00
/**
2021-04-08 10:58:54 +02:00
* Returns the chunk section bit mask, only non-null for 1.17+ chunks.
*
* @return chunk section bit mask, only non-null for 1.17+ chunks
2021-01-20 17:59:34 +01:00
* @see #getBitmask()
*/
@Nullable BitSet getChunkMask();
2021-01-20 17:59:34 +01:00
void setChunkMask(BitSet chunkSectionMask);
/**
* Returns an array of nullable chunk section entries.
*
* @return array of nullable chunk sections
*/
@Nullable ChunkSection[] getSections();
2018-10-25 20:26:24 +02:00
2021-02-11 00:00:02 +01:00
void setSections(ChunkSection[] sections);
/**
* Returns the chunk's raw biome data. The format the biomes are stored may vary.
*
* @return raw biome data
*/
int @Nullable [] getBiomeData();
2018-10-25 20:26:24 +02:00
void setBiomeData(int @Nullable [] biomeData);
2019-12-02 11:20:48 +01:00
/**
* Returns a compoundtag containing the chunk's heightmaps if present.
*
* @return compoundtag containing heightmaps if present
*/
@Nullable CompoundTag getHeightMap();
2019-04-24 18:40:03 +02:00
void setHeightMap(@Nullable CompoundTag heightMap);
2019-04-24 18:40:03 +02:00
/**
* Returns a list of block entities.
*
* @return list of block entities
*/
2018-10-25 20:26:24 +02:00
List<CompoundTag> getBlockEntities();
2021-09-14 17:38:52 +02:00
/**
* Returns a list of block entities.
*
* @return list of block entities
*/
List<BlockEntity> blockEntities();
2016-03-12 13:32:00 +01:00
}