3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Move and rename chunk types

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-10-19 21:03:00 +10:00
Ursprung 08f6b3ce36
Commit a30d62a995
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
46 geänderte Dateien mit 345 neuen und 290 gelöschten Zeilen

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -35,6 +35,7 @@ import com.viaversion.viaversion.api.minecraft.Quaternion;
import com.viaversion.viaversion.api.minecraft.Vector; import com.viaversion.viaversion.api.minecraft.Vector;
import com.viaversion.viaversion.api.minecraft.Vector3f; import com.viaversion.viaversion.api.minecraft.Vector3f;
import com.viaversion.viaversion.api.minecraft.VillagerData; 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.item.Item;
import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition; import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition;
import com.viaversion.viaversion.api.type.types.ArrayType; 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.VarIntArrayType;
import com.viaversion.viaversion.api.type.types.VarIntType; import com.viaversion.viaversion.api.type.types.VarIntType;
import com.viaversion.viaversion.api.type.types.VarLongType; 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.math.ChunkPositionType;
import com.viaversion.viaversion.api.type.types.misc.CompoundTagType; import com.viaversion.viaversion.api.type.types.misc.CompoundTagType;
import com.viaversion.viaversion.api.type.types.math.EulerAngleType; 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.misc.ProfileKeyType;
import com.viaversion.viaversion.api.type.types.math.QuaternionType; 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.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.Vector3fType;
import com.viaversion.viaversion.api.type.types.math.VectorType; import com.viaversion.viaversion.api.type.types.math.VectorType;
import com.viaversion.viaversion.api.type.types.misc.VillagerDataType; import com.viaversion.viaversion.api.type.types.misc.VillagerDataType;
@ -153,9 +156,11 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
public static final Type<GlobalPosition> OPTIONAL_GLOBAL_POSITION = new GlobalPositionType.OptionalGlobalPositionType(); public static final Type<GlobalPosition> OPTIONAL_GLOBAL_POSITION = new GlobalPositionType.OptionalGlobalPositionType();
public static final Type<ChunkPosition> CHUNK_POSITION = new ChunkPositionType(); public static final Type<ChunkPosition> CHUNK_POSITION = new ChunkPositionType();
public static final Type<BlockEntity> BLOCK_ENTITY1_18 = new BlockEntityType1_18();
public static final Type<BlockEntity> BLOCK_ENTITY1_20_2 = new BlockEntityType1_20_2();
public static final Type<BlockChangeRecord> BLOCK_CHANGE_RECORD = new BlockChangeRecordType(); public static final Type<BlockChangeRecord> BLOCK_CHANGE_RECORD = new BlockChangeRecordType();
public static final Type<BlockChangeRecord[]> BLOCK_CHANGE_RECORD_ARRAY = new ArrayType<>(Type.BLOCK_CHANGE_RECORD); public static final Type<BlockChangeRecord[]> BLOCK_CHANGE_RECORD_ARRAY = new ArrayType<>(Type.BLOCK_CHANGE_RECORD);
public static final Type<BlockChangeRecord> VAR_LONG_BLOCK_CHANGE_RECORD = new VarLongBlockChangeRecordType(); public static final Type<BlockChangeRecord> VAR_LONG_BLOCK_CHANGE_RECORD = new VarLongBlockChangeRecordType();
public static final Type<BlockChangeRecord[]> VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY = new ArrayType<>(Type.VAR_LONG_BLOCK_CHANGE_RECORD); public static final Type<BlockChangeRecord[]> VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY = new ArrayType<>(Type.VAR_LONG_BLOCK_CHANGE_RECORD);
@ -189,6 +194,8 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
@Deprecated/*(forRemoval=true)*/ @Deprecated/*(forRemoval=true)*/
public static final Type<Item> FLAT_VAR_INT_ITEM = ITEM1_13_2; public static final Type<Item> FLAT_VAR_INT_ITEM = ITEM1_13_2;
@Deprecated/*(forRemoval=true)*/ @Deprecated/*(forRemoval=true)*/
public static final Type<Item[]> ITEM_ARRAY = ITEM1_8_ARRAY;
@Deprecated/*(forRemoval=true)*/
public static final Type<Item[]> FLAT_ITEM_ARRAY = ITEM1_13_SHORT_ARRAY; public static final Type<Item[]> FLAT_ITEM_ARRAY = ITEM1_13_SHORT_ARRAY;
@Deprecated/*(forRemoval=true)*/ @Deprecated/*(forRemoval=true)*/
public static final Type<Item[]> FLAT_VAR_INT_ITEM_ARRAY = ITEM1_13_2_SHORT_ARRAY; public static final Type<Item[]> FLAT_VAR_INT_ITEM_ARRAY = ITEM1_13_2_SHORT_ARRAY;

