package me.deftware.client.framework.network.packets;

import me.deftware.client.framework.entity.Entity;
import me.deftware.client.framework.network.PacketWrapper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.EntityS2CPacket;

/**
 * @author Deftware
 */
public class SPacketEntity extends PacketWrapper {

	public SPacketEntity(Packet<?> packet) {
		super(packet);
	}

	public boolean isOnGround() {
		return ((EntityS2CPacket) packet).isOnGround();
	}

	public Entity getEntity() {
		return Entity.newInstance(((EntityS2CPacket) packet).getEntity(MinecraftClient.getInstance().world));
	}

}

@@ -303,16 +303,51 @@
 acket;%0A%0A
+import javax.annotation.Nullable;%0A%0A
 /**%0A * @
@@ -562,24 +562,35 @@
 ound();%0A%09%7D%0A%0A
+%09@Nullable%0A
 %09public Enti
@@ -612,34 +612,45 @@
 %7B%0A%09%09
-return Entity.newInstance(
+net.minecraft.entity.Entity entity = 
 ((En
@@ -718,16 +718,76 @@
 ).world)
+;%0A%09%09return entity == null ? null : Entity.newInstance(entity
 );%0A%09%7D%0A%0A%7D

Fix nullptr