mirror of
https://github.com/ViaVersion/ViaLegacy.git
synced 2024-12-22 16:38:16 +01:00
Renamed chunk type classes
This commit is contained in:
parent
4986c4b4df
commit
83dbbff520
@ -32,9 +32,9 @@ import java.util.ArrayList;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class Chunk1_1Type extends Type<Chunk> {
|
||||
public class ChunkType1_1 extends Type<Chunk> {
|
||||
|
||||
public Chunk1_1Type() {
|
||||
public ChunkType1_1() {
|
||||
super(Chunk.class);
|
||||
}
|
||||
|
@ -24,6 +24,6 @@ import com.viaversion.viaversion.api.type.Type;
|
||||
public class Types1_1 {
|
||||
|
||||
public static Type<BlockChangeRecord[]> BLOCK_CHANGE_RECORD_ARRAY = new BlockChangeRecordArrayType();
|
||||
public static Type<Chunk> CHUNK = new Chunk1_1Type();
|
||||
public static Type<Chunk> CHUNK = new ChunkType1_1();
|
||||
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.Ch
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ProtocolMetadataStorage;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.metadata.MetaIndex1_8to1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Chunk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -459,7 +459,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
|
||||
if (!load) {
|
||||
final Chunk chunk = new BaseChunk(chunkX, chunkZ, true, false, 0, new ChunkSection[16], null, new ArrayList<>());
|
||||
wrapper.write(new Chunk1_7_6Type(wrapper.user().get(ClientWorld.class)), chunk);
|
||||
wrapper.write(new ChunkType1_7_6(wrapper.user().get(ClientWorld.class)), chunk);
|
||||
} else {
|
||||
wrapper.cancel();
|
||||
}
|
||||
@ -496,7 +496,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper.write(new Chunk1_7_6Type(clientWorld), chunk);
|
||||
wrapper.write(new ChunkType1_7_6(clientWorld), chunk);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -22,9 +22,9 @@ import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Chunk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkType1_7_6;
|
||||
|
||||
public class Chunk1_2_4Type extends Chunk1_7_6Type {
|
||||
public class ChunkType1_2_4 extends ChunkType1_7_6 {
|
||||
|
||||
private static final ClientWorld OVERWORLD = new ClientWorld(null);
|
||||
|
||||
@ -32,7 +32,7 @@ public class Chunk1_2_4Type extends Chunk1_7_6Type {
|
||||
OVERWORLD.setEnvironment(Environment.NORMAL.id());
|
||||
}
|
||||
|
||||
public Chunk1_2_4Type() {
|
||||
public ChunkType1_2_4() {
|
||||
super(OVERWORLD);
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ public class Types1_2_4 {
|
||||
public static final Type<Item[]> ITEM_ARRAY = new ItemArrayType<>(ITEM);
|
||||
public static final Type<Item[]> COMPRESSED_NBT_ITEM_ARRAY = new ItemArrayType<>(COMPRESSED_NBT_ITEM);
|
||||
|
||||
public static final Type<Chunk> CHUNK = new Chunk1_2_4Type();
|
||||
public static final Type<Chunk> CHUNK = new ChunkType1_2_4();
|
||||
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.rewriter.ItemRewriter;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.types.ChunkBulk1_4_4Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.types.ChunkBulkType1_4_4;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_5_0_1to1_4_6_7.ClientboundPackets1_4_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.MetaType1_6_4;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.metadata.MetaIndex1_8to1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulkType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
|
||||
|
||||
public class Protocol1_4_6_7to1_4_4_5 extends StatelessProtocol<ClientboundPackets1_4_4, ClientboundPackets1_4_6, ServerboundPackets1_5_2, ServerboundPackets1_5_2> {
|
||||
@ -129,7 +129,7 @@ public class Protocol1_4_6_7to1_4_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
||||
wrapper.write(new ChunkBulk1_7_6Type(clientWorld), wrapper.read(new ChunkBulk1_4_4Type(clientWorld)));
|
||||
wrapper.write(new ChunkBulkType1_7_6(clientWorld), wrapper.read(new ChunkBulkType1_4_4(clientWorld)));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -19,11 +19,11 @@ package net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.types;
|
||||
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulkType1_7_6;
|
||||
|
||||
public class ChunkBulk1_4_4Type extends ChunkBulk1_7_6Type {
|
||||
public class ChunkBulkType1_4_4 extends ChunkBulkType1_7_6 {
|
||||
|
||||
public ChunkBulk1_4_4Type(ClientWorld clientWorld) {
|
||||
public ChunkBulkType1_4_4(ClientWorld clientWorld) {
|
||||
super(clientWorld);
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ import net.raphimc.vialegacy.protocols.release.protocol1_7_6_10to1_7_2_5.Serverb
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.Protocol1_8to1_7_6_10;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.model.GameProfile;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.providers.GameProfileFetcher;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Chunk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulkType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.MetaType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
|
||||
|
||||
@ -421,7 +421,7 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final Chunk chunk = wrapper.passthrough(new Chunk1_7_6Type(wrapper.user().get(ClientWorld.class)));
|
||||
final Chunk chunk = wrapper.passthrough(new ChunkType1_7_6(wrapper.user().get(ClientWorld.class)));
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(chunk);
|
||||
});
|
||||
}
|
||||
@ -486,7 +486,7 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final Chunk[] chunks = wrapper.passthrough(new ChunkBulk1_7_6Type(wrapper.user().get(ClientWorld.class)));
|
||||
final Chunk[] chunks = wrapper.passthrough(new ChunkBulkType1_7_6(wrapper.user().get(ClientWorld.class)));
|
||||
for (Chunk chunk : chunks) {
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(chunk);
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.rewriter.Ch
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.rewriter.ItemRewriter;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.rewriter.TranslationRewriter;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.*;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Chunk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulk1_7_6Type;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulkType1_7_6;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -633,7 +633,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final Chunk chunk = wrapper.read(new Chunk1_7_6Type(wrapper.user().get(ClientWorld.class)));
|
||||
final Chunk chunk = wrapper.read(new ChunkType1_7_6(wrapper.user().get(ClientWorld.class)));
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(chunk);
|
||||
wrapper.write(new Chunk1_8Type(wrapper.user().get(ClientWorld.class)), chunk);
|
||||
});
|
||||
@ -696,7 +696,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final Chunk[] chunks = wrapper.read(new ChunkBulk1_7_6Type(wrapper.user().get(ClientWorld.class)));
|
||||
final Chunk[] chunks = wrapper.read(new ChunkBulkType1_7_6(wrapper.user().get(ClientWorld.class)));
|
||||
for (Chunk chunk : chunks) {
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(chunk);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
import net.lenni0451.mcstructs.snbt.SNbtSerializer;
|
||||
import net.lenni0451.mcstructs.snbt.exceptions.SNbtSerializeException;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_6_10to1_7_2_5.ClientboundPackets1_7_2;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.Protocol1_8to1_7_6_10;
|
||||
import net.raphimc.vialegacy.util.NbtConverter;
|
||||
|
||||
@ -358,10 +359,10 @@ public class ChatItemRewriter {
|
||||
ID_TO_NAME.put(2267, "record_wait");
|
||||
}
|
||||
|
||||
private final ComponentRewriter SHOW_ITEM;
|
||||
private final ComponentRewriter<ClientboundPackets1_7_2> SHOW_ITEM;
|
||||
|
||||
public ChatItemRewriter(final Protocol1_8to1_7_6_10 protocol) {
|
||||
this.SHOW_ITEM = new ComponentRewriter(protocol) {
|
||||
this.SHOW_ITEM = new ComponentRewriter<ClientboundPackets1_7_2>(protocol) {
|
||||
@Override
|
||||
protected void handleHoverEvent(JsonObject hoverEvent) {
|
||||
super.handleHoverEvent(hoverEvent);
|
||||
|
@ -32,9 +32,9 @@ import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class ChunkBulk1_7_6Type extends PartialType<Chunk[], ClientWorld> {
|
||||
public class ChunkBulkType1_7_6 extends PartialType<Chunk[], ClientWorld> {
|
||||
|
||||
public ChunkBulk1_7_6Type(final ClientWorld clientWorld) {
|
||||
public ChunkBulkType1_7_6(final ClientWorld clientWorld) {
|
||||
super(clientWorld, Chunk[].class);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class ChunkBulk1_7_6Type extends PartialType<Chunk[], ClientWorld> {
|
||||
additionalBitMask[i] = byteBuf.readShort();
|
||||
}
|
||||
|
||||
final byte[] uncompressedData = new byte[Chunk1_7_6Type.getSize((short) 0xFFFF, (short) 0xFFFF, true, hasSkyLight) * chunkCount];
|
||||
final byte[] uncompressedData = new byte[ChunkType1_7_6.getSize((short) 0xFFFF, (short) 0xFFFF, true, hasSkyLight) * chunkCount];
|
||||
final Inflater inflater = new Inflater();
|
||||
try {
|
||||
inflater.setInput(data, 0, compressedSize);
|
||||
@ -96,9 +96,9 @@ public class ChunkBulk1_7_6Type extends PartialType<Chunk[], ClientWorld> {
|
||||
final Chunk[] chunks = new Chunk[chunkCount];
|
||||
int dataPosition = 0;
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
final byte[] chunkData = new byte[Chunk1_7_6Type.getSize(primaryBitMask[i], additionalBitMask[i], true, hasSkyLight)];
|
||||
final byte[] chunkData = new byte[ChunkType1_7_6.getSize(primaryBitMask[i], additionalBitMask[i], true, hasSkyLight)];
|
||||
System.arraycopy(uncompressedData, dataPosition, chunkData, 0, chunkData.length);
|
||||
chunks[i] = Chunk1_7_6Type.deserialize(chunkX[i], chunkZ[i], true, hasSkyLight, primaryBitMask[i], additionalBitMask[i], chunkData);
|
||||
chunks[i] = ChunkType1_7_6.deserialize(chunkX[i], chunkZ[i], true, hasSkyLight, primaryBitMask[i], additionalBitMask[i], chunkData);
|
||||
dataPosition += chunkData.length;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class ChunkBulk1_7_6Type extends PartialType<Chunk[], ClientWorld> {
|
||||
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
final Chunk chunk = chunks[i];
|
||||
final Pair<byte[], Short> chunkData = Chunk1_7_6Type.serialize(chunk);
|
||||
final Pair<byte[], Short> chunkData = ChunkType1_7_6.serialize(chunk);
|
||||
output.write(chunkData.key());
|
||||
chunkX[i] = chunk.getX();
|
||||
chunkZ[i] = chunk.getZ();
|
@ -36,9 +36,9 @@ import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class Chunk1_7_6Type extends PartialType<Chunk, ClientWorld> {
|
||||
public class ChunkType1_7_6 extends PartialType<Chunk, ClientWorld> {
|
||||
|
||||
public Chunk1_7_6Type(final ClientWorld clientWorld) {
|
||||
public ChunkType1_7_6(final ClientWorld clientWorld) {
|
||||
super(clientWorld, Chunk.class);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user