From a30d62a995942731345a975fb88c20d931fbed12 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 19 Oct 2023 21:03:00 +1000 Subject: [PATCH] Move and rename chunk types --- .../viaversion/api/minecraft/ClientWorld.java | 46 +++++++++++++++++++ .../viaversion/viaversion/api/type/Type.java | 13 ++++-- .../BlockChangeRecordType.java | 2 +- .../{chunk => block}/BlockEntityType1_18.java | 2 +- .../BlockEntityType1_20_2.java | 2 +- .../VarLongBlockChangeRecordType.java | 2 +- .../type/types/chunk/BulkChunkType1_8.java | 46 ++++++++++--------- .../api/type/types/chunk/ChunkType1_13.java | 33 +++++++------ .../api/type/types/chunk/ChunkType1_14.java | 31 +++++++------ .../api/type/types/chunk/ChunkType1_15.java | 31 +++++++------ .../api/type/types/chunk/ChunkType1_16.java | 31 +++++++------ .../api/type/types/chunk/ChunkType1_16_2.java | 31 +++++++------ .../api/type/types/chunk/ChunkType1_17.java | 31 +++++++------ .../api/type/types/chunk/ChunkType1_18.java | 38 +++++++-------- .../api/type/types/chunk/ChunkType1_8.java | 33 +++++++------ .../api/type/types/chunk/ChunkType1_9_1.java | 33 +++++++------ .../api/type/types/chunk/ChunkType1_9_3.java | 33 +++++++------ .../api/type/types/version/Types1_18.java | 3 -- .../api/type/types/version/Types1_20_2.java | 3 -- .../Protocol1_10To1_9_3_4.java | 6 +-- .../Protocol1_11To1_10.java | 6 +-- .../Protocol1_12To1_11_1.java | 6 +-- .../Protocol1_13_1To1_13.java | 2 +- .../packets/WorldPackets.java | 6 +-- .../Protocol1_13To1_12_2.java | 2 +- .../packets/EntityPackets.java | 2 +- .../packets/WorldPackets.java | 10 ++-- .../Protocol1_14To1_13_2.java | 2 +- .../packets/EntityPackets.java | 2 +- .../packets/WorldPackets.java | 10 ++-- .../packets/WorldPackets.java | 8 ++-- .../packets/WorldPackets.java | 8 ++-- .../packets/WorldPackets.java | 8 ++-- .../packets/WorldPackets.java | 8 ++-- .../packets/WorldPackets.java | 8 ++-- .../packets/InventoryPackets.java | 4 +- .../packets/InventoryPackets.java | 4 +- .../packets/WorldPackets.java | 4 +- .../BlockItemPacketRewriter1_20_2.java | 4 +- .../type/ChunkType1_20_2.java | 5 +- .../packets/InventoryPackets.java | 4 +- .../Protocol1_9_3To1_9_1_2.java | 10 ++-- .../storage/ClientWorld.java | 42 ----------------- .../protocol1_9to1_8/Protocol1_9To1_8.java | 2 +- .../packets/PlayerPackets.java | 2 +- .../packets/WorldPackets.java | 16 +++---- 46 files changed, 345 insertions(+), 290 deletions(-) create mode 100644 api/src/main/java/com/viaversion/viaversion/api/minecraft/ClientWorld.java rename api/src/main/java/com/viaversion/viaversion/api/type/types/{chunk => block}/BlockChangeRecordType.java (97%) rename api/src/main/java/com/viaversion/viaversion/api/type/types/{chunk => block}/BlockEntityType1_18.java (97%) rename api/src/main/java/com/viaversion/viaversion/api/type/types/{chunk => block}/BlockEntityType1_20_2.java (97%) rename api/src/main/java/com/viaversion/viaversion/api/type/types/{chunk => block}/VarLongBlockChangeRecordType.java (97%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/ChunkBulk1_8Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BulkChunkType1_8.java (67%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/types/Chunk1_13Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_13.java (77%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/types/Chunk1_14Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java (76%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java (76%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/types/Chunk1_16Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java (77%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/types/Chunk1_16_2Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java (75%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/types/Chunk1_17Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java (75%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/types/Chunk1_18Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java (70%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/Chunk1_8Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java (78%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java (73%) rename common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java => api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java (75%) delete mode 100644 common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/ClientWorld.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/ClientWorld.java new file mode 100644 index 000000000..c1531ab40 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/ClientWorld.java @@ -0,0 +1,46 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * 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; + +import com.viaversion.viaversion.api.connection.StoredObject; +import com.viaversion.viaversion.api.connection.UserConnection; +import org.checkerframework.checker.nullness.qual.Nullable; + +/** + * Stored up until 1.14 to be used in chunk sending. + */ +public class ClientWorld extends StoredObject { + private Environment environment; + + public ClientWorld(final UserConnection connection) { + super(connection); + } + + public @Nullable Environment getEnvironment() { + return environment; + } + + public void setEnvironment(int environmentId) { + this.environment = Environment.getEnvironmentById(environmentId); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/Type.java index 40efc04f2..18dcbf18b 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/Type.java @@ -35,6 +35,7 @@ import com.viaversion.viaversion.api.minecraft.Quaternion; import com.viaversion.viaversion.api.minecraft.Vector; import com.viaversion.viaversion.api.minecraft.Vector3f; import com.viaversion.viaversion.api.minecraft.VillagerData; +import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition; import com.viaversion.viaversion.api.type.types.ArrayType; @@ -58,7 +59,9 @@ import com.viaversion.viaversion.api.type.types.UnsignedShortType; import com.viaversion.viaversion.api.type.types.VarIntArrayType; import com.viaversion.viaversion.api.type.types.VarIntType; import com.viaversion.viaversion.api.type.types.VarLongType; -import com.viaversion.viaversion.api.type.types.chunk.BlockChangeRecordType; +import com.viaversion.viaversion.api.type.types.block.BlockChangeRecordType; +import com.viaversion.viaversion.api.type.types.block.BlockEntityType1_18; +import com.viaversion.viaversion.api.type.types.block.BlockEntityType1_20_2; import com.viaversion.viaversion.api.type.types.math.ChunkPositionType; import com.viaversion.viaversion.api.type.types.misc.CompoundTagType; import com.viaversion.viaversion.api.type.types.math.EulerAngleType; @@ -78,7 +81,7 @@ import com.viaversion.viaversion.api.type.types.math.PositionType1_8; import com.viaversion.viaversion.api.type.types.misc.ProfileKeyType; import com.viaversion.viaversion.api.type.types.math.QuaternionType; import com.viaversion.viaversion.api.type.types.misc.TagType; -import com.viaversion.viaversion.api.type.types.chunk.VarLongBlockChangeRecordType; +import com.viaversion.viaversion.api.type.types.block.VarLongBlockChangeRecordType; import com.viaversion.viaversion.api.type.types.math.Vector3fType; import com.viaversion.viaversion.api.type.types.math.VectorType; import com.viaversion.viaversion.api.type.types.misc.VillagerDataType; @@ -153,9 +156,11 @@ public abstract class Type implements ByteBufReader, ByteBufWriter { public static final Type OPTIONAL_GLOBAL_POSITION = new GlobalPositionType.OptionalGlobalPositionType(); public static final Type CHUNK_POSITION = new ChunkPositionType(); + public static final Type BLOCK_ENTITY1_18 = new BlockEntityType1_18(); + public static final Type BLOCK_ENTITY1_20_2 = new BlockEntityType1_20_2(); + public static final Type BLOCK_CHANGE_RECORD = new BlockChangeRecordType(); public static final Type BLOCK_CHANGE_RECORD_ARRAY = new ArrayType<>(Type.BLOCK_CHANGE_RECORD); - public static final Type VAR_LONG_BLOCK_CHANGE_RECORD = new VarLongBlockChangeRecordType(); public static final Type VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY = new ArrayType<>(Type.VAR_LONG_BLOCK_CHANGE_RECORD); @@ -189,6 +194,8 @@ public abstract class Type implements ByteBufReader, ByteBufWriter { @Deprecated/*(forRemoval=true)*/ public static final Type FLAT_VAR_INT_ITEM = ITEM1_13_2; @Deprecated/*(forRemoval=true)*/ + public static final Type ITEM_ARRAY = ITEM1_8_ARRAY; + @Deprecated/*(forRemoval=true)*/ public static final Type FLAT_ITEM_ARRAY = ITEM1_13_SHORT_ARRAY; @Deprecated/*(forRemoval=true)*/ public static final Type FLAT_VAR_INT_ITEM_ARRAY = ITEM1_13_2_SHORT_ARRAY; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockChangeRecordType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockChangeRecordType.java similarity index 97% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockChangeRecordType.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockChangeRecordType.java index 5cc9e633c..fe4658716 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockChangeRecordType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockChangeRecordType.java @@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.chunk; +package com.viaversion.viaversion.api.type.types.block; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockEntityType1_18.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockEntityType1_18.java similarity index 97% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockEntityType1_18.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockEntityType1_18.java index c73c09b81..5439c9f96 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockEntityType1_18.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockEntityType1_18.java @@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.chunk; +package com.viaversion.viaversion.api.type.types.block; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockEntityType1_20_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockEntityType1_20_2.java similarity index 97% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockEntityType1_20_2.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockEntityType1_20_2.java index 5f946e198..b5de98531 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BlockEntityType1_20_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/BlockEntityType1_20_2.java @@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.chunk; +package com.viaversion.viaversion.api.type.types.block; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/VarLongBlockChangeRecordType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/VarLongBlockChangeRecordType.java similarity index 97% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/VarLongBlockChangeRecordType.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/block/VarLongBlockChangeRecordType.java index ab76f36b5..8d63411fc 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/VarLongBlockChangeRecordType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/block/VarLongBlockChangeRecordType.java @@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.chunk; +package com.viaversion.viaversion.api.type.types.block; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_16_2; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/ChunkBulk1_8Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BulkChunkType1_8.java similarity index 67% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/ChunkBulk1_8Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BulkChunkType1_8.java index a01888635..a360b9e5e 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/ChunkBulk1_8Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/BulkChunkType1_8.java @@ -2,37 +2,41 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_9to1_8.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.type.PartialType; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.chunk.BaseChunkBulkType; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import io.netty.buffer.ByteBuf; -public class ChunkBulk1_8Type extends PartialType { +public class BulkChunkType1_8 extends PartialType { private static final int BLOCKS_PER_SECTION = 16 * 16 * 16; private static final int BLOCKS_BYTES = BLOCKS_PER_SECTION * 2; private static final int LIGHT_BYTES = BLOCKS_PER_SECTION / 2; private static final int BIOME_BYTES = 16 * 16; - public ChunkBulk1_8Type(final ClientWorld clientWorld) { + public BulkChunkType1_8(final ClientWorld clientWorld) { super(clientWorld, Chunk[].class); } @@ -56,7 +60,7 @@ public class ChunkBulk1_8Type extends PartialType { for (int i = 0; i < chunks.length; i++) { final ChunkBulkSection chunkBulkSection = chunkInfo[i]; chunkBulkSection.readData(input); - chunks[i] = Chunk1_8Type.deserialize(chunkBulkSection.chunkX, chunkBulkSection.chunkZ, true, skyLight, chunkBulkSection.bitmask, chunkBulkSection.getData()); + chunks[i] = ChunkType1_8.deserialize(chunkBulkSection.chunkX, chunkBulkSection.chunkZ, true, skyLight, chunkBulkSection.bitmask, chunkBulkSection.data()); } return chunks; @@ -85,7 +89,7 @@ public class ChunkBulk1_8Type extends PartialType { } // Write data for (Chunk c : chunks) { - output.writeBytes(Chunk1_8Type.serialize(c)); + output.writeBytes(ChunkType1_8.serialize(c)); } } @@ -107,19 +111,19 @@ public class ChunkBulk1_8Type extends PartialType { input.readBytes(this.data); } - public int getChunkX() { + public int chunkX() { return this.chunkX; } - public int getChunkZ() { + public int chunkZ() { return this.chunkZ; } - public int getBitmask() { + public int bitmask() { return this.bitmask; } - public byte[] getData() { + public byte[] data() { return this.data; } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/types/Chunk1_13Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_13.java similarity index 77% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/types/Chunk1_13Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_13.java index e339a5d7a..bcc6095a4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/types/Chunk1_13Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_13.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_13to1_12_2.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -27,16 +32,16 @@ import com.viaversion.viaversion.api.type.PartialType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.version.Types1_13; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.Level; -public class Chunk1_13Type extends PartialType { +public class ChunkType1_13 extends PartialType { - public Chunk1_13Type(ClientWorld param) { + public ChunkType1_13(ClientWorld param) { super(param, Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/types/Chunk1_14Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java similarity index 76% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/types/Chunk1_14Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java index b01670a16..f3fa88bd8 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/types/Chunk1_14Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_14to1_13_2.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -30,9 +35,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class Chunk1_14Type extends Type { +public class ChunkType1_14 extends Type { - public Chunk1_14Type() { + public ChunkType1_14() { super(Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java similarity index 76% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java index ab93960a5..3a96fbcc8 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_15to1_14_4.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -30,10 +35,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class Chunk1_15Type extends Type { +public class ChunkType1_15 extends Type { private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; - public Chunk1_15Type() { + public ChunkType1_15() { super(Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/types/Chunk1_16Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java similarity index 77% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/types/Chunk1_16Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java index 5a835ca02..36f8d631f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/types/Chunk1_16Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_16to1_15_2.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -30,10 +35,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class Chunk1_16Type extends Type { +public class ChunkType1_16 extends Type { private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; - public Chunk1_16Type() { + public ChunkType1_16() { super(Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/types/Chunk1_16_2Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java similarity index 75% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/types/Chunk1_16_2Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java index 49fe4515d..7ab7515f1 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/types/Chunk1_16_2Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_16_2to1_16_1.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -30,10 +35,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class Chunk1_16_2Type extends Type { +public class ChunkType1_16_2 extends Type { private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; - public Chunk1_16_2Type() { + public ChunkType1_16_2() { super(Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/types/Chunk1_17Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java similarity index 75% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/types/Chunk1_17Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java index 0299664a5..b036fc290 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/types/Chunk1_17Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_17to1_16_4.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.google.common.base.Preconditions; @@ -32,11 +37,11 @@ import java.util.Arrays; import java.util.BitSet; import java.util.List; -public final class Chunk1_17Type extends Type { +public final class ChunkType1_17 extends Type { private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; private final int ySectionCount; - public Chunk1_17Type(int ySectionCount) { + public ChunkType1_17(int ySectionCount) { super(Chunk.class); Preconditions.checkArgument(ySectionCount > 0); this.ySectionCount = ySectionCount; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/types/Chunk1_18Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java similarity index 70% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/types/Chunk1_18Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java index f3c1ae250..5beb494bd 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/types/Chunk1_18Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_18to1_17_1.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.google.common.base.Preconditions; @@ -24,18 +29,15 @@ import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk1_18; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; -import com.viaversion.viaversion.api.type.types.chunk.ChunkSectionType1_18; -import com.viaversion.viaversion.api.type.types.version.Types1_18; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; -public final class Chunk1_18Type extends Type { +public final class ChunkType1_18 extends Type { private final ChunkSectionType1_18 sectionType; private final int ySectionCount; - public Chunk1_18Type(final int ySectionCount, final int globalPaletteBlockBits, final int globalPaletteBiomeBits) { + public ChunkType1_18(final int ySectionCount, final int globalPaletteBlockBits, final int globalPaletteBiomeBits) { super(Chunk.class); Preconditions.checkArgument(ySectionCount > 0); this.sectionType = new ChunkSectionType1_18(globalPaletteBlockBits, globalPaletteBiomeBits); @@ -65,7 +67,7 @@ public final class Chunk1_18Type extends Type { final int blockEntitiesLength = Type.VAR_INT.readPrimitive(buffer); final List blockEntities = new ArrayList<>(blockEntitiesLength); for (int i = 0; i < blockEntitiesLength; i++) { - blockEntities.add(Types1_18.BLOCK_ENTITY.read(buffer)); + blockEntities.add(Type.BLOCK_ENTITY1_18.read(buffer)); } return new Chunk1_18(chunkX, chunkZ, sections, heightMap, blockEntities); @@ -92,7 +94,7 @@ public final class Chunk1_18Type extends Type { Type.VAR_INT.writePrimitive(buffer, chunk.blockEntities().size()); for (final BlockEntity blockEntity : chunk.blockEntities()) { - Types1_18.BLOCK_ENTITY.write(buffer, blockEntity); + Type.BLOCK_ENTITY1_18.write(buffer, blockEntity); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/Chunk1_8Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java similarity index 78% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/Chunk1_8Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java index 57052b71d..379729b26 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/types/Chunk1_8Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_9to1_8.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.viaversion.api.minecraft.Environment; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; @@ -25,14 +30,14 @@ import com.viaversion.viaversion.api.type.PartialType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.version.Types1_8; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.util.ArrayList; -public class Chunk1_8Type extends PartialType { +public class ChunkType1_8 extends PartialType { - public Chunk1_8Type(ClientWorld param) { + public ChunkType1_8(ClientWorld param) { super(param, Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java similarity index 73% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java index d4fae616a..330014765 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_9_1to1_9.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.viaversion.api.minecraft.Environment; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; @@ -25,14 +30,14 @@ import com.viaversion.viaversion.api.type.PartialType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.version.Types1_9; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.BitSet; -public class Chunk1_9_1_2Type extends PartialType { +public class ChunkType1_9_1 extends PartialType { - public Chunk1_9_1_2Type(ClientWorld clientWorld) { + public ChunkType1_9_1(ClientWorld clientWorld) { super(clientWorld, Chunk.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java similarity index 75% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java index 251ac1b35..40da56fab 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java @@ -2,20 +2,25 @@ * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2023 ViaVersion and contributors * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * 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.protocols.protocol1_9_3to1_9_1_2.types; +package com.viaversion.viaversion.api.type.types.chunk; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -27,15 +32,15 @@ import com.viaversion.viaversion.api.type.PartialType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.version.Types1_9; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class Chunk1_9_3_4Type extends PartialType { +public class ChunkType1_9_3 extends PartialType { - public Chunk1_9_3_4Type(ClientWorld param) { + public ChunkType1_9_3(ClientWorld param) { super(param, Chunk.class); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java index 32bef5325..a0f7b084a 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java @@ -22,11 +22,9 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.chunk.BlockEntityType1_18; import com.viaversion.viaversion.api.type.types.metadata.MetaListType; import com.viaversion.viaversion.api.type.types.metadata.MetadataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; @@ -34,7 +32,6 @@ import java.util.List; public final class Types1_18 { - public static final Type BLOCK_ENTITY = new BlockEntityType1_18(); public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading public static final MetaTypes1_14 META_TYPES = new MetaTypes1_14(PARTICLE); public static final Type METADATA = new MetadataType(META_TYPES); diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java index 167e89787..c7f6e01cf 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java @@ -22,11 +22,9 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_20_2; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.chunk.BlockEntityType1_20_2; import com.viaversion.viaversion.api.type.types.metadata.MetaListType; import com.viaversion.viaversion.api.type.types.metadata.MetadataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; @@ -34,7 +32,6 @@ import java.util.List; public final class Types1_20_2 { - public static final Type BLOCK_ENTITY = new BlockEntityType1_20_2(); public static final ParticleType PARTICLE = Types1_20.PARTICLE; // Only safe to use after protocol loading public static final MetaTypes1_20_2 META_TYPES = new MetaTypes1_20_2(PARTICLE); public static final Type METADATA = new MetadataType(META_TYPES); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java index 0e2e02678..f78560847 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java @@ -33,8 +33,8 @@ import com.viaversion.viaversion.protocols.protocol1_10to1_9_3.packets.Inventory import com.viaversion.viaversion.protocols.protocol1_10to1_9_3.storage.ResourcePackTracker; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -179,7 +179,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - Chunk chunk = wrapper.passthrough(new Chunk1_9_3_4Type(clientWorld)); + Chunk chunk = wrapper.passthrough(new ChunkType1_9_3(clientWorld)); if (Via.getConfig().isReplacePistons()) { int replacementId = Via.getConfig().getPistonReplacementId(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java index dddd56c19..7597101cc 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java @@ -35,8 +35,8 @@ import com.viaversion.viaversion.protocols.protocol1_11to1_10.packets.InventoryP import com.viaversion.viaversion.protocols.protocol1_11to1_10.storage.EntityTracker1_11; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.util.Pair; @@ -208,7 +208,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - Chunk chunk = wrapper.passthrough(new Chunk1_9_3_4Type(clientWorld)); + Chunk chunk = wrapper.passthrough(new ChunkType1_9_3(clientWorld)); if (chunk.getBlockEntities() == null) return; for (CompoundTag tag : chunk.getBlockEntities()) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java index dce4ca611..7b641e9f4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java @@ -42,8 +42,8 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import com.viaversion.viaversion.rewriter.SoundRewriter; @@ -110,7 +110,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - Chunk1_9_3_4Type type = new Chunk1_9_3_4Type(clientWorld); + ChunkType1_9_3 type = new ChunkType1_9_3(clientWorld); Chunk chunk = wrapper.passthrough(type); for (int s = 0; s < chunk.getSections().length; s++) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/Protocol1_13_1To1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/Protocol1_13_1To1_13.java index d9526270b..01e605404 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/Protocol1_13_1To1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/Protocol1_13_1To1_13.java @@ -35,7 +35,7 @@ import com.viaversion.viaversion.protocols.protocol1_13_1to1_13.packets.Inventor import com.viaversion.viaversion.protocols.protocol1_13_1to1_13.packets.WorldPackets; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/packets/WorldPackets.java index 6c03179fc..01461ca9f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/packets/WorldPackets.java @@ -25,8 +25,8 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; -import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_13; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.rewriter.BlockRewriter; public class WorldPackets { @@ -36,7 +36,7 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, wrapper -> { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - Chunk chunk = wrapper.passthrough(new Chunk1_13Type(clientWorld)); + Chunk chunk = wrapper.passthrough(new ChunkType1_13(clientWorld)); for (ChunkSection section : chunk.getSections()) { if (section == null) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java index 53d7bd992..938d28229 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java @@ -59,7 +59,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.Player import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockConnectionStorage; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.util.ChatColorUtil; import com.viaversion.viaversion.util.GsonUtil; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java index c9019cd79..01042c597 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.type.types.version.Types1_13; import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.metadata.MetadataRewriter1_13To1_12_2; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; public class EntityPackets { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java index 1b382eb8f..b7c469a27 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java @@ -44,9 +44,9 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.ParticleRew import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PaintingProvider; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage; -import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_13; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -331,8 +331,8 @@ public class WorldPackets { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); BlockStorage storage = wrapper.user().get(BlockStorage.class); - Chunk1_9_3_4Type type = new Chunk1_9_3_4Type(clientWorld); - Chunk1_13Type type1_13 = new Chunk1_13Type(clientWorld); + ChunkType1_9_3 type = new ChunkType1_9_3(clientWorld); + ChunkType1_13 type1_13 = new ChunkType1_13(clientWorld); Chunk chunk = wrapper.read(type); wrapper.write(type1_13, chunk); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java index 5c97c49ac..80aa01d32 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java @@ -33,7 +33,7 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.Inventor import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.PlayerPackets; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.WorldPackets; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.rewriter.CommandRewriter; import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java index b81974b78..ba2eff6df 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java @@ -32,7 +32,7 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPacke import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.metadata.MetadataRewriter1_14To1_13_2; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import java.util.LinkedList; import java.util.List; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java index 63c5412c4..cf3403b90 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java @@ -31,12 +31,12 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; -import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_13; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14; -import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_14; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.util.CompactArrayUtil; import java.util.Arrays; @@ -126,8 +126,8 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, wrapper -> { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - Chunk chunk = wrapper.read(new Chunk1_13Type(clientWorld)); - wrapper.write(new Chunk1_14Type(), chunk); + Chunk chunk = wrapper.read(new ChunkType1_13(clientWorld)); + wrapper.write(new ChunkType1_14(), chunk); int[] motionBlocking = new int[16 * 16]; int[] worldSurface = new int[16 * 16]; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index 4468855a3..720a0e2cb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -24,9 +24,9 @@ import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_14_4to1_14_3.ClientboundPackets1_14_4; -import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_14; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4; -import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_15; import com.viaversion.viaversion.rewriter.BlockRewriter; public final class WorldPackets { @@ -40,8 +40,8 @@ public final class WorldPackets { blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_14_4.ACKNOWLEDGE_PLAYER_DIGGING); protocol.registerClientbound(ClientboundPackets1_14_4.CHUNK_DATA, wrapper -> { - Chunk chunk = wrapper.read(new Chunk1_14Type()); - wrapper.write(new Chunk1_15Type(), chunk); + Chunk chunk = wrapper.read(new ChunkType1_14()); + wrapper.write(new ChunkType1_15(), chunk); if (chunk.isFullChunk()) { int[] biomeData = chunk.getBiomeData(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/WorldPackets.java index c1b80d7a8..31aff57b5 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/WorldPackets.java @@ -27,9 +27,9 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1; -import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16_2; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16; -import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.types.Chunk1_16Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16; import com.viaversion.viaversion.rewriter.BlockRewriter; import java.util.ArrayList; import java.util.List; @@ -46,8 +46,8 @@ public class WorldPackets { blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.ACKNOWLEDGE_PLAYER_DIGGING); protocol.registerClientbound(ClientboundPackets1_16.CHUNK_DATA, wrapper -> { - Chunk chunk = wrapper.read(new Chunk1_16Type()); - wrapper.write(new Chunk1_16_2Type(), chunk); + Chunk chunk = wrapper.read(new ChunkType1_16()); + wrapper.write(new ChunkType1_16_2(), chunk); for (int s = 0; s < chunk.getSections().length; s++) { ChunkSection section = chunk.getSections()[s]; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java index cc959f02e..bb24bec88 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java @@ -31,9 +31,9 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.UUIDIntArrayType; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15; -import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_15; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; -import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.types.Chunk1_16Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16; import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.util.CompactArrayUtil; import java.util.Map; @@ -59,8 +59,8 @@ public class WorldPackets { }); protocol.registerClientbound(ClientboundPackets1_15.CHUNK_DATA, wrapper -> { - Chunk chunk = wrapper.read(new Chunk1_15Type()); - wrapper.write(new Chunk1_16Type(), chunk); + Chunk chunk = wrapper.read(new ChunkType1_15()); + wrapper.write(new ChunkType1_16(), chunk); chunk.setIgnoreOldLightData(chunk.isFullChunk()); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/WorldPackets.java index eadfdfe9b..b22a37410 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/WorldPackets.java @@ -28,10 +28,10 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2; -import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16_2; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4; -import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17; import com.viaversion.viaversion.rewriter.BlockRewriter; import java.util.ArrayList; import java.util.BitSet; @@ -122,7 +122,7 @@ public final class WorldPackets { }); protocol.registerClientbound(ClientboundPackets1_16_2.CHUNK_DATA, wrapper -> { - Chunk chunk = wrapper.read(new Chunk1_16_2Type()); + Chunk chunk = wrapper.read(new ChunkType1_16_2()); if (!chunk.isFullChunk()) { // All chunks are full chunk packets now (1.16 already stopped sending non-full chunks) // Construct multi block change packets instead @@ -134,7 +134,7 @@ public final class WorldPackets { } // Normal full chunk writing - wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk); + wrapper.write(new ChunkType1_17(chunk.getSections().length), chunk); // 1.17 uses a bitset for the mask chunk.setChunkMask(BitSet.valueOf(new long[]{chunk.getBitmask()})); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java index d3a91fb58..fa374ca74 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java @@ -34,11 +34,11 @@ import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1; -import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.BlockEntityIds; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.storage.ChunkLightStorage; -import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_18; import com.viaversion.viaversion.util.Key; import com.viaversion.viaversion.util.MathUtil; import java.util.ArrayList; @@ -103,7 +103,7 @@ public final class WorldPackets { protocol.registerClientbound(ClientboundPackets1_17_1.CHUNK_DATA, wrapper -> { final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); - final Chunk oldChunk = wrapper.read(new Chunk1_17Type(tracker.currentWorldSectionHeight())); + final Chunk oldChunk = wrapper.read(new ChunkType1_17(tracker.currentWorldSectionHeight())); final List blockEntities = new ArrayList<>(oldChunk.getBlockEntities().size()); for (final CompoundTag tag : oldChunk.getBlockEntities()) { @@ -155,7 +155,7 @@ public final class WorldPackets { } final Chunk chunk = new Chunk1_18(oldChunk.getX(), oldChunk.getZ(), sections, oldChunk.getHeightMap(), blockEntities); - wrapper.write(new Chunk1_18Type(tracker.currentWorldSectionHeight(), + wrapper.write(new ChunkType1_18(tracker.currentWorldSectionHeight(), MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), MathUtil.ceilLog2(tracker.biomesSent())), chunk); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_3to1_19_1/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_3to1_19_1/packets/InventoryPackets.java index ab74f9f1e..8a8927280 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_3to1_19_1/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_3to1_19_1/packets/InventoryPackets.java @@ -20,7 +20,7 @@ package com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_18; import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.Protocol1_19_3To1_19_1; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3; @@ -44,7 +44,7 @@ public final class InventoryPackets extends ItemRewriter { final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); - final Type chunkType = new Chunk1_18Type(tracker.currentWorldSectionHeight(), + final Type chunkType = new ChunkType1_18(tracker.currentWorldSectionHeight(), MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()), MathUtil.ceilLog2(tracker.biomesSent())); final Chunk chunk = wrapper.read(chunkType); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/type/ChunkType1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/type/ChunkType1_20_2.java index 1a6d058a5..21cd2dc41 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/type/ChunkType1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/type/ChunkType1_20_2.java @@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.chunk.ChunkSectionType1_18; -import com.viaversion.viaversion.api.type.types.version.Types1_20_2; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; @@ -62,7 +61,7 @@ public final class ChunkType1_20_2 extends Type { final int blockEntitiesLength = Type.VAR_INT.readPrimitive(buffer); final List blockEntities = new ArrayList<>(blockEntitiesLength); for (int i = 0; i < blockEntitiesLength; i++) { - blockEntities.add(Types1_20_2.BLOCK_ENTITY.read(buffer)); + blockEntities.add(Type.BLOCK_ENTITY1_20_2.read(buffer)); } return new Chunk1_18(chunkX, chunkZ, sections, heightMap, blockEntities); @@ -89,7 +88,7 @@ public final class ChunkType1_20_2 extends Type { Type.VAR_INT.writePrimitive(buffer, chunk.blockEntities().size()); for (final BlockEntity blockEntity : chunk.blockEntities()) { - Types1_20_2.BLOCK_ENTITY.write(buffer, blockEntity); + Type.BLOCK_ENTITY1_20_2.write(buffer, blockEntity); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/InventoryPackets.java index ec4252fbf..275f91ee4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/InventoryPackets.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter; -import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_18; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ServerboundPackets1_19_4; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.RecipeRewriter1_19_4; @@ -111,7 +111,7 @@ public final class InventoryPackets extends ItemRewriter { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - Chunk chunk = wrapper.read(new Chunk1_9_1_2Type(clientWorld)); - wrapper.write(new Chunk1_9_3_4Type(clientWorld), chunk); + Chunk chunk = wrapper.read(new ChunkType1_9_1(clientWorld)); + wrapper.write(new ChunkType1_9_3(clientWorld), chunk); List tags = chunk.getBlockEntities(); for (int s = 0; s < chunk.getSections().length; s++) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java deleted file mode 100644 index 6a51f21c5..000000000 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2023 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage; - -import com.viaversion.viaversion.api.connection.StoredObject; -import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.api.minecraft.Environment; -import org.checkerframework.checker.nullness.qual.Nullable; - -/** - * Stored up until 1.14 to be used in chunk sending. - */ -public class ClientWorld extends StoredObject { - private Environment environment; - - public ClientWorld(final UserConnection connection) { - super(connection); - } - - public @Nullable Environment getEnvironment() { - return environment; - } - - public void setEnvironment(int environmentId) { - this.environment = Environment.getEnvironmentById(environmentId); - } -} diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java index ad65c29ee..d4e7322e1 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java @@ -30,7 +30,7 @@ import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.protocols.protocol1_9to1_8.metadata.MetadataRewriter1_9To1_8; import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.EntityPackets; import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.InventoryPackets; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/PlayerPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/PlayerPackets.java index 5e9a24c8c..81b3ee575 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/PlayerPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/PlayerPackets.java @@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ItemRewriter; import com.viaversion.viaversion.protocols.protocol1_9to1_8.PlayerMovementMapper; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java index d623a3e87..0300d2cec 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -32,8 +32,8 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8; -import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types.Chunk1_9_1_2Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1; +import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ItemRewriter; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; @@ -43,8 +43,8 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.sounds.Effect; import com.viaversion.viaversion.protocols.protocol1_9to1_8.sounds.SoundEffect; import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.ClientChunks; import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.types.Chunk1_8Type; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.types.ChunkBulk1_8Type; +import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_8; +import com.viaversion.viaversion.api.type.types.chunk.BulkChunkType1_8; import java.util.ArrayList; import java.util.Optional; @@ -122,7 +122,7 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_8.CHUNK_DATA, wrapper -> { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientChunks clientChunks = wrapper.user().get(ClientChunks.class); - Chunk chunk = wrapper.read(new Chunk1_8Type(clientWorld)); + Chunk chunk = wrapper.read(new ChunkType1_8(clientWorld)); long chunkHash = ClientChunks.toLong(chunk.getX(), chunk.getZ()); @@ -152,7 +152,7 @@ public class WorldPackets { } } } else { - Type chunkType = new Chunk1_9_1_2Type(clientWorld); + Type chunkType = new ChunkType1_9_1(clientWorld); wrapper.write(chunkType, chunk); clientChunks.getLoadedChunks().add(chunkHash); @@ -177,9 +177,9 @@ public class WorldPackets { wrapper.cancel(); // Cancel the packet from being sent ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientChunks clientChunks = wrapper.user().get(ClientChunks.class); - Chunk[] chunks = wrapper.read(new ChunkBulk1_8Type(clientWorld)); + Chunk[] chunks = wrapper.read(new BulkChunkType1_8(clientWorld)); - Type chunkType = new Chunk1_9_1_2Type(clientWorld); + Type chunkType = new ChunkType1_9_1(clientWorld); // Split into multiple chunk packets for (Chunk chunk : chunks) { PacketWrapper chunkData = wrapper.create(ClientboundPackets1_9.CHUNK_DATA);