All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.parzivail.util.network.PreciseEntityVelocityUpdateS2CPacket Maven / Gradle / Ivy

package com.parzivail.util.network;

import com.parzivail.util.data.PacketByteBufHelper;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.minecraft.class_1297;
import net.minecraft.class_243;
import net.minecraft.class_2540;
import net.minecraft.class_2743;
import net.minecraft.class_310;
import net.minecraft.class_634;

public class PreciseEntityVelocityUpdateS2CPacket extends class_2743
{
	private final class_243 position;
	private final class_243 velocity;

	public PreciseEntityVelocityUpdateS2CPacket(class_1297 entity)
	{
		this(entity.method_5628(), entity.method_19538(), entity.method_18798());
	}

	public PreciseEntityVelocityUpdateS2CPacket(int id, class_243 position, class_243 velocity)
	{
		super(id, velocity);
		this.position = position;
		this.velocity = velocity;
	}

	public PreciseEntityVelocityUpdateS2CPacket(class_2540 buf)
	{
		super(buf);
		this.position = PacketByteBufHelper.readVec3d(buf);
		this.velocity = PacketByteBufHelper.readVec3d(buf);
	}

	@Override
	public void method_11052(class_2540 buf)
	{
		super.method_11052(buf);
		PacketByteBufHelper.writeVec3d(buf, position);
		PacketByteBufHelper.writeVec3d(buf, velocity);
	}

	public class_243 getVelocity()
	{
		return velocity;
	}

	public class_243 getPosition()
	{
		return position;
	}

	public static void handle(class_310 client, class_634 handler, class_2540 buf, PacketSender sender)
	{
		var packet = new PreciseEntityVelocityUpdateS2CPacket(buf);
		client.execute(() -> handler.method_11132(packet));
	}
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy