From 8bcd8fd99593bb9d1b872b3445671c9b648e894a Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 22 May 2021 19:39:26 +0200 Subject: [PATCH] Add apiVersion to ViaAPI, some jd --- .../java/com/viaversion/viaversion/api/ViaAPI.java | 10 ++++++++++ .../viaversion/api/minecraft/chunks/ChunkSection.java | 8 +++++++- .../viaversion/api/protocol/AbstractProtocol.java | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/ViaAPI.java b/api/src/main/java/com/viaversion/viaversion/api/ViaAPI.java index f5984ce31..39fdea8a3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/ViaAPI.java +++ b/api/src/main/java/com/viaversion/viaversion/api/ViaAPI.java @@ -45,6 +45,16 @@ import java.util.UUID; */ public interface ViaAPI { + /** + * Returns the API version incremented with meaningful API changes. + * This includes breaking changes to existing API and larger additions. + * + * @return API version incremented with meaningful API changes + */ + default int apiVersion() { + return 1; + } + /** * Returns the server's protocol version info. * diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSection.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSection.java index 92d2517eb..619783775 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSection.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSection.java @@ -181,7 +181,7 @@ public interface ChunkSection { /** * Returns whether this section holds light data. - * Only true for < 1.14 clients. + * Only true for < 1.14 chunks. * * @return whether this section holds light data */ @@ -189,6 +189,12 @@ public interface ChunkSection { return getLight() != null; } + /** + * Returns the light of the chunk section. + * Only present for < 1.14 chunks, otherwise sent separately. + * + * @return chunk section light if present + */ @Nullable ChunkSectionLight getLight(); void setLight(@Nullable ChunkSectionLight light); diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java index a35971323..1dc29cb40 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java @@ -336,7 +336,7 @@ public abstract class AbstractProtocol