public static <T extends org.bukkit.entity.Entity> NBTTagCompound getEntityNBT(T entity) {
		NBTTagCompound compound = new NBTTagCompound();
		if(!(entity instanceof org.bukkit.entity.Entity)) {
			return null;
		}
		Entity nms = ((CraftEntity)entity).getHandle();
		Class<? extends Object> clazz = nms.getClass();
		Method[] methods = clazz.getMethods();
		for (Method method : methods) {
			if ((method.getName() == "b")
					&& (method.getParameterTypes().length == 1)
					&& (method.getParameterTypes()[0] == NBTTagCompound.class)) {
				try {
					method.setAccessible(true);
					method.invoke(nms, compound);
				} catch (Exception e) {
					e.printStackTrace();
				}
		   }
		}
		if(compound.getString("id") == null || compound.getString("id").isEmpty()) {
			compound.setString("id", entity.getType().toString());
		}
		return compound;
	}