Datei anzeigen

@ -20,7 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * 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.BlockChangeRecord;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8;

Datei anzeigen

@ -20,7 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;

Datei anzeigen

@ -20,7 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;

Datei anzeigen

@ -20,7 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * 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.BlockChangeRecord;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_16_2; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_16_2;

Datei anzeigen

@ -2,37 +2,41 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.Chunk;
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
import com.viaversion.viaversion.api.type.PartialType; import com.viaversion.viaversion.api.type.PartialType;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.chunk.BaseChunkBulkType; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class ChunkBulk1_8Type extends PartialType<Chunk[], ClientWorld> { public class BulkChunkType1_8 extends PartialType<Chunk[], ClientWorld> {
private static final int BLOCKS_PER_SECTION = 16 * 16 * 16; private static final int BLOCKS_PER_SECTION = 16 * 16 * 16;
private static final int BLOCKS_BYTES = BLOCKS_PER_SECTION * 2; private static final int BLOCKS_BYTES = BLOCKS_PER_SECTION * 2;
private static final int LIGHT_BYTES = BLOCKS_PER_SECTION / 2; private static final int LIGHT_BYTES = BLOCKS_PER_SECTION / 2;
private static final int BIOME_BYTES = 16 * 16; private static final int BIOME_BYTES = 16 * 16;
public ChunkBulk1_8Type(final ClientWorld clientWorld) { public BulkChunkType1_8(final ClientWorld clientWorld) {
super(clientWorld, Chunk[].class); super(clientWorld, Chunk[].class);
} }
@ -56,7 +60,7 @@ public class ChunkBulk1_8Type extends PartialType<Chunk[], ClientWorld> {
for (int i = 0; i < chunks.length; i++) { for (int i = 0; i < chunks.length; i++) {
final ChunkBulkSection chunkBulkSection = chunkInfo[i]; final ChunkBulkSection chunkBulkSection = chunkInfo[i];
chunkBulkSection.readData(input); 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; return chunks;
@ -85,7 +89,7 @@ public class ChunkBulk1_8Type extends PartialType<Chunk[], ClientWorld> {
} }
// Write data // Write data
for (Chunk c : chunks) { 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<Chunk[], ClientWorld> {
input.readBytes(this.data); input.readBytes(this.data);
} }
public int getChunkX() { public int chunkX() {
return this.chunkX; return this.chunkX;
} }
public int getChunkZ() { public int chunkZ() {
return this.chunkZ; return this.chunkZ;
} }
public int getBitmask() { public int bitmask() {
return this.bitmask; return this.bitmask;
} }
public byte[] getData() { public byte[] data() {
return this.data; return this.data;
} }
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.Via; 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.Type;
import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType;
import com.viaversion.viaversion.api.type.types.version.Types1_13; 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 io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> { public class ChunkType1_13 extends PartialType<Chunk, ClientWorld> {
public Chunk1_13Type(ClientWorld param) { public ChunkType1_13(ClientWorld param) {
super(param, Chunk.class); super(param, Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
@ -30,9 +35,9 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class Chunk1_14Type extends Type<Chunk> { public class ChunkType1_14 extends Type<Chunk> {
public Chunk1_14Type() { public ChunkType1_14() {
super(Chunk.class); super(Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
@ -30,10 +35,10 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class Chunk1_15Type extends Type<Chunk> { public class ChunkType1_15 extends Type<Chunk> {
private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0];
public Chunk1_15Type() { public ChunkType1_15() {
super(Chunk.class); super(Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
@ -30,10 +35,10 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class Chunk1_16Type extends Type<Chunk> { public class ChunkType1_16 extends Type<Chunk> {
private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0];
public Chunk1_16Type() { public ChunkType1_16() {
super(Chunk.class); super(Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
@ -30,10 +35,10 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class Chunk1_16_2Type extends Type<Chunk> { public class ChunkType1_16_2 extends Type<Chunk> {
private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0];
public Chunk1_16_2Type() { public ChunkType1_16_2() {
super(Chunk.class); super(Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
@ -32,11 +37,11 @@ import java.util.Arrays;
import java.util.BitSet; import java.util.BitSet;
import java.util.List; import java.util.List;
public final class Chunk1_17Type extends Type<Chunk> { public final class ChunkType1_17 extends Type<Chunk> {
private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0]; private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0];
private final int ySectionCount; private final int ySectionCount;
public Chunk1_17Type(int ySectionCount) { public ChunkType1_17(int ySectionCount) {
super(Chunk.class); super(Chunk.class);
Preconditions.checkArgument(ySectionCount > 0); Preconditions.checkArgument(ySectionCount > 0);
this.ySectionCount = ySectionCount; this.ySectionCount = ySectionCount;

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.google.common.base.Preconditions; 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.Chunk1_18;
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
import com.viaversion.viaversion.api.type.Type; 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 io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public final class Chunk1_18Type extends Type<Chunk> { public final class ChunkType1_18 extends Type<Chunk> {
private final ChunkSectionType1_18 sectionType; private final ChunkSectionType1_18 sectionType;
private final int ySectionCount; 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); super(Chunk.class);
Preconditions.checkArgument(ySectionCount > 0); Preconditions.checkArgument(ySectionCount > 0);
this.sectionType = new ChunkSectionType1_18(globalPaletteBlockBits, globalPaletteBiomeBits); this.sectionType = new ChunkSectionType1_18(globalPaletteBlockBits, globalPaletteBiomeBits);
@ -65,7 +67,7 @@ public final class Chunk1_18Type extends Type<Chunk> {
final int blockEntitiesLength = Type.VAR_INT.readPrimitive(buffer); final int blockEntitiesLength = Type.VAR_INT.readPrimitive(buffer);
final List<BlockEntity> blockEntities = new ArrayList<>(blockEntitiesLength); final List<BlockEntity> blockEntities = new ArrayList<>(blockEntitiesLength);
for (int i = 0; i < blockEntitiesLength; i++) { 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); return new Chunk1_18(chunkX, chunkZ, sections, heightMap, blockEntities);
@ -92,7 +94,7 @@ public final class Chunk1_18Type extends Type<Chunk> {
Type.VAR_INT.writePrimitive(buffer, chunk.blockEntities().size()); Type.VAR_INT.writePrimitive(buffer, chunk.blockEntities().size());
for (final BlockEntity blockEntity : chunk.blockEntities()) { for (final BlockEntity blockEntity : chunk.blockEntities()) {
Types1_18.BLOCK_ENTITY.write(buffer, blockEntity); Type.BLOCK_ENTITY1_18.write(buffer, blockEntity);
} }
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.Environment;
import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; 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.Type;
import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType;
import com.viaversion.viaversion.api.type.types.version.Types1_8; 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.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import java.util.ArrayList; import java.util.ArrayList;
public class Chunk1_8Type extends PartialType<Chunk, ClientWorld> { public class ChunkType1_8 extends PartialType<Chunk, ClientWorld> {
public Chunk1_8Type(ClientWorld param) { public ChunkType1_8(ClientWorld param) {
super(param, Chunk.class); super(param, Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.Environment;
import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; 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.Type;
import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType;
import com.viaversion.viaversion.api.type.types.version.Types1_9; 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 io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet; import java.util.BitSet;
public class Chunk1_9_1_2Type extends PartialType<Chunk, ClientWorld> { public class ChunkType1_9_1 extends PartialType<Chunk, ClientWorld> {
public Chunk1_9_1_2Type(ClientWorld clientWorld) { public ChunkType1_9_1(ClientWorld clientWorld) {
super(clientWorld, Chunk.class); super(clientWorld, Chunk.class);
} }

Datei anzeigen

@ -2,20 +2,25 @@
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors * Copyright (C) 2016-2023 ViaVersion and contributors
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * 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, * The above copyright notice and this permission notice shall be included in all
* but WITHOUT ANY WARRANTY; without even the implied warranty of * copies or substantial portions of the Software.
* 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.api.Via; 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.Type;
import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType;
import com.viaversion.viaversion.api.type.types.version.Types1_9; 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 io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class Chunk1_9_3_4Type extends PartialType<Chunk, ClientWorld> { public class ChunkType1_9_3 extends PartialType<Chunk, ClientWorld> {
public Chunk1_9_3_4Type(ClientWorld param) { public ChunkType1_9_3(ClientWorld param) {
super(param, Chunk.class); super(param, Chunk.class);
} }

Datei anzeigen

@ -22,11 +22,9 @@
*/ */
package com.viaversion.viaversion.api.type.types.version; 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.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14;
import com.viaversion.viaversion.api.type.Type; 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.MetaListType;
import com.viaversion.viaversion.api.type.types.metadata.MetadataType; import com.viaversion.viaversion.api.type.types.metadata.MetadataType;
import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.misc.ParticleType;
@ -34,7 +32,6 @@ import java.util.List;
public final class Types1_18 { public final class Types1_18 {
public static final Type<BlockEntity> BLOCK_ENTITY = new BlockEntityType1_18();
public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading 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 MetaTypes1_14 META_TYPES = new MetaTypes1_14(PARTICLE);
public static final Type<Metadata> METADATA = new MetadataType(META_TYPES); public static final Type<Metadata> METADATA = new MetadataType(META_TYPES);

Datei anzeigen

@ -22,11 +22,9 @@
*/ */
package com.viaversion.viaversion.api.type.types.version; 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.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_20_2; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_20_2;
import com.viaversion.viaversion.api.type.Type; 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.MetaListType;
import com.viaversion.viaversion.api.type.types.metadata.MetadataType; import com.viaversion.viaversion.api.type.types.metadata.MetadataType;
import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.misc.ParticleType;
@ -34,7 +32,6 @@ import java.util.List;
public final class Types1_20_2 { public final class Types1_20_2 {
public static final Type<BlockEntity> BLOCK_ENTITY = new BlockEntityType1_20_2();
public static final ParticleType PARTICLE = Types1_20.PARTICLE; // Only safe to use after protocol loading 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 MetaTypes1_20_2 META_TYPES = new MetaTypes1_20_2(PARTICLE);
public static final Type<Metadata> METADATA = new MetadataType(META_TYPES); public static final Type<Metadata> METADATA = new MetadataType(META_TYPES);

Datei anzeigen

@ -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_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.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.ServerboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -179,7 +179,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
// Chunk Data // Chunk Data
registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> { registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); 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()) { if (Via.getConfig().isReplacePistons()) {
int replacementId = Via.getConfig().getPistonReplacementId(); int replacementId = Via.getConfig().getPistonReplacementId();

Datei anzeigen

@ -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_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.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.ServerboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
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.rewriter.SoundRewriter;
import com.viaversion.viaversion.util.Pair; import com.viaversion.viaversion.util.Pair;
@ -208,7 +208,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> { registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); 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; if (chunk.getBlockEntities() == null) return;
for (CompoundTag tag : chunk.getBlockEntities()) { for (CompoundTag tag : chunk.getBlockEntities()) {

Datei anzeigen

@ -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_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.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.ServerboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
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.Protocol1_9To1_8; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter;
@ -110,7 +110,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> { registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); 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); Chunk chunk = wrapper.passthrough(type);
for (int s = 0; s < chunk.getSections().length; s++) { for (int s = 0; s < chunk.getSections().length; s++) {

Datei anzeigen

@ -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_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.ClientboundPackets1_13;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_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.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.rewriter.TagRewriter;

Datei anzeigen

@ -25,8 +25,8 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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_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.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_9_3to1_9_1_2.storage.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
public class WorldPackets { public class WorldPackets {
@ -36,7 +36,7 @@ public class WorldPackets {
protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); 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()) { for (ChunkSection section : chunk.getSections()) {
if (section == null) { if (section == null) {

Datei anzeigen

@ -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.BlockConnectionStorage;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage; 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_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.rewriter.SoundRewriter;
import com.viaversion.viaversion.util.ChatColorUtil; import com.viaversion.viaversion.util.ChatColorUtil;
import com.viaversion.viaversion.util.GsonUtil; import com.viaversion.viaversion.util.GsonUtil;

Datei anzeigen

@ -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_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.Protocol1_13To1_12_2;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.metadata.MetadataRewriter1_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 { public class EntityPackets {

Datei anzeigen

@ -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.BlockEntityProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PaintingProvider; 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.storage.BlockStorage;
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_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.ints.IntSet;
@ -331,8 +331,8 @@ public class WorldPackets {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
BlockStorage storage = wrapper.user().get(BlockStorage.class); BlockStorage storage = wrapper.user().get(BlockStorage.class);
Chunk1_9_3_4Type type = new Chunk1_9_3_4Type(clientWorld); ChunkType1_9_3 type = new ChunkType1_9_3(clientWorld);
Chunk1_13Type type1_13 = new Chunk1_13Type(clientWorld); ChunkType1_13 type1_13 = new ChunkType1_13(clientWorld);
Chunk chunk = wrapper.read(type); Chunk chunk = wrapper.read(type);
wrapper.write(type1_13, chunk); wrapper.write(type1_13, chunk);

Datei anzeigen

@ -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.PlayerPackets;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.WorldPackets; 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_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.CommandRewriter;
import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.rewriter.ComponentRewriter;
import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter;

Datei anzeigen

@ -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.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.metadata.MetadataRewriter1_14To1_13_2;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14; 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.LinkedList;
import java.util.List; import java.util.List;

Datei anzeigen

@ -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.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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.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.ClientboundPackets1_14;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2; 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.storage.EntityTracker1_14;
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_9_3to1_9_1_2.storage.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.util.CompactArrayUtil; import com.viaversion.viaversion.util.CompactArrayUtil;
import java.util.Arrays; import java.util.Arrays;
@ -126,8 +126,8 @@ public class WorldPackets {
protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
Chunk chunk = wrapper.read(new Chunk1_13Type(clientWorld)); Chunk chunk = wrapper.read(new ChunkType1_13(clientWorld));
wrapper.write(new Chunk1_14Type(), chunk); wrapper.write(new ChunkType1_14(), chunk);
int[] motionBlocking = new int[16 * 16]; int[] motionBlocking = new int[16 * 16];
int[] worldSurface = new int[16 * 16]; int[] worldSurface = new int[16 * 16];

Datei anzeigen

@ -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.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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_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.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; import com.viaversion.viaversion.rewriter.BlockRewriter;
public final class WorldPackets { public final class WorldPackets {
@ -40,8 +40,8 @@ public final class WorldPackets {
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_14_4.ACKNOWLEDGE_PLAYER_DIGGING); blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_14_4.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerClientbound(ClientboundPackets1_14_4.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_14_4.CHUNK_DATA, wrapper -> {
Chunk chunk = wrapper.read(new Chunk1_14Type()); Chunk chunk = wrapper.read(new ChunkType1_14());
wrapper.write(new Chunk1_15Type(), chunk); wrapper.write(new ChunkType1_15(), chunk);
if (chunk.isFullChunk()) { if (chunk.isFullChunk()) {
int[] biomeData = chunk.getBiomeData(); int[] biomeData = chunk.getBiomeData();

Datei anzeigen

@ -27,9 +27,9 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type; 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.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.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.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 com.viaversion.viaversion.rewriter.BlockRewriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -46,8 +46,8 @@ public class WorldPackets {
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.ACKNOWLEDGE_PLAYER_DIGGING); blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerClientbound(ClientboundPackets1_16.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_16.CHUNK_DATA, wrapper -> {
Chunk chunk = wrapper.read(new Chunk1_16Type()); Chunk chunk = wrapper.read(new ChunkType1_16());
wrapper.write(new Chunk1_16_2Type(), chunk); wrapper.write(new ChunkType1_16_2(), chunk);
for (int s = 0; s < chunk.getSections().length; s++) { for (int s = 0; s < chunk.getSections().length; s++) {
ChunkSection section = chunk.getSections()[s]; ChunkSection section = chunk.getSections()[s];

Datei anzeigen

@ -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.Type;
import com.viaversion.viaversion.api.type.types.UUIDIntArrayType; 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.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.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.rewriter.BlockRewriter;
import com.viaversion.viaversion.util.CompactArrayUtil; import com.viaversion.viaversion.util.CompactArrayUtil;
import java.util.Map; import java.util.Map;
@ -59,8 +59,8 @@ public class WorldPackets {
}); });
protocol.registerClientbound(ClientboundPackets1_15.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_15.CHUNK_DATA, wrapper -> {
Chunk chunk = wrapper.read(new Chunk1_15Type()); Chunk chunk = wrapper.read(new ChunkType1_15());
wrapper.write(new Chunk1_16Type(), chunk); wrapper.write(new ChunkType1_16(), chunk);
chunk.setIgnoreOldLightData(chunk.isFullChunk()); chunk.setIgnoreOldLightData(chunk.isFullChunk());

Datei anzeigen

@ -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.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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.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.ClientboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4; 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 com.viaversion.viaversion.rewriter.BlockRewriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet; import java.util.BitSet;
@ -122,7 +122,7 @@ public final class WorldPackets {
}); });
protocol.registerClientbound(ClientboundPackets1_16_2.CHUNK_DATA, wrapper -> { 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()) { if (!chunk.isFullChunk()) {
// All chunks are full chunk packets now (1.16 already stopped sending non-full chunks) // All chunks are full chunk packets now (1.16 already stopped sending non-full chunks)
// Construct multi block change packets instead // Construct multi block change packets instead
@ -134,7 +134,7 @@ public final class WorldPackets {
} }
// Normal full chunk writing // 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 // 1.17 uses a bitset for the mask
chunk.setChunkMask(BitSet.valueOf(new long[]{chunk.getBitmask()})); chunk.setChunkMask(BitSet.valueOf(new long[]{chunk.getBitmask()}));

Datei anzeigen

@ -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.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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_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.BlockEntityIds;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1; 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.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.Key;
import com.viaversion.viaversion.util.MathUtil; import com.viaversion.viaversion.util.MathUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -103,7 +103,7 @@ public final class WorldPackets {
protocol.registerClientbound(ClientboundPackets1_17_1.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_17_1.CHUNK_DATA, wrapper -> {
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); 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<BlockEntity> blockEntities = new ArrayList<>(oldChunk.getBlockEntities().size()); final List<BlockEntity> blockEntities = new ArrayList<>(oldChunk.getBlockEntities().size());
for (final CompoundTag tag : oldChunk.getBlockEntities()) { 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); 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(protocol.getMappingData().getBlockStateMappings().mappedSize()),
MathUtil.ceilLog2(tracker.biomesSent())), chunk); MathUtil.ceilLog2(tracker.biomesSent())), chunk);

Datei anzeigen

@ -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.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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_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.Protocol1_19_3To1_19_1;
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3;
@ -44,7 +44,7 @@ public final class InventoryPackets extends ItemRewriter<ClientboundPackets1_19_
blockRewriter.registerBlockChange(ClientboundPackets1_19_1.BLOCK_CHANGE); blockRewriter.registerBlockChange(ClientboundPackets1_19_1.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_1.MULTI_BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_1.MULTI_BLOCK_CHANGE);
blockRewriter.registerEffect(ClientboundPackets1_19_1.EFFECT, 1010, 2001); blockRewriter.registerEffect(ClientboundPackets1_19_1.EFFECT, 1010, 2001);
blockRewriter.registerChunkData1_19(ClientboundPackets1_19_1.CHUNK_DATA, Chunk1_18Type::new); blockRewriter.registerChunkData1_19(ClientboundPackets1_19_1.CHUNK_DATA, ChunkType1_18::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_19_1.BLOCK_ENTITY_DATA); blockRewriter.registerBlockEntityData(ClientboundPackets1_19_1.BLOCK_ENTITY_DATA);
registerSetCooldown(ClientboundPackets1_19_1.COOLDOWN); registerSetCooldown(ClientboundPackets1_19_1.COOLDOWN);

Datei anzeigen

@ -20,7 +20,7 @@ package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.packets;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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_3to1_19_1.ClientboundPackets1_19_3; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.rewriter.RecipeRewriter1_19_3; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.rewriter.RecipeRewriter1_19_3;
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
@ -40,7 +40,7 @@ public final class InventoryPackets extends ItemRewriter<ClientboundPackets1_19_
blockRewriter.registerBlockAction(ClientboundPackets1_19_3.BLOCK_ACTION); blockRewriter.registerBlockAction(ClientboundPackets1_19_3.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_19_3.BLOCK_CHANGE); blockRewriter.registerBlockChange(ClientboundPackets1_19_3.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_3.MULTI_BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_3.MULTI_BLOCK_CHANGE);
blockRewriter.registerChunkData1_19(ClientboundPackets1_19_3.CHUNK_DATA, Chunk1_18Type::new); blockRewriter.registerChunkData1_19(ClientboundPackets1_19_3.CHUNK_DATA, ChunkType1_18::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_19_3.BLOCK_ENTITY_DATA); blockRewriter.registerBlockEntityData(ClientboundPackets1_19_3.BLOCK_ENTITY_DATA);
protocol.registerClientbound(ClientboundPackets1_19_3.EFFECT, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_19_3.EFFECT, new PacketHandlers() {

Datei anzeigen

@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
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_19to1_18_2.Protocol1_19To1_18_2; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
@ -46,7 +46,7 @@ public final class WorldPackets {
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
Preconditions.checkArgument(tracker.biomesSent() != -1, "Biome count not set"); Preconditions.checkArgument(tracker.biomesSent() != -1, "Biome count not set");
Preconditions.checkArgument(tracker.currentWorldSectionHeight() != -1, "Section height not set"); Preconditions.checkArgument(tracker.currentWorldSectionHeight() != -1, "Section height not set");
final Chunk1_18Type chunkType = new Chunk1_18Type(tracker.currentWorldSectionHeight(), final ChunkType1_18 chunkType = new ChunkType1_18(tracker.currentWorldSectionHeight(),
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()),
MathUtil.ceilLog2(tracker.biomesSent())); MathUtil.ceilLog2(tracker.biomesSent()));
final Chunk chunk = wrapper.passthrough(chunkType); final Chunk chunk = wrapper.passthrough(chunkType);

Datei anzeigen

@ -35,7 +35,7 @@ import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; 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_4to1_19_3.ClientboundPackets1_19_4; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.RecipeRewriter1_19_4; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.RecipeRewriter1_19_4;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.Protocol1_20_2To1_20; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.Protocol1_20_2To1_20;
@ -90,7 +90,7 @@ public final class BlockItemPacketRewriter1_20_2 extends ItemRewriter<Clientboun
protocol.registerClientbound(ClientboundPackets1_19_4.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_19_4.CHUNK_DATA, wrapper -> {
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
final Type<Chunk> chunkType = new Chunk1_18Type(tracker.currentWorldSectionHeight(), final Type<Chunk> chunkType = new ChunkType1_18(tracker.currentWorldSectionHeight(),
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()), MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()),
MathUtil.ceilLog2(tracker.biomesSent())); MathUtil.ceilLog2(tracker.biomesSent()));
final Chunk chunk = wrapper.read(chunkType); final Chunk chunk = wrapper.read(chunkType);

Datei anzeigen

@ -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.Type;
import com.viaversion.viaversion.api.type.types.chunk.BaseChunkType; 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.chunk.ChunkSectionType1_18;
import com.viaversion.viaversion.api.type.types.version.Types1_20_2;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -62,7 +61,7 @@ public final class ChunkType1_20_2 extends Type<Chunk> {
final int blockEntitiesLength = Type.VAR_INT.readPrimitive(buffer); final int blockEntitiesLength = Type.VAR_INT.readPrimitive(buffer);
final List<BlockEntity> blockEntities = new ArrayList<>(blockEntitiesLength); final List<BlockEntity> blockEntities = new ArrayList<>(blockEntitiesLength);
for (int i = 0; i < blockEntitiesLength; i++) { 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); return new Chunk1_18(chunkX, chunkZ, sections, heightMap, blockEntities);
@ -89,7 +88,7 @@ public final class ChunkType1_20_2 extends Type<Chunk> {
Type.VAR_INT.writePrimitive(buffer, chunk.blockEntities().size()); Type.VAR_INT.writePrimitive(buffer, chunk.blockEntities().size());
for (final BlockEntity blockEntity : chunk.blockEntities()) { for (final BlockEntity blockEntity : chunk.blockEntities()) {
Types1_20_2.BLOCK_ENTITY.write(buffer, blockEntity); Type.BLOCK_ENTITY1_20_2.write(buffer, blockEntity);
} }
} }

Datei anzeigen

@ -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.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter; 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.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.ServerboundPackets1_19_4;
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.RecipeRewriter1_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<ClientboundPackets1_19_
protocol.registerClientbound(ClientboundPackets1_19_4.CHUNK_DATA, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_19_4.CHUNK_DATA, new PacketHandlers() {
@Override @Override
protected void register() { protected void register() {
handler(blockRewriter.chunkDataHandler1_19(Chunk1_18Type::new, InventoryPackets.this::handleBlockEntity)); handler(blockRewriter.chunkDataHandler1_19(ChunkType1_18::new, InventoryPackets.this::handleBlockEntity));
read(Type.BOOLEAN); // Trust edges read(Type.BOOLEAN); // Trust edges
} }
}); });

Datei anzeigen

@ -32,10 +32,10 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.chunks.FakeTileEntity; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.chunks.FakeTileEntity;
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_9_1to1_9.types.Chunk1_9_1_2Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9;
import java.util.List; import java.util.List;
@ -87,8 +87,8 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
registerClientbound(ClientboundPackets1_9.CHUNK_DATA, wrapper -> { registerClientbound(ClientboundPackets1_9.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
Chunk chunk = wrapper.read(new Chunk1_9_1_2Type(clientWorld)); Chunk chunk = wrapper.read(new ChunkType1_9_1(clientWorld));
wrapper.write(new Chunk1_9_3_4Type(clientWorld), chunk); wrapper.write(new ChunkType1_9_3(clientWorld), chunk);
List<CompoundTag> tags = chunk.getBlockEntities(); List<CompoundTag> tags = chunk.getBlockEntities();
for (int s = 0; s < chunk.getSections().length; s++) { for (int s = 0; s < chunk.getSections().length; s++) {

Datei anzeigen

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}

Datei anzeigen

@ -30,7 +30,7 @@ import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_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.metadata.MetadataRewriter1_9To1_8;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.EntityPackets; import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.EntityPackets;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.InventoryPackets; import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.InventoryPackets;

Datei anzeigen

@ -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.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; 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.ItemRewriter;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.PlayerMovementMapper; import com.viaversion.viaversion.protocols.protocol1_9to1_8.PlayerMovementMapper;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;

Datei anzeigen

@ -32,8 +32,8 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_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.api.type.types.chunk.ChunkType1_9_1;
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.ClientboundPackets1_9; 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.ItemRewriter;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; 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.sounds.SoundEffect;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.ClientChunks; 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.storage.EntityTracker1_9;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.types.Chunk1_8Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_8;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.types.ChunkBulk1_8Type; import com.viaversion.viaversion.api.type.types.chunk.BulkChunkType1_8;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Optional; import java.util.Optional;
@ -122,7 +122,7 @@ public class WorldPackets {
protocol.registerClientbound(ClientboundPackets1_8.CHUNK_DATA, wrapper -> { protocol.registerClientbound(ClientboundPackets1_8.CHUNK_DATA, wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
ClientChunks clientChunks = wrapper.user().get(ClientChunks.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()); long chunkHash = ClientChunks.toLong(chunk.getX(), chunk.getZ());
@ -152,7 +152,7 @@ public class WorldPackets {
} }
} }
} else { } else {
Type<Chunk> chunkType = new Chunk1_9_1_2Type(clientWorld); Type<Chunk> chunkType = new ChunkType1_9_1(clientWorld);
wrapper.write(chunkType, chunk); wrapper.write(chunkType, chunk);
clientChunks.getLoadedChunks().add(chunkHash); clientChunks.getLoadedChunks().add(chunkHash);
@ -177,9 +177,9 @@ public class WorldPackets {
wrapper.cancel(); // Cancel the packet from being sent wrapper.cancel(); // Cancel the packet from being sent
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
ClientChunks clientChunks = wrapper.user().get(ClientChunks.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<Chunk> chunkType = new Chunk1_9_1_2Type(clientWorld); Type<Chunk> chunkType = new ChunkType1_9_1(clientWorld);
// Split into multiple chunk packets // Split into multiple chunk packets
for (Chunk chunk : chunks) { for (Chunk chunk : chunks) {
PacketWrapper chunkData = wrapper.create(ClientboundPackets1_9.CHUNK_DATA); PacketWrapper chunkData = wrapper.create(ClientboundPackets1_9.CHUNK_DATA);