Skip to content

Commit

Permalink
Updated Via API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 19, 2023
1 parent 0a55b0a commit 5ed1d3a
Show file tree
Hide file tree
Showing 28 changed files with 233 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.task.WorldBorderUpdateTask;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.packet.Direction;
Expand All @@ -42,7 +43,6 @@
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;

import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -126,7 +126,10 @@ public void init(UserConnection userConnection) {
userConnection.put(new CompressionStatusTracker(userConnection));
userConnection.put(new WorldBorderEmulator(userConnection));
userConnection.put(new PlayerAbilitiesTracker(userConnection));
userConnection.put(new ClientWorld(userConnection));

if (!userConnection.has(ClientWorld.class)) {
userConnection.put(new ClientWorld(userConnection));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.viaversion.viarewind.utils.math.AABB;
import com.viaversion.viarewind.utils.math.Vector3d;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_8;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
Expand Down Expand Up @@ -200,7 +200,7 @@ private void writeZombieMeta(PacketWrapper metadataPacket) {
metadataList.add(new Metadata(metadata.id(), metadata.metaType(), metadata.getValue()));
}
if (small) metadataList.add(new Metadata(12, MetaType1_8.Byte, (byte) 1));
getProtocol().getMetadataRewriter().transform(Entity1_10Types.EntityType.ZOMBIE, metadataList);
getProtocol().getMetadataRewriter().transform(EntityTypes1_10.EntityType.ZOMBIE, metadataList);

metadataPacket.write(Types1_7_6_10.METADATA_LIST, metadataList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10;
import com.viaversion.viarewind.utils.PacketUtil;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
Expand Down Expand Up @@ -100,7 +100,7 @@ public void updateMetadata() {
metadataList.add(new Metadata(metadata.id(), metadata.metaType(), metadata.getValue()));
}

getProtocol().getMetadataRewriter().transform(Entity1_10Types.EntityType.SQUID, metadataList);
getProtocol().getMetadataRewriter().transform(EntityTypes1_10.EntityType.SQUID, metadataList);

metadataPacket.write(Types1_7_6_10.METADATA_LIST, metadataList);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10;
import com.viaversion.viarewind.utils.PacketUtil;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
Expand Down Expand Up @@ -101,7 +101,7 @@ public void updateMetadata() {
metadataList.add(new Metadata(metadata.id(), metadata.metaType(), metadata.getValue()));
}

getProtocol().getMetadataRewriter().transform(Entity1_10Types.EntityType.SQUID, metadataList);
getProtocol().getMetadataRewriter().transform(EntityTypes1_10.EntityType.SQUID, metadataList);

metadataPacket.write(Types1_7_6_10.METADATA_LIST, metadataList);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10;
import com.viaversion.viarewind.utils.PacketUtil;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
Expand Down Expand Up @@ -100,7 +100,7 @@ public void updateMetadata() {
metadataList.add(new Metadata(metadata.id(), metadata.metaType(), metadata.getValue()));
}

getProtocol().getMetadataRewriter().transform(Entity1_10Types.EntityType.CHICKEN, metadataList);
getProtocol().getMetadataRewriter().transform(EntityTypes1_10.EntityType.CHICKEN, metadataList);

metadataPacket.write(Types1_7_6_10.METADATA_LIST, metadataList);

Expand Down
Loading

0 comments on commit 5ed1d3a

Please sign in to comment.