Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-08 22:02:50 +02:00
Cleanup and change class/package names from 1.9.3
Dieser Commit ist enthalten in:
Ursprung
7c274fb03d
Commit
8ffc056a7e
@ -5,12 +5,12 @@ import com.google.common.collect.Sets;
|
||||
import org.bukkit.Bukkit;
|
||||
import us.myles.ViaVersion.api.Pair;
|
||||
import us.myles.ViaVersion.protocols.base.BaseProtocol;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3.Protocol1_9_1_2TO1_9_3;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2TO1_9_3_4;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1TO1_9;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3TO1_9_1_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_9_1.Protocol1_9TO1_9_1;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.ProtocolSnapshotTo1_9_3;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.ProtocolSnapshotTo1_9_3_4;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -33,8 +33,8 @@ public class ProtocolRegistry {
|
||||
registerProtocol(new Protocol1_9_3TO1_9_1_2(), Arrays.asList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_9_2.getId());
|
||||
// Only supported for 1.9.4 server to 1.9 (nothing else)
|
||||
registerProtocol(new Protocol1_9TO1_9_1(), Arrays.asList(ProtocolVersion.v1_9.getId()), ProtocolVersion.v1_9_2.getId());
|
||||
registerProtocol(new Protocol1_9_1_2TO1_9_3(), Arrays.asList(ProtocolVersion.v1_9_1.getId(), ProtocolVersion.v1_9_2.getId()), ProtocolVersion.v1_9_3.getId());
|
||||
registerProtocol(new ProtocolSnapshotTo1_9_3(), Collections.singletonList(ProtocolVersion.SNAPSHOT.getId()), ProtocolVersion.v1_9_3.getId());
|
||||
registerProtocol(new Protocol1_9_1_2TO1_9_3_4(), Arrays.asList(ProtocolVersion.v1_9_1.getId(), ProtocolVersion.v1_9_2.getId()), ProtocolVersion.v1_9_3.getId());
|
||||
registerProtocol(new ProtocolSnapshotTo1_9_3_4(), Collections.singletonList(ProtocolVersion.SNAPSHOT.getId()), ProtocolVersion.v1_9_3.getId());
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3;
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3;
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Chunk1_9_3 {
|
||||
public class Chunk1_9_3_4 {
|
||||
private int x;
|
||||
private int z;
|
||||
private boolean groundUp;
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3;
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||
@ -7,13 +7,13 @@ import us.myles.ViaVersion.api.type.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Chunk1_9_3Type extends Type<Chunk1_9_3> {
|
||||
public Chunk1_9_3Type() {
|
||||
super("1.9.3 Chunk", Chunk1_9_3.class);
|
||||
public class Chunk1_9_3_4Type extends Type<Chunk1_9_3_4> {
|
||||
public Chunk1_9_3_4Type() {
|
||||
super("1.9.3 Chunk", Chunk1_9_3_4.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chunk1_9_3 read(ByteBuf input) throws Exception {
|
||||
public Chunk1_9_3_4 read(ByteBuf input) throws Exception {
|
||||
int chunkX = input.readInt();
|
||||
int chunkZ = input.readInt();
|
||||
|
||||
@ -29,11 +29,11 @@ public class Chunk1_9_3Type extends Type<Chunk1_9_3> {
|
||||
for (int i = 0; i < blockEntities; i++) {
|
||||
nbtData.add(Type.NBT.read(input));
|
||||
}
|
||||
return new Chunk1_9_3(chunkX, chunkZ, groundUp, primaryBitmask, sections, nbtData);
|
||||
return new Chunk1_9_3_4(chunkX, chunkZ, groundUp, primaryBitmask, sections, nbtData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buffer, Chunk1_9_3 chunk) throws Exception {
|
||||
public void write(ByteBuf buffer, Chunk1_9_3_4 chunk) throws Exception {
|
||||
buffer.writeInt(chunk.getX());
|
||||
buffer.writeInt(chunk.getZ());
|
||||
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3;
|
||||
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4;
|
||||
|
||||
import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
@ -10,8 +10,8 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
|
||||
public class Protocol1_9_1_2TO1_9_3 extends Protocol {
|
||||
public static Type<Chunk1_9_3> CHUNK = new Chunk1_9_3Type();
|
||||
public class Protocol1_9_1_2TO1_9_3_4 extends Protocol {
|
||||
public static Type<Chunk1_9_3_4> CHUNK = new Chunk1_9_3_4Type();
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
@ -56,7 +56,7 @@ public class Protocol1_9_1_2TO1_9_3 extends Protocol {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
Chunk1_9_3 chunk = wrapper.passthrough(CHUNK);
|
||||
Chunk1_9_3_4 chunk = wrapper.passthrough(CHUNK);
|
||||
BlockEntity.handle(chunk.getBlockEntities(), wrapper.user());
|
||||
}
|
||||
});
|
@ -10,10 +10,12 @@ import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.storage.ResourcePackTracker;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.types.MetaListSnapshotType;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.types.MetaSnapshotType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProtocolSnapshotTo1_9_3 extends Protocol {
|
||||
public class ProtocolSnapshotTo1_9_3_4 extends Protocol {
|
||||
public static final Type<List<Metadata>> METADATA_LIST = new MetaListSnapshotType();
|
||||
public static final Type<Metadata> METADATA = new MetaSnapshotType();
|
||||
public static ValueTransformer<Short, Float> toNewPitch = new ValueTransformer<Short, Float>(Type.FLOAT) {
|
@ -1,10 +1,11 @@
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3;
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.types;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.api.type.types.minecraft.MetaListTypeTemplate;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.ProtocolSnapshotTo1_9_3_4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -16,7 +17,7 @@ public class MetaListSnapshotType extends MetaListTypeTemplate {
|
||||
List<Metadata> list = new ArrayList<>();
|
||||
Metadata meta;
|
||||
do {
|
||||
meta = ProtocolSnapshotTo1_9_3.METADATA.read(buffer);
|
||||
meta = ProtocolSnapshotTo1_9_3_4.METADATA.read(buffer);
|
||||
if (meta != null)
|
||||
list.add(meta);
|
||||
} while (meta != null);
|
||||
@ -30,11 +31,11 @@ public class MetaListSnapshotType extends MetaListTypeTemplate {
|
||||
if (m.getId() >= 5)
|
||||
m.setId(m.getId() + 1);
|
||||
if (m.getId() == 4)
|
||||
ProtocolSnapshotTo1_9_3.METADATA.write(buffer, new Metadata(5, NewType.Boolean.getTypeID(), Type.BOOLEAN, false)); // No gravity metadata
|
||||
ProtocolSnapshotTo1_9_3.METADATA.write(buffer, m);
|
||||
ProtocolSnapshotTo1_9_3_4.METADATA.write(buffer, new Metadata(5, NewType.Boolean.getTypeID(), Type.BOOLEAN, false)); // No gravity metadata
|
||||
ProtocolSnapshotTo1_9_3_4.METADATA.write(buffer, m);
|
||||
}
|
||||
|
||||
// Write end of list
|
||||
ProtocolSnapshotTo1_9_3.METADATA.write(buffer, null);
|
||||
ProtocolSnapshotTo1_9_3_4.METADATA.write(buffer, null);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3;
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.types;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren